Date: Wed, 26 Sep 2012 11:09:23 +0200 From: Dimitry Andric <dim@FreeBSD.org> To: John Baldwin <jhb@freebsd.org> Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Andriy Gapon <avg@freebsd.org> Subject: Re: svn commit: r240773 - in head/sys: amd64/amd64 i386/i386 Message-ID: <5062C643.4060808@FreeBSD.org> In-Reply-To: <201209251339.08573.jhb@freebsd.org> References: <201209211031.q8LAVKVC014601@svn.freebsd.org> <5061D84D.4020400@FreeBSD.org> <5061E864.8090200@FreeBSD.org> <201209251339.08573.jhb@freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
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 <xx>_<yy>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--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?5062C643.4060808>