cvs commit: src/sys/amd64/amd64 identcpu.c src/sys/i386/i386 identcpu.c

David O'Brien obrien at FreeBSD.org
Tue Oct 18 09:40:07 PDT 2005


On Tue, Oct 18, 2005 at 11:50:31AM -0400, Jung-uk Kim wrote:
> On Tuesday 18 October 2005 11:37 am, David O'Brien wrote:
> > @@ -360,3 +361,4 @@
> >  			if (cmp > 1)
> > -				printf("\n  Cores per package: %d", cmp);
> > +				printf("\n  Found %d sockets with %d cores per package",
> > +				    mp_ncpus / cmp, cmp);
> >  			if ((htt / cmp) > 1)
> 
> You are always assuming there's nothing but SMP kernel.

To start with, I said this was a quick prototype - to discuss the DESIRED
OUTPUT until we get a better situation than now.  So yeah, its got
assumptions.  That said, one needs to be running an SMP kernel to get any
benefit on a multi-core system.

If you're running a UP kernel, then printing out "Found 1 socket(s) with
1 core per package" is accurate from the kernel's POV.

If we want a purely HW POV, we should add a userland app that uses your
SMBIOS code.  Or maybe this should be made generic and pushed to
sys/kern/ as CMP and SMT isn't x86-only.  It exists also in the Sparc and
MIPS worlds.

-- 
-- David  (obrien at FreeBSD.org)

Tweaked for UP kernels:
Index: sys/amd64/amd64/identcpu.c
===================================================================
RCS file: /home/ncvs/src/sys/amd64/amd64/identcpu.c,v
retrieving revision 1.140
diff -u -u -1 -r1.140 identcpu.c
--- sys/amd64/amd64/identcpu.c	17 Oct 2005 23:23:20 -0000	1.140
+++ sys/amd64/amd64/identcpu.c	18 Oct 2005 16:34:02 -0000
@@ -51,2 +51,3 @@
 #include <sys/power.h>
+#include <sys/smp.h>
 
@@ -360,3 +361,4 @@
 			if (cmp > 1)
-				printf("\n  Cores per package: %d", cmp);
+				printf("\n  Found %d socket(s) with %d cores per package",
+				    mp_ncpus > 1 ? mp_ncpus / cmp : mp_ncpus, cmp);
 			if ((htt / cmp) > 1)


More information about the cvs-src mailing list