Linux – Why aren’t the CPUs numbered sequentially

arch linuxcpu

I'm using Arch Linux

Linux JamesPC 4.10.11-1-ARCH #1 SMP PREEMPT Tue Apr 18 08:39:42 CEST 2017 x86_64 GNU/Linux

While trying to figure out why my system monitor is suddenly only showing one CPU (when I should have six):
enter image description here

I found this oddity that I think may be causing the system monitor to not work properly:

cat /proc/cpuinfo:

[gilmoreja@JamesPC ~]$ cat /proc/cpuinfo
processor   : 0
vendor_id   : AuthenticAMD
cpu family  : 21
model       : 1
model name  : AMD FX(tm)-6100 Six-Core Processor
stepping    : 2
microcode   : 0x600063d
cpu MHz     : 3311.103
cache size  : 2048 KB
physical id : 0
siblings    : 6
core id     : 0
cpu cores   : 3
apicid      : 16
initial apicid  : 0
fpu     : yes
fpu_exception   : yes
cpuid level : 13
wp      : yes
flags       : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm constant_tsc rep_good nopl nonstop_tsc extd_apicid aperfmperf pni pclmulqdq monitor ssse3 cx16 sse4_1 sse4_2 popcnt aes xsave avx lahf_lm cmp_legacy svm extapic cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw ibs xop skinit wdt lwp fma4 nodeid_msr topoext perfctr_core perfctr_nb cpb hw_pstate vmmcall arat npt lbrv svm_lock nrip_save tsc_scale vmcb_clean flushbyasid decodeassists pausefilter pfthreshold
bugs        : fxsave_leak sysret_ss_attrs null_seg
bogomips    : 6624.13
TLB size    : 1536 4K pages
clflush size    : 64
cache_alignment : 64
address sizes   : 48 bits physical, 48 bits virtual
power management: ts ttp tm 100mhzsteps hwpstate cpb

processor   : 3
vendor_id   : AuthenticAMD
cpu family  : 21
model       : 1
model name  : AMD FX(tm)-6100 Six-Core Processor
stepping    : 2
microcode   : 0x600063d
cpu MHz     : 3311.103
cache size  : 2048 KB
physical id : 0
siblings    : 6
core id     : 1
cpu cores   : 3
apicid      : 17
initial apicid  : 1
fpu     : yes
fpu_exception   : yes
cpuid level : 13
wp      : yes
flags       : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm constant_tsc rep_good nopl nonstop_tsc extd_apicid aperfmperf pni pclmulqdq monitor ssse3 cx16 sse4_1 sse4_2 popcnt aes xsave avx lahf_lm cmp_legacy svm extapic cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw ibs xop skinit wdt lwp fma4 nodeid_msr topoext perfctr_core perfctr_nb cpb hw_pstate vmmcall arat npt lbrv svm_lock nrip_save tsc_scale vmcb_clean flushbyasid decodeassists pausefilter pfthreshold
bugs        : fxsave_leak sysret_ss_attrs null_seg
bogomips    : 6623.14
TLB size    : 1536 4K pages
clflush size    : 64
cache_alignment : 64
address sizes   : 48 bits physical, 48 bits virtual
power management: ts ttp tm 100mhzsteps hwpstate cpb

processor   : 4
vendor_id   : AuthenticAMD
cpu family  : 21
model       : 1
model name  : AMD FX(tm)-6100 Six-Core Processor
stepping    : 2
microcode   : 0x600063d
cpu MHz     : 3311.103
cache size  : 2048 KB
physical id : 0
siblings    : 6
core id     : 2
cpu cores   : 3
apicid      : 18
initial apicid  : 2
fpu     : yes
fpu_exception   : yes
cpuid level : 13
wp      : yes
flags       : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm constant_tsc rep_good nopl nonstop_tsc extd_apicid aperfmperf pni pclmulqdq monitor ssse3 cx16 sse4_1 sse4_2 popcnt aes xsave avx lahf_lm cmp_legacy svm extapic cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw ibs xop skinit wdt lwp fma4 nodeid_msr topoext perfctr_core perfctr_nb cpb hw_pstate vmmcall arat npt lbrv svm_lock nrip_save tsc_scale vmcb_clean flushbyasid decodeassists pausefilter pfthreshold
bugs        : fxsave_leak sysret_ss_attrs null_seg
bogomips    : 6623.22
TLB size    : 1536 4K pages
clflush size    : 64
cache_alignment : 64
address sizes   : 48 bits physical, 48 bits virtual
power management: ts ttp tm 100mhzsteps hwpstate cpb

processor   : 5
vendor_id   : AuthenticAMD
cpu family  : 21
model       : 1
model name  : AMD FX(tm)-6100 Six-Core Processor
stepping    : 2
microcode   : 0x600063d
cpu MHz     : 3311.103
cache size  : 2048 KB
physical id : 0
siblings    : 6
core id     : 3
cpu cores   : 3
apicid      : 19
initial apicid  : 3
fpu     : yes
fpu_exception   : yes
cpuid level : 13
wp      : yes
flags       : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm constant_tsc rep_good nopl nonstop_tsc extd_apicid aperfmperf pni pclmulqdq monitor ssse3 cx16 sse4_1 sse4_2 popcnt aes xsave avx lahf_lm cmp_legacy svm extapic cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw ibs xop skinit wdt lwp fma4 nodeid_msr topoext perfctr_core perfctr_nb cpb hw_pstate vmmcall arat npt lbrv svm_lock nrip_save tsc_scale vmcb_clean flushbyasid decodeassists pausefilter pfthreshold
bugs        : fxsave_leak sysret_ss_attrs null_seg
bogomips    : 6623.22
TLB size    : 1536 4K pages
clflush size    : 64
cache_alignment : 64
address sizes   : 48 bits physical, 48 bits virtual
power management: ts ttp tm 100mhzsteps hwpstate cpb

