From: Len Brown <lenb@kernel.org>
To: linux-pm@vger.kernel.org
Cc: Patryk Wlazlyn <patryk.wlazlyn@linux.intel.com>,
Len Brown <len.brown@intel.com>
Subject: [PATCH 16/25] tools/power turbostat: Extend PMT identification with a sequence number
Date: Sun, 2 Feb 2025 11:09:32 -0600 [thread overview]
Message-ID: <089134cb0502ba962bce9402ce96e0875876d401.1738515889.git.len.brown@intel.com> (raw)
In-Reply-To: <e8a99af68c068865dbac7f3330e97bf8e96edf33.1738515889.git.len.brown@intel.com>
From: Patryk Wlazlyn <patryk.wlazlyn@linux.intel.com>
When platforms expose multiple PMT aggregators with the same GUID, the
only way to identify them and map to specific domain is by reading them
in an order they were exposed via PCIe. Intel PMT kernel driver does
keep the same order and numbers the telemetry directories accordingly.
Use GUID and sequence number (order) to uniquely identify PMT
aggregators.
Signed-off-by: Patryk Wlazlyn <patryk.wlazlyn@linux.intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
---
tools/power/x86/turbostat/turbostat.c | 27 +++++++++++++++++++--------
1 file changed, 19 insertions(+), 8 deletions(-)
diff --git a/tools/power/x86/turbostat/turbostat.c b/tools/power/x86/turbostat/turbostat.c
index 60b1ade8659b..14c495886746 100644
--- a/tools/power/x86/turbostat/turbostat.c
+++ b/tools/power/x86/turbostat/turbostat.c
@@ -1536,6 +1536,7 @@ static struct msr_counter_arch_info msr_counter_arch_infos[] = {
#define PMT_COUNTER_MTL_DC6_LSB 0
#define PMT_COUNTER_MTL_DC6_MSB 63
#define PMT_MTL_DC6_GUID 0x1a067102
+#define PMT_MTL_DC6_SEQ 0
#define PMT_COUNTER_NAME_SIZE_BYTES 16
#define PMT_COUNTER_TYPE_NAME_SIZE_BYTES 32
@@ -9083,7 +9084,7 @@ void *pmt_get_counter_pointer(struct pmt_mmio *pmmio, unsigned long counter_offs
return ret;
}
-struct pmt_mmio *pmt_add_guid(unsigned int guid)
+struct pmt_mmio *pmt_add_guid(unsigned int guid, unsigned int seq)
{
struct pmt_mmio *ret;
@@ -9091,6 +9092,11 @@ struct pmt_mmio *pmt_add_guid(unsigned int guid)
if (!ret)
ret = pmt_mmio_open(guid);
+ while (ret && seq) {
+ ret = ret->next;
+ --seq;
+ }
+
return ret;
}
@@ -9137,7 +9143,7 @@ void pmt_counter_add_domain(struct pmt_counter *pcounter, unsigned long *pmmio,
pcounter->domains[domain_id].pcounter = pmmio;
}
-int pmt_add_counter(unsigned int guid, const char *name, enum pmt_datatype type,
+int pmt_add_counter(unsigned int guid, unsigned int seq, const char *name, enum pmt_datatype type,
unsigned int lsb, unsigned int msb, unsigned int offset, enum counter_scope scope,
enum counter_format format, unsigned int domain_id, enum pmt_open_mode mode)
{
@@ -9157,10 +9163,10 @@ int pmt_add_counter(unsigned int guid, const char *name, enum pmt_datatype type,
exit(1);
}
- mmio = pmt_add_guid(guid);
+ mmio = pmt_add_guid(guid, seq);
if (!mmio) {
if (mode != PMT_OPEN_TRY) {
- fprintf(stderr, "%s: failed to map PMT MMIO for guid %x\n", __func__, guid);
+ fprintf(stderr, "%s: failed to map PMT MMIO for guid %x, seq %u\n", __func__, guid, seq);
exit(1);
}
@@ -9216,9 +9222,9 @@ int pmt_add_counter(unsigned int guid, const char *name, enum pmt_datatype type,
void pmt_init(void)
{
if (BIC_IS_ENABLED(BIC_Diec6)) {
- pmt_add_counter(PMT_MTL_DC6_GUID, "Die%c6", PMT_TYPE_XTAL_TIME, PMT_COUNTER_MTL_DC6_LSB,
- PMT_COUNTER_MTL_DC6_MSB, PMT_COUNTER_MTL_DC6_OFFSET, SCOPE_PACKAGE, FORMAT_DELTA,
- 0, PMT_OPEN_TRY);
+ pmt_add_counter(PMT_MTL_DC6_GUID, PMT_MTL_DC6_SEQ, "Die%c6", PMT_TYPE_XTAL_TIME,
+ PMT_COUNTER_MTL_DC6_LSB, PMT_COUNTER_MTL_DC6_MSB, PMT_COUNTER_MTL_DC6_OFFSET,
+ SCOPE_PACKAGE, FORMAT_DELTA, 0, PMT_OPEN_TRY);
}
}
@@ -9699,6 +9705,7 @@ void parse_add_command_pmt(char *add_command)
unsigned int lsb;
unsigned int msb;
unsigned int guid;
+ unsigned int seq = 0; /* By default, pick first file in a sequence with a given GUID. */
unsigned int domain_id;
enum counter_scope scope = 0;
enum pmt_datatype type = PMT_TYPE_RAW;
@@ -9778,6 +9785,10 @@ void parse_add_command_pmt(char *add_command)
goto next;
}
+ if (sscanf(add_command, "seq=%x", &seq) == 1) {
+ goto next;
+ }
+
next:
add_command = strchr(add_command, ',');
if (add_command) {
@@ -9864,7 +9875,7 @@ void parse_add_command_pmt(char *add_command)
exit(1);
}
- pmt_add_counter(guid, name, type, lsb, msb, offset, scope, format, domain_id, PMT_OPEN_REQUIRED);
+ pmt_add_counter(guid, seq, name, type, lsb, msb, offset, scope, format, domain_id, PMT_OPEN_REQUIRED);
}
void parse_add_command(char *add_command)
--
2.43.0
next prev parent reply other threads:[~2025-02-02 17:13 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-02 17:09 [PATCH 0/25] turbostat-2025.0202 for linux-6.14 Len Brown
2025-02-02 17:09 ` [PATCH 01/25] tools/power turbostat: Add initial support for PantherLake Len Brown
2025-02-02 17:09 ` [PATCH 02/25] tools/power turbostat: Add initial support for ClearwaterForest Len Brown
2025-02-02 17:09 ` [PATCH 03/25] tools/power turbostat: update turbostat(8) Len Brown
2025-02-02 17:09 ` [PATCH 04/25] tools/power turbostat: Exit on unsupported Intel models Len Brown
2025-02-02 17:09 ` [PATCH 05/25] tools/power turbostat: Exit on unsupported Vendors Len Brown
2025-02-02 17:09 ` [PATCH 06/25] tools/power turbostat: Improve --help output Len Brown
2025-02-02 17:09 ` [PATCH 07/25] tools/power turbostat: Introduce --force parameter Len Brown
2025-02-02 17:09 ` [PATCH 08/25] tools/power turbostat: add Busy% to "show idle" Len Brown
2025-02-02 17:09 ` [PATCH 09/25] tools/power turbostat: Add an NMI column Len Brown
2025-02-02 17:09 ` [PATCH 10/25] tools/power turbostat: Remove SysWatt from DISABLED_BY_DEFAULT Len Brown
2025-02-02 17:09 ` [PATCH 11/25] tools/power turbostat: Fix PMT mmaped file size rounding Len Brown
2025-02-02 17:09 ` [PATCH 12/25] tools/power turbostat: Add fixed RAPL PSYS divisor for SPR Len Brown
2025-02-02 17:09 ` [PATCH 13/25] tools/power turbostat: Enhance turbostat self-performance visibility Len Brown
2025-02-02 17:09 ` [PATCH 14/25] tools/power turbostat: Check for non-zero value when MSR probing Len Brown
2025-02-02 17:09 ` [PATCH 15/25] tools/power turbostat: Return default value for unmapped PMT domains Len Brown
2025-02-02 17:09 ` Len Brown [this message]
2025-02-02 17:09 ` [PATCH 17/25] tools/power turbostat: Add PMT directory iterator helper Len Brown
2025-02-02 17:09 ` [PATCH 18/25] tools/power turbostat: Allow mapping multiple PMT files with the same GUID Len Brown
2025-02-02 17:09 ` [PATCH 19/25] tools/power turbostat: Allow adding PMT counters directly by sysfs path Len Brown
2025-02-02 17:09 ` [PATCH 20/25] tools/power turbostat: version 2025.01.14 Len Brown
2025-02-02 17:09 ` [PATCH 21/25] tools/power turbostat: Add tcore clock PMT type Len Brown
2025-02-02 17:09 ` [PATCH 22/25] tools/power turbostat: Fix forked child affinity regression Len Brown
2025-02-02 17:09 ` [PATCH 23/25] tools/power turbostat: Harden one-shot mode against cpu offline Len Brown
2025-02-02 17:09 ` [PATCH 24/25] tools/power turbostat: Add CPU%c1e BIC for CWF Len Brown
2025-02-02 17:09 ` [PATCH 25/25] tools/power turbostat: version 2025.02.02 Len Brown
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=089134cb0502ba962bce9402ce96e0875876d401.1738515889.git.len.brown@intel.com \
--to=lenb@kernel.org \
--cc=len.brown@intel.com \
--cc=linux-pm@vger.kernel.org \
--cc=patryk.wlazlyn@linux.intel.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.