summaryrefslogtreecommitdiff
path: root/tools/power/cpupower/utils/helpers/helpers.h
diff options
context:
space:
mode:
authorBrahadambal Srinivasan <latha@linux.vnet.ibm.com>2020-10-23 20:55:27 +0530
committerShuah Khan <skhan@linuxfoundation.org>2020-10-26 13:36:24 -0600
commit748f0d70087c56226bf1df1f91a00b7ab4c8f883 (patch)
tree8b9c94c478ebd88016e402cadb505a14fa9ca77d /tools/power/cpupower/utils/helpers/helpers.h
parent3650b228f83adda7e5ee532e2b90429c03f7b9ec (diff)
downloadlwn-748f0d70087c56226bf1df1f91a00b7ab4c8f883.tar.gz
lwn-748f0d70087c56226bf1df1f91a00b7ab4c8f883.zip
cpupower: Provide online and offline CPU information
When a user tries to modify cpuidle or cpufreq properties on offline CPUs, the tool returns success (exit status 0) but also does not provide any warning message regarding offline cpus that may have been specified but left unchanged. In case of all or a few CPUs being offline, it can be difficult to keep track of which CPUs didn't get the new frequency or idle state set. Silent failures are difficult to keep track of when there are a huge number of CPUs on which the action is performed. This patch adds helper functions to find both online and offline CPUs and print them out accordingly. We use these helper functions in cpuidle-set and cpufreq-set to print an additional message if the user attempts to modify offline cpus. Reported-by: Pavithra R. Prakash <pavrampu@in.ibm.com> Signed-off-by: Brahadambal Srinivasan <latha@linux.vnet.ibm.com> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
Diffstat (limited to 'tools/power/cpupower/utils/helpers/helpers.h')
-rw-r--r--tools/power/cpupower/utils/helpers/helpers.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/tools/power/cpupower/utils/helpers/helpers.h b/tools/power/cpupower/utils/helpers/helpers.h
index c258eeccd05f..d5799aa71e1f 100644
--- a/tools/power/cpupower/utils/helpers/helpers.h
+++ b/tools/power/cpupower/utils/helpers/helpers.h
@@ -94,6 +94,8 @@ struct cpupower_cpu_info {
*/
extern int get_cpu_info(struct cpupower_cpu_info *cpu_info);
extern struct cpupower_cpu_info cpupower_cpu_info;
+
+
/* cpuid and cpuinfo helpers **************************/
/* X86 ONLY ****************************************/
@@ -171,4 +173,14 @@ static inline unsigned int cpuid_ecx(unsigned int op) { return 0; };
static inline unsigned int cpuid_edx(unsigned int op) { return 0; };
#endif /* defined(__i386__) || defined(__x86_64__) */
+/*
+ * CPU State related functions
+ */
+extern struct bitmask *online_cpus;
+extern struct bitmask *offline_cpus;
+
+void get_cpustate(void);
+void print_online_cpus(void);
+void print_offline_cpus(void);
+
#endif /* __CPUPOWERUTILS_HELPERS__ */