Linux – How does /proc/cpuinfo detect the CPU model

linux-kernel

I have a server which displays the following information in dmidecode output for CPU:

Handle 0x000D, DMI type 4, 35 bytes                            
Processor Information          
        Socket Designation: CPU 1                              
        Type: Central Processor                                
        Family: Xeon           
        Manufacturer: GenuineIntel                             
        ID: FB 06 00 00 01 03 00 00                            
        Signature: Type 0, Family 6, Model 15, Stepping 11     
        Flags:                 
                FPU (Floating-point unit on-chip)              
                CX8 (CMPXCHG8 instruction supported)           
                APIC (On-chip APIC hardware supported)         
        Version: Intel Xeon    
        Voltage: 1.2 V         
        External Clock: 266 MHz                                
        Max Speed: 3733 MHz    
        Current Speed: 2000 MHz                                
        Status: Populated, Enabled                             
        Upgrade: ZIF Socket    
        L1 Cache Handle: 0x0009                                
        L2 Cache Handle: 0x000A                                
        L3 Cache Handle: Not Provided                          
        Serial Number: Not Specified                           
        Asset Tag: Not Specified                               
        Part Number: Not Specified   

Based on Max Speed, I would guess that it is a Xeon 5080 CPU. However, according to /proc/cpuinfo, it is Xeon E5335:

# grep "model name" /proc/cpuinfo
model name      : Intel(R) Xeon(R) CPU           E5335  @ 2.00GHz
model name      : Intel(R) Xeon(R) CPU           E5335  @ 2.00GHz
model name      : Intel(R) Xeon(R) CPU           E5335  @ 2.00GHz
model name      : Intel(R) Xeon(R) CPU           E5335  @ 2.00GHz
# 

When I check the flags/features listed in /proc/cpuinfo, then it shows ssse3, which is supported in Xeon 5080 and not in Xeon E5335.
How does /proc/cpuinfo detect the CPU model?

Best Answer

On x86, it uses the CPUID “Processor Brand String” feature, where supported. Thus in your case it’s the CPU itself which is returning the “Intel(R) Xeon(R) CPU E5335 @ 2.00GHz“ string. This corresponds to the dmidecode output: ID: FB 06 00 00 01 03 00 00 matches a 06FB CPUID, i.e. E5335 (a 5080 would have a 0F64 CPUID).

You can see the kernel implementation in arch/x86/kernel/cpu/common.c’s get_model_name function.

The Xeon E5335 is a Clovertown CPU, which does support SSSE3.