tools/power turbostat: fix offset and idx on Amd F17h and newer
PATCH 1/1 tools/power turbostat: fix offset and idx on Amd F17h and newer
Amd uses a different pkg energy msr, without this fix, turbostat exit immediately on Amd Epyc Cpu.
Fixes 3316f99a9f1 ("tools/power turbostat: Also read package power on AMD F17h (Zen)")
Signed-off-by Bingsong Si <[email protected]>
--- tools/power/x86/turbostat/turbostat.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
tools/power/x86/turbostat/turbostat.c +5 -1
@@ -297,7 +297,10 @@ int idx_to_offset(int idx)switch (idx) {case IDX_PKG_ENERGY : - offset =MSR_PKG_ENERGY_STATUS ; +if (do_rapl &RAPL_AMD_F17H ) + offset =MSR_PKG_ENERGY_STAT ; +else + offset =MSR_PKG_ENERGY_STATUS ;break ;case IDX_DRAM_ENERGY : offset =MSR_DRAM_ENERGY_STATUS ;
@@ -326,6 +329,7 @@ int offset_to_idx(int offset)switch (offset) {case MSR_PKG_ENERGY_STATUS : +case MSR_PKG_ENERGY_STAT : idx =IDX_PKG_ENERGY ;break ;case MSR_DRAM_ENERGY_STATUS :
Signature · 1 line
2.27.0