From owner-cvs-src@FreeBSD.ORG Tue Oct 18 16:40:06 2005 Return-Path: X-Original-To: cvs-src@FreeBSD.org Delivered-To: cvs-src@FreeBSD.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id C476816A420; Tue, 18 Oct 2005 16:40:06 +0000 (GMT) (envelope-from obrien@NUXI.com) Received: from dragon.NUXI.org (trang.nuxi.com [66.93.134.19]) by mx1.FreeBSD.org (Postfix) with ESMTP id A902743D4C; Tue, 18 Oct 2005 16:40:05 +0000 (GMT) (envelope-from obrien@NUXI.com) Received: from dragon.NUXI.org (obrien@localhost [127.0.0.1]) by dragon.NUXI.org (8.13.4/8.13.4) with ESMTP id j9IGe5HR093516; Tue, 18 Oct 2005 09:40:05 -0700 (PDT) (envelope-from obrien@dragon.NUXI.org) Received: (from obrien@localhost) by dragon.NUXI.org (8.13.4/8.13.1/Submit) id j9IGe58M093507; Tue, 18 Oct 2005 09:40:05 -0700 (PDT) (envelope-from obrien) Date: Tue, 18 Oct 2005 09:40:01 -0700 From: "David O'Brien" To: Jung-uk Kim Message-ID: <20051018164001.GA92638@dragon.NUXI.org> References: <200510160858.j9G8wR9v045670@repoman.freebsd.org> <200510171642.26719.jkim@FreeBSD.org> <20051018153715.GE84920@dragon.NUXI.org> <200510181150.36257.jkim@FreeBSD.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200510181150.36257.jkim@FreeBSD.org> X-Operating-System: FreeBSD 7.0-CURRENT Organization: The NUXI BSD Group X-Pgp-Rsa-Fingerprint: B7 4D 3E E9 11 39 5F A3 90 76 5D 69 58 D9 98 7A X-Pgp-Rsa-Keyid: 1024/34F9F9D5 User-Agent: Mutt/1.5.9i Cc: cvs-src@FreeBSD.org, Eric Anholt , cvs-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: cvs commit: src/sys/amd64/amd64 identcpu.c src/sys/i386/i386 identcpu.c X-BeenThere: cvs-src@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: obrien@FreeBSD.org List-Id: CVS commit messages for the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Oct 2005 16:40:07 -0000 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@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 +#include @@ -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)