From owner-cvs-src@FreeBSD.ORG Mon Oct 17 20:42:40 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 C030316A41F; Mon, 17 Oct 2005 20:42:40 +0000 (GMT) (envelope-from jkim@FreeBSD.org) Received: from anuket.mj.niksun.com (gwnew.niksun.com [65.115.46.162]) by mx1.FreeBSD.org (Postfix) with ESMTP id 27DDE43D46; Mon, 17 Oct 2005 20:42:39 +0000 (GMT) (envelope-from jkim@FreeBSD.org) Received: from niksun.com (anuket [10.70.0.5]) by anuket.mj.niksun.com (8.13.1/8.13.1) with ESMTP id j9HKoR0m084743; Mon, 17 Oct 2005 16:50:27 -0400 (EDT) (envelope-from jkim@FreeBSD.org) From: Jung-uk Kim To: John Baldwin Date: Mon, 17 Oct 2005 16:42:24 -0400 User-Agent: KMail/1.6.2 References: <200510160858.j9G8wR9v045670@repoman.freebsd.org> <1129576130.1152.30.camel@leguin> <200510171554.46682.jhb@freebsd.org> In-Reply-To: <200510171554.46682.jhb@freebsd.org> MIME-Version: 1.0 Content-Disposition: inline Content-Type: Multipart/Mixed; boundary="Boundary-00=_yyAVDEJ8WWt8p2+" Message-Id: <200510171642.26719.jkim@FreeBSD.org> X-Virus-Scanned: ClamAV devel-20050919/1140/Mon Oct 17 15:02:41 2005 on anuket.mj.niksun.com X-Virus-Status: Clean Cc: cvs-src@FreeBSD.org, Eric Anholt , cvs-all@FreeBSD.org, obrien@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 List-Id: CVS commit messages for the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Oct 2005 20:42:40 -0000 --Boundary-00=_yyAVDEJ8WWt8p2+ Content-Type: text/plain; charset="euc-kr" Content-Transfer-Encoding: 7bit Content-Disposition: inline On Monday 17 October 2005 03:54 pm, John Baldwin wrote: > Doing it for each CPU would really bloat the output, and in > practice I don't think would buy us anything. Note that the code > assumes the package topology is uniform as well, not just the > printfs. :) :-) > Probably the messages could be made less ambiguous by splitting it > into two lines that say something like: > Cores per package: 2 > Logical CPUs per core: 1 > > Except that each line would only print if it's value was greater > than 1. Thus, on David's box you would get: > Cores per package: 2 > > On a PIV with HTT would get: > Logical CPUs per core: 2 > > And on the super-spiffy Zueeglecorp CPU, you would get: > Cores per package: 4 > Logical CPUs per core: 4 The patch is attached. Please review. Thanks for the suggestions and no thanks for bikeshed, Jung-uk Kim --Boundary-00=_yyAVDEJ8WWt8p2+ Content-Type: text/x-diff; charset="euc-kr"; name="identcpu.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="identcpu.diff" Index: sys/amd64/amd64/identcpu.c =================================================================== RCS file: /home/ncvs/src/sys/amd64/amd64/identcpu.c,v retrieving revision 1.139 diff -u -r1.139 identcpu.c --- sys/amd64/amd64/identcpu.c 17 Oct 2005 15:51:27 -0000 1.139 +++ sys/amd64/amd64/identcpu.c 17 Oct 2005 20:37:01 -0000 @@ -358,9 +358,10 @@ cmp = ((regs[0] & 0xfc000000) >> 26) + 1; } if (cmp > 1) - printf("\n Physical cores: %d", cmp); - if (htt > 1) - printf("\n Logical cores: %d", htt); + printf("\n Cores per package: %d", cmp); + if ((htt / cmp) > 1) + printf("\n Logical CPUs per core: %d", + htt / cmp); } } /* Avoid ugly blank lines: only print newline when we have to. */ Index: sys/i386/i386/identcpu.c =================================================================== RCS file: /home/ncvs/src/sys/i386/i386/identcpu.c,v retrieving revision 1.148 diff -u -r1.148 identcpu.c --- sys/i386/i386/identcpu.c 17 Oct 2005 15:51:28 -0000 1.148 +++ sys/i386/i386/identcpu.c 17 Oct 2005 20:37:01 -0000 @@ -848,9 +848,10 @@ cmp = ((regs[0] & 0xfc000000) >> 26) + 1; } if (cmp > 1) - printf("\n Physical cores: %d", cmp); - if (htt > 1) - printf("\n Logical cores: %d", htt); + printf("\n Cores per package: %d", cmp); + if ((htt / cmp) > 1) + printf("\n Logical CPUs per core: %d", + htt / cmp); } } else if (strcmp(cpu_vendor, "CyrixInstead") == 0) { printf(" DIR=0x%04x", cyrix_did); --Boundary-00=_yyAVDEJ8WWt8p2+--