Hi Len,

find attached fix to avoid exiting with -13 on Zen. Patch is against turbostat 
as included in Linux-5.10.2.
Please merge.

PS: This is probably material for -stable, as it used to work before on Zen 
(Zen2 aka Ryzen 3000 in my case).

-- 
Kurt Garloff <k...@garloff.de>
Cologne, Germany

commit b82f8e4cfcfd5d503226ed99b30a68aca25b7e18
Author: Kurt Garloff <k...@garloff.de>
Date:   Sat Dec 26 13:00:15 2020 +0100

    turbostat: Fix Pkg Power tracking on Zen
    
    AMD Zen processors use a different MSR (MSR_PKG_ENERGY_STAT) than intel
    (MSR_PKG_ENERGY_STATUS) to track package power; however we want to record
    it at the same offset in our package_data.
    offset_to_idx() however only recognized the intel MSR, erroring
    out with -13 on Zen.
    
    With this fix, it will support the Zen MSR.
    Tested successfully on Ryzen 3000.
    
    Signed-off-by: Kurt Garloff <k...@garloff.de>

diff --git a/tools/power/x86/turbostat/turbostat.c b/tools/power/x86/turbostat/turbostat.c
index f3a1746f7f45..eb845421f492 100644
--- a/tools/power/x86/turbostat/turbostat.c
+++ b/tools/power/x86/turbostat/turbostat.c
@@ -325,6 +325,7 @@ int offset_to_idx(int offset)
 	int idx;
 
 	switch (offset) {
+	case MSR_PKG_ENERGY_STAT:
 	case MSR_PKG_ENERGY_STATUS:
 		idx = IDX_PKG_ENERGY;
 		break;

Reply via email to