mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Kurt Garloff <kurt@garloff.de>
To: Len Brown <len.brown@intel.com>, LKML <linux-kernel@vger.kernel.org>
Subject: turbostat: Fix Pkg Power on Zen
Date: Sat, 26 Dec 2020 13:13:49 +0100	[thread overview]
Message-ID: <1f1fb01e-0616-34ea-ede6-dc7dd679c3d4@garloff.de> (raw)

[-- Attachment #1: Type: text/plain, Size: 307 bytes --]

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 <kurt@garloff.de>
Cologne, Germany


[-- Attachment #2: turbostat-zen-pkgpower-510.diff --]
[-- Type: text/x-patch, Size: 1043 bytes --]

commit b82f8e4cfcfd5d503226ed99b30a68aca25b7e18
Author: Kurt Garloff <kurt@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 <kurt@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	other threads:[~2020-12-26 12:23 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-26 12:13 Kurt Garloff [this message]
2021-02-01  9:01 ` Kurt Garloff
2021-02-01  9:06   ` [PATCH 1/1]: " Kurt Garloff
2021-03-15 21:54   ` Christian Kastner
2021-03-24 12:37     ` Salvatore Bonaccorso
2021-03-24 14:39       ` Doug Smythies

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1f1fb01e-0616-34ea-ede6-dc7dd679c3d4@garloff.de \
    --to=kurt@garloff.de \
    --cc=len.brown@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®