Skip to content

Push 2026 09 07 - #1046

Merged
opcm merged 10 commits into
masterfrom
push-2026-09-07
Sep 7, 2026
Merged

Push 2026 09 07#1046
opcm merged 10 commits into
masterfrom
push-2026-09-07

Conversation

@rdementi

@rdementi rdementi commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

No description provided.

rdementi and others added 10 commits August 21, 2026 13:35
PCM_USE_TPMI_RAPL=1 makes PCM read the package (socket) energy through
the architectural RAPL TPMI interface instead of MSR_PKG_ENERGY_STATUS,
see RAPL_TPMI_public_disclosure_FINAL-rev3.pdf in
https://github.com/intel/tpmi_power_management

PCM::initPackageEnergyTPMI enumerates the RAPL domains (128 byte register
blocks) of every entry of every TPMI instance, selects the domains with
DOMAIN_HEADER.TYPE = package, maps the TPMI instances to sockets through
their NUMA node and derives the energy/power units and the package power
info from the POWER_UNIT and PL_INFO registers of the domain. It falls
back to the MSR-based counters if the package RAPL domain can not be
found on every socket.

TPMIHandle gets a getEntrySize() method to report the size of a TPMI
entry which is needed to enumerate the RAPL domains of an entry. Two
out-of-range accesses in the driver-based TPMI implementation (a
requested TPMI ID that the instance does not implement and an offset
outside of the entry) now throw instead of relying on an assert.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
PCM_USE_TPMI_RAPL=1 now additionally replaces MSR_DRAM_ENERGY_STATUS
with the ENERGY_STATUS register of the memory RAPL TPMI domain (domain
type 4). The energy unit of the DRAM domain is taken from the POWER_UNIT
register of that domain, so PCM::getDRAMJoulesPerEnergyUnit() is used
for the DRAM domain now (it returns the package energy unit as before
when no separate DRAM unit is known).

The domain discovery in PCM::initRAPLTPMI (renamed from
initPackageEnergyTPMI) collects the package and the memory domain of
every socket in one pass. The DRAM part falls back to MSRs on its own if
the memory RAPL domain is not present on every socket.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
PCM_USE_TPMI_RAPL=1 now additionally replaces MSR_SYS_ENERGY_STATUS with
the ENERGY_STATUS register of the system (platform) RAPL TPMI domain
(domain type 1) of socket 0, mirroring the MSR-based counter which is
also read on socket 0 only. On GNR the register of the system TPMI
domain reports the same raw values as MSR_SYS_ENERGY_STATUS, therefore
the energy unit handling of getSystemConsumedJoules stays unchanged.

The system energy metric falls back to the MSR-based counter on its own
if the system RAPL domain is not present.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The package, DRAM and system energy metrics are read through the
architectural RAPL TPMI interface whenever the RAPL TPMI feature is
discovered on a server processor and fall back to the legacy RAPL MSRs
otherwise. PCM_USE_TPMI_RAPL is replaced by PCM_NO_TPMI_RAPL=1 which
disables the RAPL TPMI usage and enforces the legacy MSR interfaces.

Since the fallback is a normal situation now (processors without the RAPL
TPMI feature) it is reported through the debug output instead of error and
warning messages. The RAPL TPMI discovery is skipped on client processors
to avoid the TPMI/PCI enumeration there.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
getSystemConsumedJoules used the package energy unit (or the fixed 1 Joule
granularity of SPR/EMR/GNR/SRF) also when the system energy is read
through the RAPL TPMI interface. The energy unit of the system (platform)
domain is read from the POWER_UNIT register of that domain now and
returned by the new PCM::getSystemJoulesPerEnergyUnit(), which also hosts
the model specific granularity that was inline in
getSystemConsumedJoules before.

Note that the fixed 1 Joule granularity keeps precedence on
SPR/EMR/GNR/SRF: the system RAPL TPMI domain of these processors reports
the architectural default energy unit (61 uJ) in its POWER_UNIT register
while its ENERGY_STATUS register is the same counter as
MSR_SYS_ENERGY_STATUS and counts Joules (measured on GNR: 318 counts/s
at idle, 548 counts/s under load).

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
…ent and MSR-free

Co-authored-by: rdementi <25432609+rdementi@users.noreply.github.com>
…inating

Co-authored-by: rdementi <25432609+rdementi@users.noreply.github.com>
Change-Id: I162911157cd5782687b10ad563f789f0a76722e9
@opcm
opcm merged commit c564cf2 into master Sep 7, 2026
43 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants