Skip to content

Fix SNC state detection on non-SNC-capable platforms - #304

Closed
shenxiaochen wants to merge 1 commit into
intel:masterfrom
shenxiaochen:fix-snc-detection
Closed

shenxiaochen wants to merge 1 commit into
intel:masterfrom
shenxiaochen:fix-snc-detection

Conversation

@shenxiaochen

@shenxiaochen shenxiaochen commented Dec 30, 2025 •

Copy link
Copy Markdown
Contributor

Fix SNC state detection on non-SNC-capable platforms

Description

On platforms that do not support Sub-NUMA Clustering (SNC) monitoring (e.g., AMD and Hygon), if the CPU topology indicates that the number of NUMA nodes and the number of sockets are not equal, the SNC state detection logic in hw_cap_mon_snc_state() will attempt to read the SNC configuration MSR register PQOS_MSR_SNC_CFG (0xCA0) that is not
available. This causes the command "pqos --iface=msr" to fail with the error:

ERROR: RDMSR failed for reg[0xca0] on lcore 0
ERROR: Error reading SNC information!
ERROR: Error encounter in monitoring discovery!
ERROR: discover_capabilities() error 1
Error initializing PQoS library!

Fix the issue by ensuring hw_cap_mon_snc_state() returns early on non-SNC-capable platforms.

Affected parts

  • library
  • pqos utility
  • rdtset utility
  • other: (please specify)

Motivation and Context

The command "pqos --iface=msr" fails on non-SNC-capable platforms during SNC state detection with the error:

ERROR: RDMSR failed for reg[0xca0] on lcore 0
ERROR: Error reading SNC information!
ERROR: Error encounter in monitoring discovery!
ERROR: discover_capabilities() error 1
Error initializing PQoS library!

The code changes fix the issue on non-SNC-capable platforms.

How Has This Been Tested?

(1) Run "pqos --iface=msr" without the error described above on non-SNC-capable platforms (e.g., AMD or Hygon).
(2) Passed all tests in intel-cmt-cat/unit-test.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.

@shenxiaochen

Copy link
Copy Markdown
Contributor Author

Note: The code base of this PR is on top of #300 and #299

[This PR - #304 ]
e07514a lib: Fix SNC state detection on non-SNC-capable platforms

[PR #300 ]
b981133 lib: Set fixed MBM counter length for Hygon
90c603e lib/python: Add support for Hygon Platform QoS features
c5cc545 lib: Add support for Hygon Platform QoS features

[PR #299 ]
6a4d764 lib: Fix incorrect bitmask for MBM counter length

Best regards,
Xiaochen

@shenxiaochen

Copy link
Copy Markdown
Contributor Author

I would appreciate it if you could review this PR at your convenience. As a heads-up, it depends on PR #300.
Thank you very much!

@rkanagar
rkanagar requested a review from Copilot January 21, 2026 12:06
@rkanagar

Copy link
Copy Markdown
Contributor

Hi @shenxiaochen
We are reviewing all PRs now. Thanks.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes a bug where SNC state detection fails on non-SNC-capable platforms (AMD and Hygon) by adding support for Hygon vendor detection and ensuring early returns in SNC-related code paths for both AMD and Hygon platforms.

Changes:

  • Added PQOS_VENDOR_HYGON vendor enum value and detection logic
  • Updated SNC state detection to return early for AMD and Hygon platforms
  • Extended all AMD-specific vendor checks to also include Hygon
  • Fixed Hygon-specific CPUID counter length calculation

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
lib/pqos.h Added PQOS_VENDOR_HYGON enum value and updated documentation
lib/cpuinfo.c Added Hygon vendor detection and initialization logic
lib/hw_cap.c Added early return for AMD/Hygon in SNC state detection and fixed Hygon counter length
lib/cap.c Extended MBA discovery vendor check to include Hygon
lib/api.c Extended API initialization vendor checks to include Hygon
rdtset/rdt.c Extended all AMD vendor checks to include Hygon
pqos/alloc.c Extended all AMD vendor checks to include Hygon
lib/python/pqos/native_struct.py Added PQOS_VENDOR_HYGON constant
lib/python/pqos/cpuinfo.py Added Hygon vendor string mapping

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread lib/hw_cap.c
Comment thread lib/cpuinfo.c
@shenxiaochen

Copy link
Copy Markdown
Contributor Author

Hi @shenxiaochen We are reviewing all PRs now. Thanks.

@rkanagar Thank you very much for code review! I will address the Copilot review comments inline.

@shenxiaochen
shenxiaochen force-pushed the fix-snc-detection branch 2 times, most recently from 12685be to 73f4472 Compare January 28, 2026 05:52
@rkanagar

Copy link
Copy Markdown
Contributor

Hi @shenxiaochen ,

Please rebase this PR. We are ready to merge.

Thanks,
Raghavan K.

On platforms that do not support Sub-NUMA Clustering (SNC) monitoring
(e.g., AMD and Hygon), if the CPU topology indicates that the number of
NUMA nodes and the number of sockets are not equal, the SNC state
detection logic in hw_cap_mon_snc_state() will attempt to read the SNC
configuration MSR register PQOS_MSR_SNC_CFG (0xCA0) that is not
available. This causes the command "pqos --iface=msr" to fail with the
error:

  "ERROR: RDMSR failed for reg[0xca0] on lcore 0"
  "ERROR: Error reading SNC information!"
  "ERROR: Error encounter in monitoring discovery!"
  "ERROR: discover_capabilities() error 1"
  "Error initializing PQoS library!"

Fix the issue by ensuring hw_cap_mon_snc_state() returns early on
non-SNC-capable platforms.

Fixes: bfc7c70 ("SNC is added")
Signed-off-by: Xiaochen Shen <shenxiaochen@open-hieco.net>
@shenxiaochen

Copy link
Copy Markdown
Contributor Author

Hi @shenxiaochen ,

Please rebase this PR. We are ready to merge.

Thanks, Raghavan K.

Rebased on top of master tree (after PR #300 merged). Thank you!

@rkanagar

rkanagar commented Jan 29, 2026 •

Copy link
Copy Markdown
Contributor

Merged by
9db1045

@rkanagar rkanagar closed this Jan 29, 2026
@shenxiaochen

Copy link
Copy Markdown
Contributor Author

Merged by 9db1045

@rkanagar Thank you very much for help!

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