From owner-svn-src-head@FreeBSD.ORG Wed Sep 26 09:09:24 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5707A106564A; Wed, 26 Sep 2012 09:09:24 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from tensor.andric.com (tensor.andric.com [87.251.56.140]) by mx1.freebsd.org (Postfix) with ESMTP id CB0928FC12; Wed, 26 Sep 2012 09:09:23 +0000 (UTC) Received: from [IPv6:2001:7b8:3a7:0:1d51:4889:7997:c8cd] (unknown [IPv6:2001:7b8:3a7:0:1d51:4889:7997:c8cd]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by tensor.andric.com (Postfix) with ESMTPSA id AF54C5C59; Wed, 26 Sep 2012 11:09:21 +0200 (CEST) Message-ID: <5062C643.4060808@FreeBSD.org> Date: Wed, 26 Sep 2012 11:09:23 +0200 From: Dimitry Andric Organization: The FreeBSD Project User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:16.0) Gecko/20120905 Thunderbird/16.0 MIME-Version: 1.0 To: John Baldwin References: <201209211031.q8LAVKVC014601@svn.freebsd.org> <5061D84D.4020400@FreeBSD.org> <5061E864.8090200@FreeBSD.org> <201209251339.08573.jhb@freebsd.org> In-Reply-To: <201209251339.08573.jhb@freebsd.org> Content-Type: multipart/mixed; boundary="------------040906030801090000070803" Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Andriy Gapon Subject: Re: svn commit: r240773 - in head/sys: amd64/amd64 i386/i386 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Sep 2012 09:09:24 -0000 This is a multi-part message in MIME format. --------------040906030801090000070803 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit On 2012-09-25 19:39, John Baldwin wrote: > On Tuesday, September 25, 2012 1:22:44 pm Andriy Gapon wrote: >> on 09/25/12 19:14 Dimitry Andric said the following: >>> Are we interested more in "beautifying", than giving >>> unambiguous information? >> >> OTOH, I have never seen CPUID numbers in decimal. The point is, that in this specific dmesg line, we first print a hexadecimal ID with 0x, then follow it by IDs which are still hexadecimal, but NOT prefixed with 0x. That is inconsistent, and thus confusing; either print them all without prefix, or print them all with prefix (or a suffix). The latter is most unambiguous, in my opinion. > And the place you typically will use these is in looking at Intel's manuals in > which case they have the _h layout. If you want to gratuitously > change the format, I'd vote for outputting the string as '06_2Ah'. That's also fine with me, as long as *all* IDs get identified in the same manner. :) Are you OK with the attached patch, which suffixes all the ID information with 'h'? > Note that the full ID is already printed out earlier on the same line with a > trailing 0x, so it's not clear to me that it was confusing before. On some machines, the full ID is very clearly related to the family, model and such, for example on Gavin's Nocona test machine: CPU: Intel(R) Xeon(TM) CPU 2.80GHz (2793.24-MHz K8-class CPU) Origin = "GenuineIntel" Id = 0xf41 Family = f Model = 4 Stepping = 1 Here the family, model and stepping are just the individual hex digits of the full ID. However, on a more recent machine, such as this one, dmesg has: CPU: Intel(R) Core(TM) i5 CPU 650 @ 3.20GHz (3192.07-MHz K8-class CPU) Origin = "GenuineIntel" Id = 0x20652 Family = 6 Model = 25 Stepping = 2 The family, model and stepping are now not so easily recognized from the full ID, at least not at first glance. --------------040906030801090000070803 Content-Type: text/x-diff; name="cpuid-hex-1.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="cpuid-hex-1.diff" Index: sys/i386/i386/identcpu.c =================================================================== --- sys/i386/i386/identcpu.c (revision 240948) +++ sys/i386/i386/identcpu.c (working copy) @@ -678,7 +678,7 @@ printcpuinfo(void) if(*cpu_vendor) printf(" Origin = \"%s\"",cpu_vendor); if(cpu_id) - printf(" Id = 0x%x", cpu_id); + printf(" Id = %xh", cpu_id); if (cpu_vendor_id == CPU_VENDOR_INTEL || cpu_vendor_id == CPU_VENDOR_AMD || @@ -688,8 +688,8 @@ printcpuinfo(void) cpu_vendor_id == CPU_VENDOR_NSC || (cpu_vendor_id == CPU_VENDOR_CYRIX && ((cpu_id & 0xf00) > 0x500))) { - printf(" Family = 0x%x", CPUID_TO_FAMILY(cpu_id)); - printf(" Model = 0x%x", CPUID_TO_MODEL(cpu_id)); + printf(" Family = %xh", CPUID_TO_FAMILY(cpu_id)); + printf(" Model = %xh", CPUID_TO_MODEL(cpu_id)); printf(" Stepping = %u", cpu_id & CPUID_STEPPING); if (cpu_vendor_id == CPU_VENDOR_CYRIX) printf("\n DIR=0x%04x", cyrix_did); Index: sys/amd64/amd64/identcpu.c =================================================================== --- sys/amd64/amd64/identcpu.c (revision 240948) +++ sys/amd64/amd64/identcpu.c (working copy) @@ -208,13 +208,13 @@ printcpuinfo(void) if (*cpu_vendor) printf(" Origin = \"%s\"", cpu_vendor); if (cpu_id) - printf(" Id = 0x%x", cpu_id); + printf(" Id = %xh", cpu_id); if (cpu_vendor_id == CPU_VENDOR_INTEL || cpu_vendor_id == CPU_VENDOR_AMD || cpu_vendor_id == CPU_VENDOR_CENTAUR) { - printf(" Family = 0x%x", CPUID_TO_FAMILY(cpu_id)); - printf(" Model = 0x%x", CPUID_TO_MODEL(cpu_id)); + printf(" Family = %xh", CPUID_TO_FAMILY(cpu_id)); + printf(" Model = %xh", CPUID_TO_MODEL(cpu_id)); printf(" Stepping = %u", cpu_id & CPUID_STEPPING); /* --------------040906030801090000070803--