]> www.infradead.org Git - users/jedix/linux-maple.git/commit
tools/power turbostat: Allow Zero return value for some RAPL registers
authorZhang Rui <rui.zhang@intel.com>
Sat, 8 Feb 2025 02:44:26 +0000 (10:44 +0800)
committerLen Brown <len.brown@intel.com>
Sun, 9 Feb 2025 03:10:20 +0000 (21:10 -0600)
commitb312d880fb462d4759396950865ec914de9d253c
treed05d507cd7a8a611e3e3aa7902ace255fa896d64
parent1c7c7388e6c31f46b26a884d80b45efbad8237b2
tools/power turbostat: Allow Zero return value for some RAPL registers

turbostat aborted with below messages on a dual-package system,

   turbostat: turbostat.c:3744: rapl_counter_accumulate: Assertion `dst->unit == src->unit' failed.
   Aborted

This is because
1. the MSR_DRAM_PERF_STATUS returns Zero for one package, and non-Zero
   for another package
2. probe_msr() treats Zero return value as a failure so this feature is
   enabled on one package, and disabled for another package.
3. turbostat aborts because the feature is invalid on some package

Unlike the RAPL energy counter registers, MSR_DRAM_PERF_STATUS can
return Zero value, and this should not be treated as a failure.

Fix the problem by allowing Zero return value for RAPL registers other
than the energy counters.

Fixes: 7c6fee25bdf5 ("tools/power turbostat: Check for non-zero value when MSR probing")
Reported-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
tools/power/x86/turbostat/turbostat.c