From 7fe2f6399a84760a9af8896ac152728250f82adb Mon Sep 17 00:00:00 2001 From: Dominik Brodowski Date: Wed, 30 Mar 2011 16:30:11 +0200 Subject: cpupowerutils - cpufrequtils extended with quite some features CPU power consumption vs performance tuning is no longer limited to CPU frequency switching anymore: deep sleep states, traditional dynamic frequency scaling and hidden turbo/boost frequencies are tied close together and depend on each other. The first two exist on different architectures like PPC, Itanium and ARM, the latter (so far) only on X86. On X86 the APU (CPU+GPU) will only run most efficiently if CPU and GPU has proper power management in place. Users and Developers want to have *one* tool to get an overview what their system supports and to monitor and debug CPU power management in detail. The tool should compile and work on as many architectures as possible. Once this tool stabilizes a bit, it is intended to replace the Intel-specific tools in tools/power/x86 Signed-off-by: Dominik Brodowski --- tools/power/cpupower/utils/helpers/misc.c | 34 +++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 tools/power/cpupower/utils/helpers/misc.c (limited to 'tools/power/cpupower/utils/helpers/misc.c') diff --git a/tools/power/cpupower/utils/helpers/misc.c b/tools/power/cpupower/utils/helpers/misc.c new file mode 100644 index 00000000000..c1566e93e0e --- /dev/null +++ b/tools/power/cpupower/utils/helpers/misc.c @@ -0,0 +1,34 @@ +#if defined(__i386__) || defined(__x86_64__) + +#include "helpers/helpers.h" + +int cpufreq_has_boost_support(unsigned int cpu, int *support, int *active, int * states) +{ + struct cpupower_cpu_info cpu_info; + int ret; + + *support = *active = *states = 0; + + ret = get_cpu_info(0, &cpu_info); + if (ret) + return ret; + + if (cpupower_cpu_info.caps & CPUPOWER_CAP_AMD_CBP) { + *support = 1; + amd_pci_get_num_boost_states(active, states); + if (ret <= 0) + return ret; + *support = 1; + } else if (cpupower_cpu_info.vendor == X86_VENDOR_INTEL) { + ret = msr_intel_has_boost_support(cpu); + if (ret <= 0) + return ret; + *support = ret; + ret = msr_intel_boost_is_active(cpu); + if (ret <= 0) + return ret; + *active = ret; + } + return 0; +} +#endif /* #if defined(__i386__) || defined(__x86_64__) */ -- cgit v1.2.3-18-g5258 From 2cd005cac6d586b8ca324814a9c58ed0c08ffe40 Mon Sep 17 00:00:00 2001 From: Dominik Brodowski Date: Tue, 19 Apr 2011 20:16:05 +0200 Subject: cpupowerutils: helpers - ConfigStyle bugfixes Signed-off-by: Dominik Brodowski --- tools/power/cpupower/utils/helpers/misc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'tools/power/cpupower/utils/helpers/misc.c') diff --git a/tools/power/cpupower/utils/helpers/misc.c b/tools/power/cpupower/utils/helpers/misc.c index c1566e93e0e..e8b3140cc6b 100644 --- a/tools/power/cpupower/utils/helpers/misc.c +++ b/tools/power/cpupower/utils/helpers/misc.c @@ -2,7 +2,8 @@ #include "helpers/helpers.h" -int cpufreq_has_boost_support(unsigned int cpu, int *support, int *active, int * states) +int cpufreq_has_boost_support(unsigned int cpu, int *support, int *active, + int *states) { struct cpupower_cpu_info cpu_info; int ret; -- cgit v1.2.3-18-g5258 From 029e9f73667f9b4661ac9886f706d75d26850260 Mon Sep 17 00:00:00 2001 From: Thomas Renninger Date: Thu, 21 Jul 2011 11:54:54 +0200 Subject: cpupower: Do detect IDA (opportunistic processor performance) via cpuid IA32-Intel Devel guide Volume 3A - 14.3.2.1 ------------------------------------------- ... Opportunistic processor performance operation can be disabled by setting bit 38 of IA32_MISC_ENABLES. This mechanism is intended for BIOS only. If IA32_MISC_ENABLES[38] is set, CPUID.06H:EAX[1] will return 0. Better detect things via cpuid, this cleans up the code a bit and the MSR parts were not working correctly anyway. Signed-off-by: Thomas Renninger CC: lenb@kernel.org CC: linux@dominikbrodowski.net CC: cpufreq@vger.kernel.org Signed-off-by: Dominik Brodowski --- tools/power/cpupower/utils/helpers/misc.c | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) (limited to 'tools/power/cpupower/utils/helpers/misc.c') diff --git a/tools/power/cpupower/utils/helpers/misc.c b/tools/power/cpupower/utils/helpers/misc.c index e8b3140cc6b..1609243f5c6 100644 --- a/tools/power/cpupower/utils/helpers/misc.c +++ b/tools/power/cpupower/utils/helpers/misc.c @@ -20,16 +20,8 @@ int cpufreq_has_boost_support(unsigned int cpu, int *support, int *active, if (ret <= 0) return ret; *support = 1; - } else if (cpupower_cpu_info.vendor == X86_VENDOR_INTEL) { - ret = msr_intel_has_boost_support(cpu); - if (ret <= 0) - return ret; - *support = ret; - ret = msr_intel_boost_is_active(cpu); - if (ret <= 0) - return ret; - *active = ret; - } + } else if (cpupower_cpu_info.caps & CPUPOWER_CAP_INTEL_IDA) + *support = *active = 1; return 0; } #endif /* #if defined(__i386__) || defined(__x86_64__) */ -- cgit v1.2.3-18-g5258