Skip to content

Conversation

@shenxiaochen
Copy link

@shenxiaochen shenxiaochen commented Nov 20, 2025

Description

From Intel RDT spec[1] and AMD Platform QoS spec[2]: If the CPU platform supports CPUID.0FH.01H:EAX, CPUID.0FH.01H:EAX[7:0] returns MBM counter length (width) as offset from 24.

But in hw_cap_mon_discover(), the MBM counter length is calculated with incorrect 7-bits bitmask (0x7f).

Fix the issue with 8-bits bitmask (0xff) for MBM counter length.

[1] Intel Architectures SDM, Vol.3B, 19.18 Intel RDT Monitoring: https://cdrdv2.intel.com/v1/dl/getContent/671200

[2] AMD Platform QoS Extensions, Rev 1.03:
https://www.amd.com/content/dam/amd/en/documents/processor-tech-docs/other/56375_1_03_PUB.pdf

Fixes: 050f8c6 ("lib: detect MBM counter length")

Affected parts

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

Motivation and Context

Fix incorrect bitmask for MBM counter length

How Has This Been Tested?

  1. Passed all tests in intel-cmt-cat/unit-test.
  2. Run most pqos tests described below:
    https://github.com/intel/intel-cmt-cat/wiki/Usage-Examples

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.

From Intel RDT spec[1] and AMD Platform QoS spec[2]:
If the CPU platform supports CPUID.0FH.01H:EAX, CPUID.0FH.01H:EAX[7:0]
returns MBM counter length (width) as offset from 24.

But in hw_cap_mon_discover(), the MBM counter length is calculated with
incorrect 7-bits bitmask (0x7f).

Fix the issue with 8-bits bitmask (0xff) for MBM counter length.

[1] Intel Architectures SDM, Vol.3B, 19.18 Intel RDT Monitoring:
https://cdrdv2.intel.com/v1/dl/getContent/671200

[2] AMD Platform QoS Extensions, Rev 1.03:
https://www.amd.com/content/dam/amd/en/documents/processor-tech-docs/other/56375_1_03_PUB.pdf

Fixes: 050f8c6 ("lib: detect MBM counter length")
Signed-off-by: Xiaochen Shen <[email protected]>
@ajherdri
Copy link

Hi Xiaochen,
Thanks for noticing this! We will review and get back to you soon.
May take a week or so given the US holiday this week.
Thanks,
~Andrew

@ajherdri
Copy link

Update -- we have reviewed and plan to approve. We will merge this with the next RDT Utility release in Q1-2026, and we will include this fix as part of that, and the pull request will be marked as accepted at that point.
Thanks,
~Andrew

@rkanagar rkanagar requested a review from Copilot December 12, 2025 10:17
Copy link

Copilot AI left a comment

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 an incorrect bitmask used when calculating the MBM (Memory Bandwidth Monitoring) counter length from CPUID data. The issue stems from using a 7-bit mask (0x7f) instead of the correct 8-bit mask (0xff) as specified in both Intel RDT and AMD Platform QoS specifications.

  • Corrects the bitmask from 0x7f to 0xff to properly extract bits [7:0] from CPUID.0FH.01H:EAX
  • Aligns the implementation with Intel and AMD architectural specifications

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

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.

2 participants