]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
tools/power turbostat: Clustered Uncore MHz counters should honor show/hide options
authorLen Brown <len.brown@intel.com>
Fri, 7 Feb 2025 03:46:24 +0000 (21:46 -0600)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 29 May 2025 09:13:36 +0000 (11:13 +0200)
[ Upstream commit 1c7c7388e6c31f46b26a884d80b45efbad8237b2 ]

The clustered uncore frequency counters, UMHz*.*
should honor the --show and --hide options.

All non-specified counters should be implicityly hidden.
But when --show was used, UMHz*.* showed up anyway:

$ sudo turbostat -q -S --show Busy%
Busy%  UMHz0.0  UMHz1.0  UMHz2.0  UMHz3.0  UMHz4.0

Indeed, there was no string that can be used to explicitly
show or hide clustered uncore counters.

Even through they are dynamically probed and added,
group the clustered UMHz*.* counters with the legacy
built-in-counter "UncMHz" for show/hide.

turbostat --show Busy%
does not show UMHz*.*.
turbostat --show UncMHz
shows either UncMHz or UMHz*.*, if present
turbostat --hide UncMHz
hides either UncMHz or UMHz*.*, if present

Reported-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
Tested-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
tools/power/x86/turbostat/turbostat.8
tools/power/x86/turbostat/turbostat.c

index e4f9f93c123a2b77908c5fe0005b0fa8ff2c153c..abee03ddc7f09cdfe47962e34cdad7e4933c878f 100644 (file)
@@ -201,6 +201,7 @@ The system configuration dump (if --quiet is not used) is followed by statistics
 \fBUncMHz\fP per-package uncore MHz, instantaneous sample.
 .PP
 \fBUMHz1.0\fP per-package uncore MHz for domain=1 and fabric_cluster=0, instantaneous sample.  System summary is the average of all packages.
+For the "--show" and "--hide" options, use "UncMHz" to operate on all UMHz*.* as a group.
 .SH TOO MUCH INFORMATION EXAMPLE
 By default, turbostat dumps all possible information -- a system configuration header, followed by columns for all counters.
 This is ideal for remote debugging, use the "--out" option to save everything to a text file, and get that file to the expert helping you debug.
index 4155d9bfcfc6da002b34f73d1483fcb849d7ffb1..505b07b5be19b2cda22ce2ee0add9e38f719d5d0 100644 (file)
@@ -6713,7 +6713,18 @@ static void probe_intel_uncore_frequency_cluster(void)
                sprintf(path, "%s/current_freq_khz", path_base);
                sprintf(name_buf, "UMHz%d.%d", domain_id, cluster_id);
 
-               add_counter(0, path, name_buf, 0, SCOPE_PACKAGE, COUNTER_K2M, FORMAT_AVERAGE, 0, package_id);
+               /*
+                * Once add_couter() is called, that counter is always read
+                * and reported -- So it is effectively (enabled & present).
+                * Only call add_counter() here if legacy BIC_UNCORE_MHZ (UncMHz)
+                * is (enabled).  Since we are in this routine, we
+                * know we will not probe and set (present) the legacy counter.
+                *
+                * This allows "--show/--hide UncMHz" to be effective for
+                * the clustered MHz counters, as a group.
+                */
+               if BIC_IS_ENABLED(BIC_UNCORE_MHZ)
+                       add_counter(0, path, name_buf, 0, SCOPE_PACKAGE, COUNTER_K2M, FORMAT_AVERAGE, 0, package_id);
 
                if (quiet)
                        continue;