Hello! I have a machine with 2 processors, 4 cores on each (cat cpuinfo in the attachment). I see that kind of output: tbuchert@griffon-6:~$ ./cpufreq-info | grep "run at" CPUs which run at the same hardware frequency: 0 1 CPUs which run at the same hardware frequency: 0 1 CPUs which run at the same hardware frequency: 2 3 CPUs which run at the same hardware frequency: 2 3 CPUs which run at the same hardware frequency: 4 5 CPUs which run at the same hardware frequency: 4 5 CPUs which run at the same hardware frequency: 6 7 CPUs which run at the same hardware frequency: 6 7 Ok. This makes sense. So far so good. So I change the frequency of the first processor and check the speeds: tbuchert@griffon-6:~$ sudo cpufreq-set -f 2000000 -c 0 tbuchert@griffon-6:~$ sudo cpufreq-info | grep "current CPU" current CPU frequency is 2.50 GHz (asserted by call to hardware). current CPU frequency is 2.50 GHz (asserted by call to hardware). current CPU frequency is 2.50 GHz (asserted by call to hardware). current CPU frequency is 2.50 GHz (asserted by call to hardware). current CPU frequency is 2.50 GHz (asserted by call to hardware). current CPU frequency is 2.50 GHz (asserted by call to hardware). current CPU frequency is 2.50 GHz (asserted by call to hardware). current CPU frequency is 2.50 GHz (asserted by call to hardware). As expected. So let's also change the speed of the second core. tbuchert@griffon-6:~$ sudo cpufreq-set -f 2000000 -c 1 tbuchert@griffon-6:~$ sudo cpufreq-info | grep "current CPU" current CPU frequency is 2.50 GHz (asserted by call to hardware). current CPU frequency is 2.50 GHz (asserted by call to hardware). current CPU frequency is 2.50 GHz (asserted by call to hardware). current CPU frequency is 2.50 GHz (asserted by call to hardware). current CPU frequency is 2.50 GHz (asserted by call to hardware). current CPU frequency is 2.50 GHz (asserted by call to hardware). current CPU frequency is 2.50 GHz (asserted by call to hardware). current CPU frequency is 2.50 GHz (asserted by call to hardware). Nothing happened. Let's do some "lucky-guessing": tbuchert@griffon-6:~/local/cpufrequtils$ sudo ./cpufreq-set -f 2500000 -c 1 tbuchert@griffon-6:~/local/cpufrequtils$ sudo ./cpufreq-set -f 2000000 -c 2 tbuchert@griffon-6:~/local/cpufrequtils$ sudo cpufreq-info | grep "current CPU" current CPU frequency is 2.00 GHz (asserted by call to hardware). current CPU frequency is 2.50 GHz (asserted by call to hardware). current CPU frequency is 2.00 GHz (asserted by call to hardware). current CPU frequency is 2.50 GHz (asserted by call to hardware). current CPU frequency is 2.50 GHz (asserted by call to hardware). current CPU frequency is 2.50 GHz (asserted by call to hardware). current CPU frequency is 2.50 GHz (asserted by call to hardware). current CPU frequency is 2.50 GHz (asserted by call to hardware). Ok. Now it changed. Why? Let's take a look at the output of lstopo utility from hwloc library and related sysfs file: tbuchert@griffon-6:~/local/hwloc-1.0.2$ utils/lstopo Machine (16GB) Socket #0 L2 #0 (6144KB) L1 #0 (32KB) + Core #0 + PU #0 (phys=0) L1 #1 (32KB) + Core #1 + PU #1 (phys=2) L2 #1 (6144KB) L1 #2 (32KB) + Core #2 + PU #2 (phys=4) L1 #3 (32KB) + Core #3 + PU #3 (phys=6) Socket #1 L2 #2 (6144KB) L1 #4 (32KB) + Core #4 + PU #4 (phys=1) L1 #5 (32KB) + Core #5 + PU #5 (phys=3) L2 #3 (6144KB) L1 #6 (32KB) + Core #6 + PU #6 (phys=5) L1 #7 (32KB) + Core #7 + PU #7 (phys=7) tbuchert@griffon-6:~$ cat /sys/devices/system/cpu/cpu0/cache/index2/shared_cpu_list 0,2 It looks that cores 0 and 1 are in different sockets. Cores 0 and 2 share the same L2 cache and therefore it seems more reasonable that they have to be in-sync. What is true then? Is kernel wrong or exposes inconsistent numbering of cores? Am I missing something? Best regards! Tomasz Buchert
processor : 0 vendor_id : GenuineIntel cpu family : 6 model : 23 model name : Intel(R) Xeon(R) CPU L5420 @ 2.50GHz stepping : 10 cpu MHz : 2000.000 cache size : 6144 KB physical id : 0 siblings : 4 core id : 0 cpu cores : 4 apicid : 0 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 dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx lm constant_tsc arch_perfmon pebs bts rep_good aperfmperf pni dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm dca sse4_1 xsave lahf_lm tpr_shadow vnmi flexpriority bogomips : 4988.15 clflush size : 64 cache_alignment : 64 address sizes : 38 bits physical, 48 bits virtual power management: processor : 1 vendor_id : GenuineIntel cpu family : 6 model : 23 model name : Intel(R) Xeon(R) CPU L5420 @ 2.50GHz stepping : 10 cpu MHz : 2000.000 cache size : 6144 KB physical id : 1 siblings : 4 core id : 0 cpu cores : 4 apicid : 4 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 dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx lm constant_tsc arch_perfmon pebs bts rep_good aperfmperf pni dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm dca sse4_1 xsave lahf_lm tpr_shadow vnmi flexpriority bogomips : 4987.90 clflush size : 64 cache_alignment : 64 address sizes : 38 bits physical, 48 bits virtual power management: processor : 2 vendor_id : GenuineIntel cpu family : 6 model : 23 model name : Intel(R) Xeon(R) CPU L5420 @ 2.50GHz stepping : 10 cpu MHz : 2000.000 cache size : 6144 KB physical id : 0 siblings : 4 core id : 1 cpu cores : 4 apicid : 1 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 dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx lm constant_tsc arch_perfmon pebs bts rep_good aperfmperf pni dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm dca sse4_1 xsave lahf_lm tpr_shadow vnmi flexpriority bogomips : 4987.91 clflush size : 64 cache_alignment : 64 address sizes : 38 bits physical, 48 bits virtual power management: processor : 3 vendor_id : GenuineIntel cpu family : 6 model : 23 model name : Intel(R) Xeon(R) CPU L5420 @ 2.50GHz stepping : 10 cpu MHz : 2000.000 cache size : 6144 KB physical id : 1 siblings : 4 core id : 1 cpu cores : 4 apicid : 5 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 dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx lm constant_tsc arch_perfmon pebs bts rep_good aperfmperf pni dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm dca sse4_1 xsave lahf_lm tpr_shadow vnmi flexpriority bogomips : 4987.91 clflush size : 64 cache_alignment : 64 address sizes : 38 bits physical, 48 bits virtual power management: processor : 4 vendor_id : GenuineIntel cpu family : 6 model : 23 model name : Intel(R) Xeon(R) CPU L5420 @ 2.50GHz stepping : 10 cpu MHz : 2500.000 cache size : 6144 KB physical id : 0 siblings : 4 core id : 2 cpu cores : 4 apicid : 2 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 dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx lm constant_tsc arch_perfmon pebs bts rep_good aperfmperf pni dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm dca sse4_1 xsave lahf_lm tpr_shadow vnmi flexpriority bogomips : 4987.89 clflush size : 64 cache_alignment : 64 address sizes : 38 bits physical, 48 bits virtual power management: processor : 5 vendor_id : GenuineIntel cpu family : 6 model : 23 model name : Intel(R) Xeon(R) CPU L5420 @ 2.50GHz stepping : 10 cpu MHz : 2500.000 cache size : 6144 KB physical id : 1 siblings : 4 core id : 2 cpu cores : 4 apicid : 6 initial apicid : 6 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 dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx lm constant_tsc arch_perfmon pebs bts rep_good aperfmperf pni dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm dca sse4_1 xsave lahf_lm tpr_shadow vnmi flexpriority bogomips : 4987.82 clflush size : 64 cache_alignment : 64 address sizes : 38 bits physical, 48 bits virtual power management: processor : 6 vendor_id : GenuineIntel cpu family : 6 model : 23 model name : Intel(R) Xeon(R) CPU L5420 @ 2.50GHz stepping : 10 cpu MHz : 2500.000 cache size : 6144 KB physical id : 0 siblings : 4 core id : 3 cpu cores : 4 apicid : 3 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 dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx lm constant_tsc arch_perfmon pebs bts rep_good aperfmperf pni dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm dca sse4_1 xsave lahf_lm tpr_shadow vnmi flexpriority bogomips : 4987.91 clflush size : 64 cache_alignment : 64 address sizes : 38 bits physical, 48 bits virtual power management: processor : 7 vendor_id : GenuineIntel cpu family : 6 model : 23 model name : Intel(R) Xeon(R) CPU L5420 @ 2.50GHz stepping : 10 cpu MHz : 2500.000 cache size : 6144 KB physical id : 1 siblings : 4 core id : 3 cpu cores : 4 apicid : 7 initial apicid : 7 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 dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx lm constant_tsc arch_perfmon pebs bts rep_good aperfmperf pni dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm dca sse4_1 xsave lahf_lm tpr_shadow vnmi flexpriority bogomips : 4987.31 clflush size : 64 cache_alignment : 64 address sizes : 38 bits physical, 48 bits virtual power management:
cpufrequtils 004: cpufreq-info (C) Dominik Brodowski 2004-2006 Report errors and bugs to cpufreq@xxxxxxxxxxxxxxxxxx, please. analyzing CPU 0: driver: acpi-cpufreq CPUs which need to switch frequency at the same time: 0 hardware limits: 2.00 GHz - 2.50 GHz available frequency steps: 2.50 GHz, 2.00 GHz available cpufreq governors: userspace, powersave, conservative, ondemand, performance current policy: frequency should be within 2.00 GHz and 2.50 GHz. The governor "userspace" may decide which speed to use within this range. current CPU frequency is 2.50 GHz (asserted by call to hardware). cpufreq stats: 2.50 GHz:42.66%, 2.00 GHz:57.34% (12) analyzing CPU 1: driver: acpi-cpufreq CPUs which need to switch frequency at the same time: 1 hardware limits: 2.00 GHz - 2.50 GHz available frequency steps: 2.50 GHz, 2.00 GHz available cpufreq governors: userspace, powersave, conservative, ondemand, performance current policy: frequency should be within 2.00 GHz and 2.50 GHz. The governor "userspace" may decide which speed to use within this range. current CPU frequency is 2.50 GHz (asserted by call to hardware). cpufreq stats: 2.50 GHz:85.76%, 2.00 GHz:14.24% (12) analyzing CPU 2: driver: acpi-cpufreq CPUs which need to switch frequency at the same time: 2 hardware limits: 2.00 GHz - 2.50 GHz available frequency steps: 2.50 GHz, 2.00 GHz available cpufreq governors: userspace, powersave, conservative, ondemand, performance current policy: frequency should be within 2.00 GHz and 2.50 GHz. The governor "userspace" may decide which speed to use within this range. current CPU frequency is 2.50 GHz (asserted by call to hardware). cpufreq stats: 2.50 GHz:73.38%, 2.00 GHz:26.62% (14) analyzing CPU 3: driver: acpi-cpufreq CPUs which need to switch frequency at the same time: 3 hardware limits: 2.00 GHz - 2.50 GHz available frequency steps: 2.50 GHz, 2.00 GHz available cpufreq governors: userspace, powersave, conservative, ondemand, performance current policy: frequency should be within 2.00 GHz and 2.50 GHz. The governor "userspace" may decide which speed to use within this range. current CPU frequency is 2.50 GHz (asserted by call to hardware). cpufreq stats: 2.50 GHz:85.90%, 2.00 GHz:14.10% (12) analyzing CPU 4: driver: acpi-cpufreq CPUs which need to switch frequency at the same time: 4 hardware limits: 2.00 GHz - 2.50 GHz available frequency steps: 2.50 GHz, 2.00 GHz available cpufreq governors: userspace, powersave, conservative, ondemand, performance current policy: frequency should be within 2.00 GHz and 2.50 GHz. The governor "userspace" may decide which speed to use within this range. current CPU frequency is 2.50 GHz (asserted by call to hardware). cpufreq stats: 2.50 GHz:91.63%, 2.00 GHz:8.37% (8) analyzing CPU 5: driver: acpi-cpufreq CPUs which need to switch frequency at the same time: 5 hardware limits: 2.00 GHz - 2.50 GHz available frequency steps: 2.50 GHz, 2.00 GHz available cpufreq governors: userspace, powersave, conservative, ondemand, performance current policy: frequency should be within 2.00 GHz and 2.50 GHz. The governor "userspace" may decide which speed to use within this range. current CPU frequency is 2.50 GHz (asserted by call to hardware). cpufreq stats: 2.50 GHz:91.63%, 2.00 GHz:8.37% (8) analyzing CPU 6: driver: acpi-cpufreq CPUs which need to switch frequency at the same time: 6 hardware limits: 2.00 GHz - 2.50 GHz available frequency steps: 2.50 GHz, 2.00 GHz available cpufreq governors: userspace, powersave, conservative, ondemand, performance current policy: frequency should be within 2.00 GHz and 2.50 GHz. The governor "userspace" may decide which speed to use within this range. current CPU frequency is 2.50 GHz (asserted by call to hardware). cpufreq stats: 2.50 GHz:89.32%, 2.00 GHz:10.68% (10) analyzing CPU 7: driver: acpi-cpufreq CPUs which need to switch frequency at the same time: 7 hardware limits: 2.00 GHz - 2.50 GHz available frequency steps: 2.50 GHz, 2.00 GHz available cpufreq governors: userspace, powersave, conservative, ondemand, performance current policy: frequency should be within 2.00 GHz and 2.50 GHz. The governor "userspace" may decide which speed to use within this range. current CPU frequency is 2.50 GHz (asserted by call to hardware). cpufreq stats: 2.50 GHz:88.55%, 2.00 GHz:11.45% (10)