]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
tools/power turbostat: Fix --show/--hide for individual cpuidle counters
authorArtem Bityutskiy <artem.bityutskiy@linux.intel.com>
Wed, 11 Mar 2026 09:00:33 +0000 (11:00 +0200)
committerLen Brown <len.brown@intel.com>
Wed, 18 Mar 2026 03:39:42 +0000 (23:39 -0400)
commitb6398bc2ef3a78f1be37ba01ae0a5eedaee47803
tree48bc9b9cd802f74fc6cbd090765c2191b288bd9e
parent23cb4f5c81766e70e5f32ed0987ee8fb5ab2e00a
tools/power turbostat: Fix --show/--hide for individual cpuidle counters

Problem: individual swidle counter names (C1, C1+, C1-, etc.) cannot be
selected via --show/--hide due to two bugs in probe_cpuidle_counts():
1. The function returns immediately when BIC_cpuidle is not enabled,
   without checking deferred_add_index.
2. The deferred name check runs against name_buf before the trailing
   newline is stripped, so is_deferred_add("C1\n") never matches "C1".

Fix:
1. Relax the early return to pass through when deferred names are
   queued.
2. Strip the trailing newline from name_buf before performing deferred
   name checks.
3. Check each suffixed variant (C1+, C1, C1-) individually so that
   e.g. "--show C1+" enables only the requested metric.

In addition, introduce a helper function to avoid repeating the
condition (readability cleanup).

Fixes: ec4acd3166d8 ("tools/power turbostat: disable "cpuidle" invocation counters, by default")
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
tools/power/x86/turbostat/turbostat.c