
Linux-3.7 added CONFIG_BOOTPARAM_HOTPLUG_CPU0, allowing systems to offline cpu0. But when cpu0 is offline, cpupower monitor will not display all processor and Mperf information: [root@intel-skylake-dh-03 cpupower]# ./cpupower monitor WARNING: at least one cpu is offline |Idle_Stats CPU | POLL | C1-S | C1E- | C3-S | C6-S | C7s- | C8-S 4| 0.00| 0.00| 0.00| 0.00| 0.90| 0.00| 96.13 1| 0.00| 0.00| 5.49| 0.00| 0.01| 0.00| 92.26 5| 0.00| 0.00| 0.00| 0.00| 0.46| 0.00| 99.50 2| 45.42| 0.00| 0.00| 0.00| 22.94| 0.00| 28.84 6| 0.00| 37.54| 0.00| 0.00| 0.00| 0.00| 0.00 3| 0.00| 0.00| 0.00| 0.00| 0.30| 0.00| 91.99 7| 0.00| 0.00| 0.00| 0.00| 4.70| 0.00| 0.70 This patch replaces the hard-coded use of cpu0 in cpupower with the current cpu, allowing it to run without a cpu0. After the patch is applied, [root@intel-skylake-dh-03 cpupower]# ./cpupower monitor WARNING: at least one cpu is offline |Nehalem || Mperf || Idle_Stats CPU | C3 | C6 | PC3 | PC6 || C0 | Cx | Freq || POLL | C1-S | C1E- | C3-S | C6-S | C7s- | C8-S 4| 0.01| 1.27| 0.00| 0.00|| 0.04| 99.96| 3957|| 0.00| 0.00| 0.00| 0.00| 1.43| 0.00| 98.52 1| 0.00| 98.82| 0.00| 0.00|| 0.05| 99.95| 3361|| 0.00| 0.00| 0.01| 0.00| 0.03| 0.00| 99.88 5| 0.00| 98.82| 0.00| 0.00|| 0.09| 99.91| 3917|| 0.00| 0.00| 0.00| 0.00| 99.38| 0.00| 0.50 2| 0.33| 0.00| 0.00| 0.00|| 0.00|100.00| 3890|| 0.00| 0.00| 0.00| 0.00| 0.00| 0.00|100.00 6| 0.33| 0.00| 0.00| 0.00|| 0.01| 99.99| 3903|| 0.00| 0.00| 0.00| 0.00| 0.00| 0.00| 99.99 3| 0.01| 0.71| 0.00| 0.00|| 0.06| 99.94| 3678|| 0.00| 0.00| 0.00| 0.00| 0.80| 0.00| 99.13 7| 0.01| 0.71| 0.00| 0.00|| 0.03| 99.97| 3538|| 0.00| 0.69| 11.70| 0.00| 0.00| 0.00| 87.57 There are some minor cleanups included in this patch. Signed-off-by: Prarit Bhargava <prarit@redhat.com> Signed-off-by: Thomas Renninger <trenn@suse.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
43 lines
1014 B
C
43 lines
1014 B
C
#if defined(__i386__) || defined(__x86_64__)
|
|
|
|
#include "helpers/helpers.h"
|
|
|
|
#define MSR_AMD_HWCR 0xc0010015
|
|
|
|
int cpufreq_has_boost_support(unsigned int cpu, int *support, int *active,
|
|
int *states)
|
|
{
|
|
struct cpupower_cpu_info cpu_info;
|
|
int ret;
|
|
unsigned long long val;
|
|
|
|
*support = *active = *states = 0;
|
|
|
|
ret = get_cpu_info(&cpu_info);
|
|
if (ret)
|
|
return ret;
|
|
|
|
if (cpupower_cpu_info.caps & CPUPOWER_CAP_AMD_CBP) {
|
|
*support = 1;
|
|
|
|
/* AMD Family 0x17 does not utilize PCI D18F4 like prior
|
|
* families and has no fixed discrete boost states but
|
|
* has Hardware determined variable increments instead.
|
|
*/
|
|
|
|
if (cpu_info.family == 0x17) {
|
|
if (!read_msr(cpu, MSR_AMD_HWCR, &val)) {
|
|
if (!(val & CPUPOWER_AMD_CPBDIS))
|
|
*active = 1;
|
|
}
|
|
} else {
|
|
ret = amd_pci_get_num_boost_states(active, states);
|
|
if (ret)
|
|
return ret;
|
|
}
|
|
} else if (cpupower_cpu_info.caps & CPUPOWER_CAP_INTEL_IDA)
|
|
*support = *active = 1;
|
|
return 0;
|
|
}
|
|
#endif /* #if defined(__i386__) || defined(__x86_64__) */
|