[haiku-development] Fixing get_cpu_model_string(), Ticket 3541

  • From: Christian Packmann <Christian.Packmann@xxxxxx>
  • To: haiku-development@xxxxxxxxxxxxx
  • Date: Sat, 20 Jun 2009 13:02:39 +0200

Haiku will mis-identify many Core2 CPUs, see e.g.
http://dev.haiku-os.org/ticket/3541. This also affects my Core2Quad 9550 which shows as Core2 Extreme.

The problem is get_cpu_model_string() in
trunk/headers/private/shared/cpu_type.h
http://svn.berlios.de/viewcvs/haiku/haiku/trunk/headers/private/shared/cpu_type.h?revision=30106&view=markup

CPU strings are assigned via the processor signature here, but this is not precise; the signature is determined by a specific die stepping, but the same dies are often used for different CPU models.

The only solution I can see for this is using the CPUID brand string
functions 0xx80000002-4 for reading the CPUs brand string and then processing that string to get something more readable. I've got code for that which seems to work reasonably well.

Before:

AMD Sempron(tm) Processor 3000+
AMD Athlon(tm) 64 Processor 3200+
AMD Athlon(tm) 64 X2 Dual Core Processor 4200+
AMD Phenom(tm) 9950 Quad-Core Processor
Intel(R) Pentium(R) III CPU family 1400MHz
Intel(R) Pentium(R) 4 CPU 2.80GHz
Intel(R) Xeon(TM) CPU 3.20GHz
Intel(R) Pentium(R) M processor 1.70GHz
Intel(R) Core(TM)2 CPU          4300  @ 1.80GHz
Intel (R) Core(Tm)2 CPU T5500 @ 1.66Ghz
Intel(R) Core(TM)2 CPU         T7200  @ 2.00GHz
Intel(R) Core(TM)2 Duo CPU T9500 @ 2.60GHz
Intel(R) Core(TM)2 Duo CPU     T9600  @ 2.80GHz
Intel(R) Core(TM)2 Quad CPU    Q9550  @ 2.83GHz
Intel(R) Atom(TM) CPU N270   @ 1.60GHz
VIA Ezra

After:

AMD Sempron
AMD Athlon 64
AMD Athlon 64 X2
AMD Phenom 9950
Intel Pentium III
Intel Pentium 4
Intel Xeon
Intel Pentium M
Intel Core2 4300
Intel Core2 T5500
Intel Core2 T7200
Intel Core2 T9500
Intel Core2 T9600
Intel Core2 Q9550
Intel Atom N270
VIA Ezra


The code would need to be adapted for more models (e.g. Quad2 Extreme are not handled), but this would be easy, I use a list of strings which are to be stripped (e.g. " Quad", " Duo", "Quad-Core") which can be easily expanded. The rest of the processing should hold up well with the current naming schemes of the brand strings. Of course future changes might break that code, but that's life.

The function of get_cpu_model_string() would be modified as follows:
- check for existence of brand string
- if brand string present, use this for producing the name; otherwise fall back on the switch()-statement

If this change is desired, I'll implement it.

A question: the brand string is already read and stored in detect_cpu() in
/trunk/src/system/kernel/arch/x86/arch_cpu.cpp
Is it possible to read this information? This would make the code easier, as there'd be no need for calling CPUID in get_cpu_model_string().

Christian

Other related posts: