Linux-Kernel

/proc/cpuinfo 如何檢測 CPU 型號?

  • October 19, 2021

dmidecode我有一台伺服器,它在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   

基於Max Speed,我猜它是Xeon 5080 CPU。但是,根據/proc/cpuinfo,它是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
# 

當我檢查 中列出的標誌/功能時/proc/cpuinfo,它會顯示ssse3,它在Xeon 5080中受支持,而在Xeon E5335中不受支持。如何/proc/cpuinfo檢測CPU型號?

在 x86 上,它使用支持的CPUID“處理器品牌字元串”功能。因此,在您的情況下,返回“Intel(R) Xeon(R) CPU E5335 @ 2.00GHz”字元串的是 CPU 本身。這對應於dmidecode輸出:ID: FB 06 00 00 01 03 00 00匹配 06FB CPUID, E53355080將具有 0F64 CPUID)。

arch/x86/kernel/cpu/common.c您可以在’sget_model_name函式中看到核心實現。

Xeon E5335 是 Clovertown CPU,它支持 SSSE3

引用自:https://unix.stackexchange.com/questions/400168