summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorPatryk Wlazlyn <patryk.wlazlyn@linux.intel.com>2024-05-09 13:39:47 +0300
committerLen Brown <len.brown@intel.com>2024-05-16 04:50:16 +0300
commit29fea61cd8d4d0e646022c0479aa35381cf1e990 (patch)
tree7c226c4ab6e0c5443aa54db940ac342fd610c5f3 /tools
parent4e7ee02300805d26d9731fd24c4de8e10a43ffea (diff)
downloadlinux-29fea61cd8d4d0e646022c0479aa35381cf1e990.tar.xz
tools/power turbostat: Ignore pkg_cstate_limit when it is not available
When running in no-msr mode, the pkg_cstate_limit is not populated, thus we use perf to determine if given pcstate counter is present on the platform. Signed-off-by: Patryk Wlazlyn <patryk.wlazlyn@linux.intel.com> Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/power/x86/turbostat/turbostat.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/tools/power/x86/turbostat/turbostat.c b/tools/power/x86/turbostat/turbostat.c
index b45b2f494416..8cb18d42c189 100644
--- a/tools/power/x86/turbostat/turbostat.c
+++ b/tools/power/x86/turbostat/turbostat.c
@@ -7121,9 +7121,7 @@ void cstate_perf_init_(bool soft_c1)
const bool counter_needed = BIC_IS_ENABLED(cai->bic) ||
(soft_c1 && (cai->flags & CSTATE_COUNTER_FLAG_SOFT_C1_DEPENDENCY));
- const bool counter_supported =
- (platform->supported_cstates & cai->feature_mask) &&
- (pkg_cstate_limit >= cai->pkg_cstate_limit);
+ const bool counter_supported = (platform->supported_cstates & cai->feature_mask);
if (counter_needed && counter_supported) {
/* Use perf API for this counter */
@@ -7132,7 +7130,8 @@ void cstate_perf_init_(bool soft_c1)
cci->source[cai->rci_index] = CSTATE_SOURCE_PERF;
/* User MSR for this counter */
- } else if (!no_msr && cai->msr && probe_msr(cpu, cai->msr) == 0) {
+ } else if (!no_msr && cai->msr && pkg_cstate_limit >= cai->pkg_cstate_limit
+ && probe_msr(cpu, cai->msr) == 0) {
cci->source[cai->rci_index] = CSTATE_SOURCE_MSR;
cci->msr[cai->rci_index] = cai->msr;
}