From: Patryk Wlazlyn <patryk.wlazlyn@linux.intel.com>
To: len.brown@intel.com
Cc: linux-pm@vger.kernel.org
Subject: [PATCH 3/4] tools/power turbostat: Don't print invalid ucode revision
Date: Fri, 12 Jan 2024 13:48:14 +0100 [thread overview]
Message-ID: <20240112124815.970-4-patryk.wlazlyn@linux.intel.com> (raw)
In-Reply-To: <20240112124815.970-1-patryk.wlazlyn@linux.intel.com>
Earlier we printed "microcode 0x0" if we failed to obtain it via MSR.
Signed-off-by: Patryk Wlazlyn <patryk.wlazlyn@linux.intel.com>
Reviewed-by: Len Brown <len.brown@intel.com>
---
tools/power/x86/turbostat/turbostat.c | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/tools/power/x86/turbostat/turbostat.c b/tools/power/x86/turbostat/turbostat.c
index ba10a10c5144..bf733e7d73b5 100644
--- a/tools/power/x86/turbostat/turbostat.c
+++ b/tools/power/x86/turbostat/turbostat.c
@@ -5710,6 +5710,7 @@ void process_cpuid()
unsigned int eax, ebx, ecx, edx;
unsigned int fms, family, model, stepping, ecx_flags, edx_flags;
unsigned long long ucode_patch = 0;
+ bool ucode_patch_valid = false;
eax = ebx = ecx = edx = 0;
@@ -5740,6 +5741,8 @@ void process_cpuid()
if (!no_msr) {
if (get_msr(sched_getcpu(), MSR_IA32_UCODE_REV, &ucode_patch))
warnx("get_msr(UCODE)");
+ else
+ ucode_patch_valid = true;
}
/*
@@ -5751,9 +5754,12 @@ void process_cpuid()
__cpuid(0x80000000, max_extended_level, ebx, ecx, edx);
if (!quiet) {
- fprintf(outf, "CPUID(1): family:model:stepping 0x%x:%x:%x (%d:%d:%d) microcode 0x%x\n",
- family, model, stepping, family, model, stepping,
- (unsigned int)((ucode_patch >> 32) & 0xFFFFFFFF));
+ fprintf(outf, "CPUID(1): family:model:stepping 0x%x:%x:%x (%d:%d:%d)",
+ family, model, stepping, family, model, stepping);
+ if (ucode_patch_valid)
+ fprintf(outf, " microcode 0x%x", (unsigned int)((ucode_patch >> 32) & 0xFFFFFFFF));
+ fputc('\n', outf);
+
fprintf(outf, "CPUID(0x80000000): max_extended_levels: 0x%x\n", max_extended_level);
fprintf(outf, "CPUID(1): %s %s %s %s %s %s %s %s %s %s\n",
ecx_flags & (1 << 0) ? "SSE3" : "-",
--
2.43.0
next prev parent reply other threads:[~2024-01-12 12:49 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-12 12:48 [PATCH 0/4] turbostat msr, perf controls and aperf/mperf via perf Patryk Wlazlyn
2024-01-12 12:48 ` [PATCH 1/4] tools/power turbostat: Add --no-msr option Patryk Wlazlyn
2024-01-13 1:00 ` Len Brown
2024-01-15 12:58 ` Patryk Wlazlyn
2024-01-12 12:48 ` [PATCH 2/4] tools/power turbostat: Add --no-perf option Patryk Wlazlyn
2024-01-13 1:03 ` Len Brown
2024-01-12 12:48 ` Patryk Wlazlyn [this message]
2024-01-13 1:15 ` [PATCH 3/4] tools/power turbostat: Don't print invalid ucode revision Len Brown
2024-01-12 12:48 ` [PATCH 4/4] tools/power turbostat: Add reading aperf and mperf via perf API Patryk Wlazlyn
2024-01-13 1:42 ` Len Brown
2024-01-15 10:28 ` Patryk Wlazlyn
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=20240112124815.970-4-patryk.wlazlyn@linux.intel.com \
--to=patryk.wlazlyn@linux.intel.com \
--cc=len.brown@intel.com \
--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