processor   : 6
vendor_id   : AuthenticAMD
cpu family  : 21
model       : 1
model name  : AMD FX(tm)-6100 Six-Core Processor
stepping    : 2
microcode   : 0x600063d
cpu MHz     : 3311.103
cache size  : 2048 KB
physical id : 0
siblings    : 6
core id     : 4
cpu cores   : 3
apicid      : 20
initial apicid  : 4
fpu     : yes
fpu_exception   : yes
cpuid level : 13
wp      : yes
flags       : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm constant_tsc rep_good nopl nonstop_tsc extd_apicid aperfmperf pni pclmulqdq monitor ssse3 cx16 sse4_1 sse4_2 popcnt aes xsave avx lahf_lm cmp_legacy svm extapic cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw ibs xop skinit wdt lwp fma4 nodeid_msr topoext perfctr_core perfctr_nb cpb hw_pstate vmmcall arat npt lbrv svm_lock nrip_save tsc_scale vmcb_clean flushbyasid decodeassists pausefilter pfthreshold
bugs        : fxsave_leak sysret_ss_attrs null_seg
bogomips    : 6623.23
TLB size    : 1536 4K pages
clflush size    : 64
cache_alignment : 64
address sizes   : 48 bits physical, 48 bits virtual
power management: ts ttp tm 100mhzsteps hwpstate cpb

processor   : 7
vendor_id   : AuthenticAMD
cpu family  : 21
model       : 1
model name  : AMD FX(tm)-6100 Six-Core Processor
stepping    : 2
microcode   : 0x600063d
cpu MHz     : 3311.103
cache size  : 2048 KB
physical id : 0
siblings    : 6
core id     : 5
cpu cores   : 3
apicid      : 21
initial apicid  : 5
fpu     : yes
fpu_exception   : yes
cpuid level : 13
wp      : yes
flags       : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm constant_tsc rep_good nopl nonstop_tsc extd_apicid aperfmperf pni pclmulqdq monitor ssse3 cx16 sse4_1 sse4_2 popcnt aes xsave avx lahf_lm cmp_legacy svm extapic cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw ibs xop skinit wdt lwp fma4 nodeid_msr topoext perfctr_core perfctr_nb cpb hw_pstate vmmcall arat npt lbrv svm_lock nrip_save tsc_scale vmcb_clean flushbyasid decodeassists pausefilter pfthreshold
bugs        : fxsave_leak sysret_ss_attrs null_seg
bogomips    : 6623.22
TLB size    : 1536 4K pages
clflush size    : 64
cache_alignment : 64
address sizes   : 48 bits physical, 48 bits virtual
power management: ts ttp tm 100mhzsteps hwpstate cpb

lscpu:

[gilmoreja@JamesPC ~]$ lscpu
Architecture:          x86_64
CPU op-mode(s):        32-bit, 64-bit
Byte Order:            Little Endian
CPU(s):                6
On-line CPU(s) list:   0,3-7
Thread(s) per core:    2
Core(s) per socket:    3
Socket(s):             1
NUMA node(s):          1
Vendor ID:             AuthenticAMD
CPU family:            21
Model:                 1
Model name:            AMD FX(tm)-6100 Six-Core Processor
Stepping:              2
CPU MHz:               3311.103
BogoMIPS:              6624.13
Virtualization:        AMD-V
L1d cache:             16K
L1i cache:             64K
L2 cache:              2048K
L3 cache:              8192K
NUMA node0 CPU(s):     0,3-7
Flags:                 fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm constant_tsc rep_good nopl nonstop_tsc extd_apicid aperfmperf pni pclmulqdq monitor ssse3 cx16 sse4_1 sse4_2 popcnt aes xsave avx lahf_lm cmp_legacy svm extapic cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw ibs xop skinit wdt lwp fma4 nodeid_msr topoext perfctr_core perfctr_nb cpb hw_pstate vmmcall arat npt lbrv svm_lock nrip_save tsc_scale vmcb_clean flushbyasid decodeassists pausefilter pfthreshold

My CPUs are not listed sequentially, and instead they're numbered 0, 3, 4, 5, 6, and 7.

Why aren't my CPUs numbered sequentially? How can I fix it so they are?

Best Answer

The Linux kernel assigns a CPU number for each CPU listed in the machine's APIC table (see commands for dumping CPU table). The table contains an "enabled" bit for each core. The FX-6100 is actually manufactured as an 8-core processor but 2 cores are disabled by AMD - Tomshardware says "All seven of the Zambezi-based FX processors employ the same silicon. Some of the processors have one Bulldozer module disabled, and some have two turned off." This is probably done when one core fails QA - the 8 core processor can have some cores disabled and still be sold as a lower spec part.

Two cores being disabled would match your description that cores "0, 3, 4, 5, 6, and 7" are functional - cores 1 and 2 would be present but disabled in the APIC table. I don't have an FX-6100 to dump the table and check this for sure, but it seems a likely explanation.

Related Question