mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Erwan Velu <erwanaliasr1@gmail.com>
To: unlisted-recipients:; (no To-header on input)
Cc: Erwan Velu <e.velu@criteo.com>, Len Brown <lenb@kernel.org>,
	linux-pm@vger.kernel.org (open list:TURBOSTAT UTILITY),
	linux-kernel@vger.kernel.org (open list)
Subject: [PATCH] tools/power/x86/turbostat/turbostat: Report MSR_PLATFORM_INFO registers
Date: Mon,  2 Sep 2019 16:03:55 +0200	[thread overview]
Message-ID: <20190902140355.27891-1-e.velu@criteo.com> (raw)

This commit is about report all registers from MSR_PLATFORM_INFO.
This helps understand the actual state of the processor.

This patch also reports the min efficiency frequency.

Signed-off-by: Erwan Velu <e.velu@criteo.com>
---
 tools/power/x86/turbostat/turbostat.c | 42 +++++++++++++++++++++++++--
 1 file changed, 40 insertions(+), 2 deletions(-)

diff --git a/tools/power/x86/turbostat/turbostat.c b/tools/power/x86/turbostat/turbostat.c
index 75fc4fb9901c..5f5b3132bbea 100644
--- a/tools/power/x86/turbostat/turbostat.c
+++ b/tools/power/x86/turbostat/turbostat.c
@@ -2050,13 +2050,51 @@ dump_nhm_platform_info(void)
 	unsigned int ratio;
 
 	get_msr(base_cpu, MSR_PLATFORM_INFO, &msr);
+	fprintf(outf, "cpu%d: MSR_PLATFORM_INFO: 0x%08llx ", base_cpu, msr);
+	fprintf(outf, " (%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%sCONFIG-TDP-LEVELS:%llu%s%s%s%s%s)\n",
+		(msr & 1 << 0) ? "Bit0, " : "",
+		(msr & 1 << 1) ? "Bit1, " : "",
+		(msr & 1 << 2) ? "Bit2, " : "",
+		(msr & 1 << 3) ? "Bit3, " : "",
+		(msr & 1 << 4) ? "Bit4, " : "",
+		(msr & 1 << 5) ? "Bit5, " : "",
+		(msr & 1 << 6) ? "Bit6, " : "",
+		(msr & 1 << 7) ? "Bit7, " : "",
+		(msr & 1 << 16) ? "SMM-SAVE-CAP, " : "",
+		(msr & 1 << 17) ? "TAPUNLOCK, " : "",
+		(msr & 1 << 18) ? "Bit18, " : "",
+		(msr & 1 << 19) ? "Bit19, " : "",
+		(msr & 1 << 20) ? "Bit20, " : "",
+		(msr & 1 << 21) ? "Bit21, " : "",
+		(msr & 1 << 22) ? "Bit22, " : "",
+		(msr & 1 << 23) ? "PPIN-CAP, " : "",
+		(msr & 1 << 24) ? "OCVOLT-OVRD-AVAIL, " : "",
+		(msr & 1 << 25) ? "Bit25, " : "",
+		(msr & 1 << 26) ? "DCU_MODE_SELECT, " : "",
+		(msr & 1 << 27) ? "SAMPLE-PART, " : "",
+		(msr & 1 << 28) ? "PRG-TURBO-RATIO, " : "",
+		(msr & 1 << 29) ? "PRG-TDP-LIM, " : "",
+		(msr & 1 << 30) ? "PRG-TJ-OFFSET, " : "",
+		(msr & 1 << 31) ? "CPUID-FAULTING, " : "",
+		(msr & 1 << 32) ? "LOW-POWER-MODE-SUPPORT, " : "",
+		(msr >> 33) & 0x3,
+		(msr & 1 << 35) ? "PFAT, " : "",
+		(msr & 1 << 36) ? "Bit36, " : "",
+		(msr & 1 << 37) ? "TIMED_MWAIT, " : "",
+		(msr & 1 << 38) ? "Bit38, " : "",
+		(msr & 1 << 38) ? "Bit39, " : "");
+
+	// MIN_OPERATING_RATIO
+	ratio = (msr >> 48) & 0xFF;
+	fprintf(outf, "%d * %.1f = %.1f MHz min efficiency frequency\n",
+		ratio, bclk, ratio * bclk);
 
-	fprintf(outf, "cpu%d: MSR_PLATFORM_INFO: 0x%08llx\n", base_cpu, msr);
-
+	// MAX_EFFICIENCY_RATIO
 	ratio = (msr >> 40) & 0xFF;
 	fprintf(outf, "%d * %.1f = %.1f MHz max efficiency frequency\n",
 		ratio, bclk, ratio * bclk);
 
+	// MAX_NON_TURBO_LIMIT_RATION
 	ratio = (msr >> 8) & 0xFF;
 	fprintf(outf, "%d * %.1f = %.1f MHz base frequency\n",
 		ratio, bclk, ratio * bclk);
-- 
2.21.0


                 reply	other threads:[~2019-09-02 14:04 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20190902140355.27891-1-e.velu@criteo.com \
    --to=erwanaliasr1@gmail.com \
    --cc=e.velu@criteo.com \
    --cc=lenb@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@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®