Skip to content

pcm-sensor-server: export CXL counters when only one socket is visible - #1063

Merged
opcm merged 1 commit into
intel:masterfrom
HowardLiaoIntel:fix/sensor-server-cxl-one-socket
Nov 13, 2026
Merged

opcm merged 1 commit into
intel:masterfrom
HowardLiaoIntel:fix/sensor-server-cxl-one-socket

Conversation

@HowardLiaoIntel

Copy link
Copy Markdown
Contributor

Fixes #1061

Problem

The Prometheus printer emitted the CXL counters together with the UPI/QPI counters, and only when two or more sockets were visible:

if ( pcm->isServerCPU() && pcm->getNumSockets() >= 2 ) {
    printComment( "UPI/QPI Counters" );
    printSystemCounterState( before, after );
}

On a two-socket platform with UPI disabled, the OS and PCM see one socket, so no CXL_* metrics were exported although PCM detected the CXL units at startup ("6 CXL units detected").

Change

Also print the section when a socket has CXL ports:

bool hasCXLPorts = false;
for ( uint32 s = 0; s < pcm->getNumSockets(); ++s ) {
    if ( pcm->getNumCXLPorts( s ) > 0 ) hasCXLPorts = true;
}
if ( pcm->isServerCPU() && ( pcm->getNumSockets() >= 2 || hasCXLPorts ) ) {
  • Two or more sockets: unchanged.
  • One socket without CXL: unchanged.
  • One socket with CXL: gains the CXL_* counters. With no UPI links the link loop runs zero times, so no *_Link_* metrics are added.
  • The JSON printer already prints this section unconditionally, so it is not affected.

Testing

Built current master and ran pcm-sensor-server -r -silent on a Xeon 6787P (Granite Rapids) with a CXL Type 3 device and UPI disabled (one visible socket):

  • Before: 0 CXL_* lines in /metrics.
  • After: CXL_Read_Mem, CXL_Read_Cache, CXL_Write_Mem, CXL_Write_Cache exported for socket="0", and no *_Link_* metrics.

The Prometheus printer emitted the CXL counters together with the UPI/QPI
counters, and only when two or more sockets were visible. A two-socket
platform with UPI disabled exposes one socket to the OS, so no CXL_*
metrics were exported although PCM detected the CXL units.

Also print the section when a socket has CXL ports. With no UPI links the
link loop runs zero times, so one-socket systems without CXL are unchanged
and one-socket systems with CXL only gain the CXL counters. The JSON
printer already prints this section unconditionally.

Fixes intel#1061

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues remain for the change enabling Prometheus CXL counters on single-socket servers.

No open issues 🎉

What changed in this PR

Fixes #1061 by allowing the Prometheus exporter to emit CXL counters on servers with only one visible socket, including systems with UPI disabled.

Changes:

  • Checks for CXL ports across visible sockets before deciding whether to print system counters.
  • Preserves existing behavior for multi-socket servers and single-socket systems without CXL; JSON output is unchanged.
File Description
src/​pcm-sensor-server.cpp Allows the Prometheus system-counter section when CXL ports are present, regardless of socket count.

Review effort: Balanced

@opcm

opcm commented Nov 13, 2026

Copy link
Copy Markdown
Contributor

thanks a lot!

@opcm
opcm merged commit 8574a1f into intel:master Nov 13, 2026
33 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.

pcm-sensor-server: CXL metrics are not exported when only one socket is visible (e.g. UPI disabled), even though CXL units are detected

3 participants