summaryrefslogtreecommitdiffstats
path: root/tools/power
diff options
context:
space:
mode:
authorZhang Rui <rui.zhang@intel.com>2023-08-31 16:01:36 +0800
committerZhang Rui <rui.zhang@intel.com>2023-09-27 22:14:20 +0800
commite7d7b82de192464b733fb2bcc9e305ea6f6ea47e (patch)
treee66bc08b6a502b43a92ef51e3953e1d6bc760f7a /tools/power
parent2538d1673d02f66f6bdf01eebf36e271228778e9 (diff)
downloadlinux-e7d7b82de192464b733fb2bcc9e305ea6f6ea47e.tar.gz
linux-e7d7b82de192464b733fb2bcc9e305ea6f6ea47e.tar.bz2
linux-e7d7b82de192464b733fb2bcc9e305ea6f6ea47e.zip
tools/power/turbostat: Relocate lpi probing code
Introduce probe_lpi(), and move all lpi probing related code into it. Signed-off-by: Zhang Rui <rui.zhang@intel.com> Reviewed-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'tools/power')
-rw-r--r--tools/power/x86/turbostat/turbostat.c38
1 files changed, 22 insertions, 16 deletions
diff --git a/tools/power/x86/turbostat/turbostat.c b/tools/power/x86/turbostat/turbostat.c
index feff9ecff368..ad9147757d5a 100644
--- a/tools/power/x86/turbostat/turbostat.c
+++ b/tools/power/x86/turbostat/turbostat.c
@@ -5374,6 +5374,26 @@ void probe_cstates(void)
dump_sysfs_cstate_config();
}
+void probe_lpi(void)
+{
+ if (!access("/sys/devices/system/cpu/cpuidle/low_power_idle_cpu_residency_us", R_OK))
+ BIC_PRESENT(BIC_CPU_LPI);
+ else
+ BIC_NOT_PRESENT(BIC_CPU_LPI);
+
+ if (!access(sys_lpi_file_sysfs, R_OK)) {
+ sys_lpi_file = sys_lpi_file_sysfs;
+ BIC_PRESENT(BIC_SYS_LPI);
+ } else if (!access(sys_lpi_file_debugfs, R_OK)) {
+ sys_lpi_file = sys_lpi_file_debugfs;
+ BIC_PRESENT(BIC_SYS_LPI);
+ } else {
+ sys_lpi_file_sysfs = NULL;
+ BIC_NOT_PRESENT(BIC_SYS_LPI);
+ }
+
+}
+
void probe_pstates(void)
{
probe_bclk();
@@ -5570,6 +5590,8 @@ void process_cpuid()
probe_cstates();
+ probe_lpi();
+
probe_intel_uncore_frequency();
probe_graphics();
@@ -5579,27 +5601,11 @@ void process_cpuid()
if (platform->has_nhm_msrs)
BIC_PRESENT(BIC_SMI);
- if (!access("/sys/devices/system/cpu/cpuidle/low_power_idle_cpu_residency_us", R_OK))
- BIC_PRESENT(BIC_CPU_LPI);
- else
- BIC_NOT_PRESENT(BIC_CPU_LPI);
-
if (!access("/sys/devices/system/cpu/cpu0/thermal_throttle/core_throttle_count", R_OK))
BIC_PRESENT(BIC_CORE_THROT_CNT);
else
BIC_NOT_PRESENT(BIC_CORE_THROT_CNT);
- if (!access(sys_lpi_file_sysfs, R_OK)) {
- sys_lpi_file = sys_lpi_file_sysfs;
- BIC_PRESENT(BIC_SYS_LPI);
- } else if (!access(sys_lpi_file_debugfs, R_OK)) {
- sys_lpi_file = sys_lpi_file_debugfs;
- BIC_PRESENT(BIC_SYS_LPI);
- } else {
- sys_lpi_file_sysfs = NULL;
- BIC_NOT_PRESENT(BIC_SYS_LPI);
- }
-
if (!quiet)
decode_misc_feature_control();