I noticed that linprocfs' cpuinfo gives me the wrong CPU model (according to the cpu_id, which is 0x591, it should be 9 instead of 5). % cat /compat/linux/proc/cpuinfo processor : 0 vendor_id : AuthenticAMD cpu family : 5 model : 5 <--- wrong! stepping : 1 flags : fpu vme de pse tsc msr mce cx8 pge mmx cpu MHz : 400.91 bogomips : 400.91 I came across the problem when I tried the latest Mplayer pre-release, which is not yet in the ports. Its configure script uses FreeBSD's linprocfs in order to determine the CPU it is being compiled on. Of course, it would be an easy task to patch Mplayer's configure script, which as a fallback cpu identification program (which uses the CPUID assembler instruction and works correctly btw.). But, IMO this is a bug in linprocfs and should be fixed. Fix: Since I do not know a lot about i386-class processor detection, my suggestions might be wrong, but I'll send them anyway: As far as I can see, the problem is here: i386/linux/linprocfs/linprocfs_misc.c, l. 199 switch (cpu_class) { case CPUCLASS_286: class = 2; break; case CPUCLASS_386: class = 3; break; case CPUCLASS_486: class = 4; break; case CPUCLASS_586: class = 5; break; case CPUCLASS_686: class = 6; break; default: class = 0; break; } ps = psbuf; ps += sprintf(ps, "processor\t: %d\n" "vendor_id\t: %.20s\n" "cpu family\t: %d\n" "model\t\t: %d\n" "stepping\t: %d\n", 0, cpu_vendor, class, cpu, cpu_id & 0xf); ps += sprintf(ps, "flags\t\t:"); Since pre-i586 CPUs do not support the CPUID instruction and cpu_id is not set on these CPUs (I am right here?), the information is collected from cpu_class, cpu (and cpu_id for the stepping). AFAIK, on a i586+class CPU, one could extract all the information from the cpu_id variable: 0, cpu_vendor, cpu_id & 0xf00, cpu_id & 0xf0, cpu_id & 0xf); I am not sure if there is a `model' specification for pre-i586 CPUs, and if there is one, how to extract it. Perhaps this here might be a solution, that keeps compatibility with older CPUs, but sets the model for newer ones correctly: 0, cpu_vendor, class, cpu_id & 0xf0, cpu_id & 0xf); How-To-Repeat: cat /compat/linux/proc/cpuinfo on 586+ class CPUs.
I think this was fixed with rev1.95 of linprocfs.c in Jun 2006. I know it's a bit old, but possibly you can verify this? -- << Marcin Cieslak // saper@system.pl >>
State Changed From-To: open->feedback Note that submitter has been asked for feedback.
State Changed From-To: feedback->open Over to maintainer(s).
Responsible Changed From-To: freebsd-bugs->freebsd-emulation Put back into the "open" state. Although no feedback was received, as far as I can tell hte code hasn't changed, and this bug should be easy for somebody familiar with linprocfs to verify.
i can confirm that this problem still exists in 9.0-CURRENT (FreeBSD otaku 9.0-CURRENT FreeBSD 9.0-CURRENT #0 r197043: Sat Sep 12 01:07:56 CEST 2009 root@otaku:/usr/obj/usr/src/sys/ARUNDEL i386). from `dmesg`: Timecounter "i8254" frequency 1193182 Hz quality 0 CPU: Intel(R) Pentium(R) Dual CPU E2160 @ 1.80GHz (1800.01-MHz 686-class CPU) Origin = "GenuineIntel" Id = 0x6fd Stepping = 13 Features=0xbfebfbff<FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CLFLUSH,DTS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE> Features2=0xe39d<SSE3,DTES64,MON,DS_CPL,EST,TM2,SSSE3,CX16,xTPR,PDCM> AMD Features=0x20100000<NX,LM> AMD Features2=0x1<LAHF> TSC: P-state invariant from `cat /compat/linux/proc/cpuinfo`: processor : 0 vendor_id : GenuineIntel cpu family : 6 model : 7 model name : Intel(R) Pentium(R) Dual CPU E2160 @ 1.80GHz stepping : 13 processor : 1 vendor_id : GenuineIntel cpu family : 6 model : 7 model name : Intel(R) Pentium(R) Dual CPU E2160 @ 1.80GHz stepping : 13 flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 b19 b21 mmxext mmx fxsr xmm sse2 b27 b28 b29 3dnow cpu MHz : 1800.01 bogomips : 1800.01 cheers. alex
seems cpuinfo is broken too under amd64. this is the output i get: processor : 0 vendor_id : GenuineIntel cpu family : 15 model : 1 model name : Intel(R) Pentium(R) Dual CPU E2160 @ 1.80GHz stepping : 13 processor : 1 vendor_id : GenuineIntel cpu family : 15 model : 1 model name : Intel(R) Pentium(R) Dual CPU E2160 @ 1.80GHz stepping : 13 flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 b19 b21 mmxext mmx fxsr xmm sse2 b27 b28 b29 3dnow cpu MHz : 1800.01 bogomips : 1800.01 since dmesg says Origin = "GenuineIntel" Id = 0x6fd Stepping = 13 the values for model and cpu family are wrong. with the patch (well lets call it hack ;)) attached the output changes to processor : 0 vendor_id : GenuineIntel cpu family : 6 model : 15 model name : Intel(R) Pentium(R) Dual CPU E2160 @ 1.80GHz stepping : 13 processor : 1 vendor_id : GenuineIntel cpu family : 6 model : 15 model name : Intel(R) Pentium(R) Dual CPU E2160 @ 1.80GHz stepping : 13 flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 b19 b21 mmxext mmx fxsr xmm sse2 b27 b28 b29 3dnow cpu MHz : 1800.01 bogomips : 1800.01 which i believe is what the output should look like. maybe somebody could shed some light on this. maybe by starting to look for the place where "class" and "cpu" are being defined? cheers. alex
actually it appears the patch i submitted isn't that hackish. this is exactly what's being done in i386/i386/identcpu.c and amd64/amd64/identcpu.c to output the cpu stepping. cheers. alex
to committer: please turn all the %d's into %u's since cpu_vendor and cpu_id are unsigned. cheers. alex
here's a final cleaned up patch using macros instead of direct AND's and shifts. alex
Responsible Changed From-To: freebsd-emulation->des linprocfs is mine.
any update on this issue? for me the last patch i submitted as followup to this PR works. cheers. alex -- a13x
this patch should apply cleanly to HEAD. cheers. alex -- a13x
Author: des Date: Mon Nov 8 12:04:41 2010 New Revision: 214982 URL: http://svn.freebsd.org/changeset/base/214982 Log: Fix CPU ID in /proc/cpuinfo. PR: kern/56451 Submitted by: arundel@ MFC after: 3 weeks Modified: head/sys/compat/linprocfs/linprocfs.c Modified: head/sys/compat/linprocfs/linprocfs.c ============================================================================== --- head/sys/compat/linprocfs/linprocfs.c Mon Nov 8 11:22:55 2010 (r214981) +++ head/sys/compat/linprocfs/linprocfs.c Mon Nov 8 12:04:41 2010 (r214982) @@ -276,11 +276,11 @@ linprocfs_docpuinfo(PFS_FILL_ARGS) sbuf_printf(sb, "processor\t: %d\n" "vendor_id\t: %.20s\n" - "cpu family\t: %d\n" - "model\t\t: %d\n" + "cpu family\t: %u\n" + "model\t\t: %u\n" "model name\t: %s\n" - "stepping\t: %d\n\n", - i, cpu_vendor, class, cpu, model, cpu_id & 0xf); + "stepping\t: %u\n\n", + i, cpu_vendor, CPUID_TO_FAMILY(cpu_id), CPUID_TO_MODEL(cpu_id), model, cpu_id & CPUID_STEPPING); /* XXX per-cpu vendor / class / model / id? */ } _______________________________________________ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
State Changed From-To: open->patched Fixed in HEAD (214982).
State Changed From-To: patched->closed MFCed/fixed by now or it will never be MFCed
Author: des Date: Sat Mar 16 22:43:08 2013 New Revision: 248390 URL: http://svnweb.freebsd.org/changeset/base/248390 Log: MFH (r214982, r214985): fix CPU ID in /proc/cpuinfo. PR: kern/56451 Approved by: re (kib) Modified: stable/8/sys/compat/linprocfs/linprocfs.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/compat/ (props changed) Modified: stable/8/sys/compat/linprocfs/linprocfs.c ============================================================================== --- stable/8/sys/compat/linprocfs/linprocfs.c Sat Mar 16 22:40:20 2013 (r248389) +++ stable/8/sys/compat/linprocfs/linprocfs.c Sat Mar 16 22:43:08 2013 (r248390) @@ -276,11 +276,12 @@ linprocfs_docpuinfo(PFS_FILL_ARGS) sbuf_printf(sb, "processor\t: %d\n" "vendor_id\t: %.20s\n" - "cpu family\t: %d\n" - "model\t\t: %d\n" + "cpu family\t: %u\n" + "model\t\t: %u\n" "model name\t: %s\n" - "stepping\t: %d\n", - i, cpu_vendor, class, cpu, model, cpu_id & 0xf); + "stepping\t: %u\n\n", + i, cpu_vendor, CPUID_TO_FAMILY(cpu_id), + CPUID_TO_MODEL(cpu_id), model, cpu_id & CPUID_STEPPING); /* XXX per-cpu vendor / class / model / id? */ } _______________________________________________ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"