Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

pm: cpupower: Fix printing of CORE, CPU fields in cpupower-monitor

After the commit 0014f65e3df0 ("pm: cpupower: remove hard-coded
topology depth values"), "cpupower monitor" output ceased to print the
CORE and the CPU fields on a multi-socket platform.

The reason for this is that the patch changed the behaviour to break
out of the switch-case after printing the PKG details, while prior to
the patch, the CORE and the CPU details would also get printed since
the "if" condition check would pass for any level whose topology depth
was lesser than that of a package.

Fix this ensuring all the details below a desired topology depth are
printed in the cpupower monitor output.

Link: https://lore.kernel.org/r/20250612122355.19629-3-gautham.shenoy@amd.com
Fixes: 0014f65e3df0 ("pm: cpupower: remove hard-coded topology depth values")
Signed-off-by: Gautham R. Shenoy <gautham.shenoy@amd.com>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>

authored by

Gautham R. Shenoy and committed by
Shuah Khan
14a3318b cda7ac8c

-4
-4
tools/power/cpupower/utils/idle_monitor/cpupower-monitor.c
··· 121 121 switch (topology_depth) { 122 122 case TOPOLOGY_DEPTH_PKG: 123 123 printf(" PKG|"); 124 - break; 125 124 case TOPOLOGY_DEPTH_CORE: 126 125 printf("CORE|"); 127 - break; 128 126 case TOPOLOGY_DEPTH_CPU: 129 127 printf(" CPU|"); 130 128 break; ··· 165 167 switch (topology_depth) { 166 168 case TOPOLOGY_DEPTH_PKG: 167 169 printf("%4d|", cpu_top.core_info[cpu].pkg); 168 - break; 169 170 case TOPOLOGY_DEPTH_CORE: 170 171 printf("%4d|", cpu_top.core_info[cpu].core); 171 - break; 172 172 case TOPOLOGY_DEPTH_CPU: 173 173 printf("%4d|", cpu_top.core_info[cpu].cpu); 174 174 break;