Skip to content

Please pull 26.04 linux nvidia.glue#428

Open
fyu1 wants to merge 76 commits into
NVIDIA:26.04_linux-nvidiafrom
fyu1:26.04_linux-nvidia.glue
Open

Please pull 26.04 linux nvidia.glue#428
fyu1 wants to merge 76 commits into
NVIDIA:26.04_linux-nvidiafrom
fyu1:26.04_linux-nvidia.glue

Conversation

@fyu1
Copy link
Copy Markdown
Collaborator

@fyu1 fyu1 commented May 18, 2026

This MPAM PR has 4 parts:

1-47: backported from upstream
48: enable RESCTRL_FS
49-52: forward ported from 6.17 hwe
53: fix issues on Grace
Please review and merge to 7.0 hwe.

@nirmoy
Copy link
Copy Markdown
Collaborator

nirmoy commented May 18, 2026

Boro watcher review skipped

The GitHub watcher skips automatic boro reviews for PRs with more than 50 commits. This PR currently has 76 commits.

To run the review anyway, ask BaseOS_Kernel_Bot in #baseos-kernel:

review https://github.com/NVIDIA/NV-Kernels/pull/428

Head: c290ccada6d9

This comment is maintained by nv-pr-bot. It is updated when the GitHub watcher sees a newer PR head.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 18, 2026

PR Validation Report

Patchscan ✅ No Missing Fixes

All cherry-picked commits checked — no missing upstream fixes found.

PR Lint ❌ Errors found

Details
Checking 76 commits...

Cherry-pick digest:
┌──────────────┬──────────────────────────────────────────────────────────────────┬────────────┬─────────┬───────────────────────────┐
│ Local        │ Referenced upstream / Patch subject                              │ Patch-ID   │ Subject │ SoB chain                 │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ c290ccada6d9 │ [SAUCE] fix mbm_l3_assign and mon_local_bytes                    │ N/A        │ N/A     │ fenghuay                  │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ d7c3069b1188 │ [SAUCE] resctrl/mpam: reset ris by applying explicit default con │ N/A        │ N/A     │ sdonthin, fenghuay        │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ fde0f3c7319a │ [SAUCE] arm_mpam: include all associated msc components during d │ N/A        │ N/A     │ sdonthin, fenghuay        │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ a60fe92da09c │ [SAUCE] arm_mpam: resctrl: add the glue code to convert to/from  │ N/A        │ N/A     │ morse, fenghuay           │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ fba318cd5ddf │ [SAUCE] fs/resctrl: add l2 and l3 'max' resource schema          │ N/A        │ N/A     │ morse, fenghuay           │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ bcd6704c90f3 │ [SAUCE] fs/resctrl: expose the schema format to user-space       │ N/A        │ N/A     │ morse, fenghuay           │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 1a694ea17995 │ [SAUCE] fs/resctrl: add fflags_from_schema() for files based on  │ N/A        │ N/A     │ morse, fenghuay           │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ fb20cd1b7055 │ [SAUCE] fs/resctrl: add additional files for percentage and bitm │ N/A        │ N/A     │ morse, fenghuay           │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 3f6418379f26 │ [SAUCE] x86/resctrl: move over to specifying mba control formats │ N/A        │ N/A     │ morse, fenghuay           │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 3206f1af79ba │ [SAUCE] fs/resctrl: add specific schema types for 'range'        │ N/A        │ N/A     │ morse, fenghuay           │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ c2883c7d2bd1 │ [SAUCE] fs/resctrl: add a schema format to the schema, allowing  │ N/A        │ N/A     │ morse, fenghuay           │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 53042fe1dd58 │ [SAUCE] fs/resctrl: rename resctrl_get_default_ctrl() to include │ N/A        │ N/A     │ morse, fenghuay           │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 8d3aebe34157 │ [SAUCE] fs/resctrl: move mba supported check to parse_line() ins │ N/A        │ N/A     │ morse, fenghuay           │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 0c10131a80d9 │ [SAUCE] fs/resctrl: abstract duplicate domain test to a helper   │ N/A        │ N/A     │ morse, fenghuay           │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 42ecd8a31752 │ [SAUCE] fs/resctrl: group all the mba specific properties in a s │ N/A        │ N/A     │ morse, fenghuay           │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ f5e2f58a2008 │ [SAUCE] arm_mpam: rename mbw conversion to 'fract16' for code re │ N/A        │ N/A     │ morse, fenghuay           │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 2986c092abe1 │ [SAUCE] arm_mpam: allow cmax/cmin to be configured               │ N/A        │ N/A     │ morse, fenghuay           │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 8f4ab7403ca1 │ [SAUCE] fs/restrl: allow the overflow handler to be disabled     │ N/A        │ N/A     │ morse, fenghuay           │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 5668a9026399 │ [SAUCE] arm_mpam: resctrl: determine if any exposed counter can  │ N/A        │ N/A     │ morse, fenghuay           │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ f51e766a88a0 │ [SAUCE] x86/resctrl: add stub to allow other architecture to dis │ N/A        │ N/A     │ morse, fenghuay           │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 5d555ee9431f │ [SAUCE] fs/resctrl,x86/resctrl: factor mba rounding to be per-ar │ N/A        │ N/A     │ Martin, morse, fenghuay   │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 234af5942ad8 │ [SAUCE] arm_mpam: add resctrl_arch_round_bw()                    │ N/A        │ N/A     │ Martin, morse, fenghuay   │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 60519730fd53 │ [SAUCE] arm_mpam: resctrl: add resctrl_arch_cntr_read() & resctr │ N/A        │ N/A     │ morse, fenghuay           │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ e28af1f981d4 │ [SAUCE] arm_mpam: resctrl: add resctrl_arch_rmid_read() and resc │ N/A        │ N/A     │ morse, fenghuay           │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 4168f4f9ebc5 │ [SAUCE] arm_mpam: resctrl: add resctrl_arch_config_cntr() for ab │ N/A        │ N/A     │ morse, fenghuay           │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 6ed66436727e │ [SAUCE] arm_mpam: resctrl: pre-allocate assignable monitors      │ N/A        │ N/A     │ morse, fenghuay           │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ c4943d980272 │ [SAUCE] arm_mpam: resctrl: pre-allocate free running monitors    │ N/A        │ N/A     │ morse, fenghuay           │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 7e8229c74700 │ [SAUCE] untested: arm_mpam: resctrl: pick classes for use as mbm │ N/A        │ N/A     │ morse, fenghuay           │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ b5091e9092ff │ [SAUCE] update annotations to set config_resctrl_fs              │ N/A        │ N/A     │ fenghuay                  │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 1baee4f29788 │ 4d5bbbafc170 arm_mpam: resctrl: Make resctrl_mon_ctx_waiters sta │ match      │ match   │ preserved + fenghuay adde │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ db2a72543cf9 │ 67c0a487efa5 arm_mpam: resctrl: Fix the check for no monitor com │ match      │ match   │ preserved + fenghuay adde │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ c2775710215c │ f758340da529 arm_mpam: resctrl: Fix MBA CDP alloc_capable handli │ match      │ match   │ preserved + fenghuay adde │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 3336c19a29c5 │ 79727019ce3d fs/resctrl: Add missing return value descriptions   │ match      │ match   │ preserved + fenghuay adde │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 925133a6ec4a │ c611752be9d7 MAINTAINERS: Update resctrl entry                   │ match      │ match   │ preserved + fenghuay adde │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 1218d71a792c │ d2bf45d067c7 fs/resctrl: Add "*" shorthand to set io_alloc CBM f │ match      │ match   │ preserved + fenghuay adde │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 6b66479e18bd │ d06b8e7c97c3 fs/resctrl: Report invalid domain ID when parsing i │ match      │ match   │ preserved + fenghuay adde │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 8ffcb1903393 │ 4ce0a2ccc035 arm64: mpam: Add initial MPAM documentation         │ match      │ match   │ preserved + fenghuay adde │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ b8b66042c8fc │ aeb8595a5f8b arm_mpam: Quirk CMN-650's CSU NRDY behaviour        │ match      │ match   │ preserved + fenghuay adde │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ afd5caaa7ffb │ dc48eb1ff27c arm_mpam: Add workaround for T241-MPAM-6            │ match      │ match   │ preserved + fenghuay adde │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ daaba659006f │ a7efe23ed6dd arm_mpam: Add workaround for T241-MPAM-4            │ match      │ match   │ preserved + fenghuay adde │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 142f08ea813c │ 70e81fbedc65 arm_mpam: Add workaround for T241-MPAM-1            │ match      │ match   │ preserved + fenghuay adde │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 7be0a28b4532 │ fa7745218c98 arm_mpam: Add quirk framework                       │ match      │ match   │ preserved + fenghuay adde │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 0a83d7dd98d4 │ fb481ec08699 arm_mpam: resctrl: Call resctrl_init() on platforms │ match      │ match   │ preserved + fenghuay adde │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 4d8652f69cee │ 4aab135bda16 arm64: mpam: Select ARCH_HAS_CPU_RESCTRL            │ match      │ match   │ preserved + fenghuay adde │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 2a7ceaa7901f │ ec9a788620be ALSA: usb-audio: Replace hard-coded number with MAX │ match      │ match   │ preserved + fenghuay adde │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 07e5934b1275 │ efc775eadce2 arm_mpam: resctrl: Add empty definitions for assort │ match      │ match   │ preserved + fenghuay adde │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ bcd6ddf310c8 │ 49b04e401825 arm_mpam: resctrl: Update the rmid reallocation lim │ match      │ match   │ preserved + fenghuay adde │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 648fcf6dc504 │ fb56b29932ca arm_mpam: resctrl: Add resctrl_arch_rmid_read()     │ match      │ match   │ preserved + fenghuay adde │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 3cb16f97ffec │ 2a3c79c61539 arm_mpam: resctrl: Allow resctrl to allocate monito │ match      │ match   │ preserved + fenghuay adde │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ d5bf8d62b6cc │ 1458c4f05335 arm_mpam: resctrl: Add support for csu counters     │ match      │ match   │ preserved + fenghuay adde │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ fd735b3f618b │ 264c285999fc arm_mpam: resctrl: Add monitor initialisation and d │ match      │ match   │ preserved + fenghuay adde │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 7ddb679b1a6e │ 5dc8f73eaa5d arm_mpam: resctrl: Add kunit test for control forma │ match      │ match   │ preserved + fenghuay adde │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 7b96a3913330 │ 36528c7681b8 arm_mpam: resctrl: Add support for 'MB' resource    │ match      │ match   │ preserved + fenghuay adde │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ b4563f726fa1 │ 1c1e2968a860 arm_mpam: resctrl: Wait for cacheinfo to be ready   │ match      │ match   │ preserved + fenghuay adde │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 1ed0a8b7d791 │ 3e9b35823aab arm_mpam: resctrl: Add rmid index helpers           │ match      │ match   │ preserved + fenghuay adde │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 0acbe7f7235c │ 80d147d29313 arm_mpam: resctrl: Convert to/from MPAMs fixed-poin │ match      │ match   │ preserved + fenghuay adde │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 9d3f99562628 │ 01a0021f6c39 arm_mpam: resctrl: Hide CDP emulation behind CONFIG │ match      │ match   │ preserved + fenghuay adde │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 6c5b86fee3a6 │ 6789fb99282c arm_mpam: resctrl: Add CDP emulation                │ match      │ match   │ preserved + fenghuay adde │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 8f40733ceaf4 │ 9d2e1a99fae5 arm_mpam: resctrl: Add plumbing against arm64 task  │ match      │ match   │ preserved + fenghuay adde │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 1494922e4dc6 │ 9cd2b522be2c arm_mpam: resctrl: Implement helpers to update conf │ match      │ match   │ preserved + fenghuay adde │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 80222a19d73a │ 02cc66168788 arm_mpam: resctrl: Add resctrl_arch_get_config()    │ match      │ match   │ preserved + fenghuay adde │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 389f57a2db1d │ 370d166d878d arm_mpam: resctrl: Implement resctrl_arch_reset_all │ match      │ match   │ preserved + fenghuay adde │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ df36b5d62682 │ 52a4edb16121 arm_mpam: resctrl: Pick the caches we will use as r │ match      │ match   │ preserved + fenghuay adde │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 9abe42922a2f │ 09e61daf8e96 arm_mpam: resctrl: Add boilerplate cpuhp and domain │ match      │ match   │ preserved + fenghuay adde │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 72f39fc57d8a │ 2cf9ca3fae38 arm64: mpam: Add helpers to change a task or cpu's  │ match      │ match   │ preserved + fenghuay adde │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 59052b90f791 │ 37fe0f984d9c arm64: mpam: Initialise and context switch the MPAM │ match      │ match   │ preserved + fenghuay adde │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 09b7f4a7e6ac │ 735dad999905 arm64: mpam: Add cpu_pm notifier to restore MPAM sy │ match      │ match   │ preserved + fenghuay adde │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ ec9ca2443431 │ 831a7f16728c arm64: mpam: Advertise the CPUs MPAM limits to the  │ match      │ match   │ preserved + fenghuay adde │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ b9181295ae93 │ c544f00a4732 arm64: mpam: Drop the CONFIG_EXPERT restriction     │ match      │ match   │ preserved + fenghuay adde │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ c8aa1e485754 │ 87b78a5d70e8 arm64: mpam: Re-initialise MPAM regs when CPU comes │ match      │ match   │ preserved + fenghuay adde │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ d9c282a7b679 │ 8e06d04ff1cf arm64: mpam: Context switch the MPAM registers      │ match      │ match   │ preserved + fenghuay adde │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 9582e6bcc1eb │ 2e7c684bdb50 KVM: arm64: Make MPAMSM_EL1 accesses UNDEF          │ match      │ match   │ preserved + fenghuay adde │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 7cd3213e9323 │ eda1cd1f9d29 KVM: arm64: Preserve host MPAM configuration when c │ match      │ match   │ preserved + fenghuay adde │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ fda7c04a209a │ 29fa1be82b83 arm64/sysreg: Add MPAMSM_EL1 register               │ match      │ match   │ preserved + fenghuay adde │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 7ee6d7e444ec │ a1cb6577f575 arm_mpam: Reset when feature configuration bit unse │ match      │ match   │ preserved + fenghuay adde │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 56c5c22b34e3 │ f91e913355f4 arm_mpam: Ensure in_reset_state is false after appl │ match      │ match   │ preserved + fenghuay adde │
└──────────────┴──────────────────────────────────────────────────────────────────┴────────────┴─────────┴───────────────────────────┘

Lint results:
W: 0a83d7dd98d4 ("arm_mpam: resctrl: Call resctrl_init() on platform"): subject 76 chars (>72)
W: 72f39fc57d8a ("arm64: mpam: Add helpers to change a task or cpu's"): subject 73 chars (>72)

PR metadata:
W: PR title missing [<branch>] prefix: "Please pull 26.04 linux nvidia.glue"
E: PR targets 26.04_linux-nvidia but body has no https://bugs.launchpad.net/... link

@fyu1 fyu1 changed the title 26.04 linux nvidia.glue Please pull 26.04 linux nvidia.glue May 18, 2026
@nvmochs
Copy link
Copy Markdown
Collaborator

nvmochs commented May 18, 2026

@fyu1

cac60bd NVIDIA: SAUCE: arm_mpam: Include all associated
9515328 NVIDIA: SAUCE: arm_mpam: resctrl: Pre-allocate assignable monitors
02743bd NVIDIA: SAUCE: arm_mpam: resctrl: Pre-allocate free running monitors
43f25ff NVIDIA: SAUCE: untested: arm_mpam: resctrl: pick classes for use as mbm counters

What function are these patches providing? It is a Grace feature?

What are the upstream plans for these patches? (It looks like there were part of the MPAM Part 2 series at one point but were dropped?)


I verified the 47 patches from upstream were clean picks. No issues with those or with the annotations patch.


cac60bd NVIDIA: SAUCE: arm_mpam: Include all associated

Codex found 2 issues with this patch...

cac60bd drops a source hunk from ac1e5be in drivers/resctrl/mpam_devices.c.

The source patch changes mpam_ris_get_affinity() so memory-class components with empty affinity, or memory classes above level 3, are associated with cpu_possible_mask. The target commit does not carry that over. Current code still just
does:

drivers/resctrl/mpam_devices.c:505

case MPAM_CLASS_MEMORY:
get_cpumask_from_node_id(comp->comp_id, affinity);
/* affinity may be empty for CPU-less memory nodes */
break;

The source has:

if (cpumask_empty(affinity)) {
dev_warn_once(..., "CPU-less numa node");
cpumask_copy(affinity, cpu_possible_mask);
} else if (class->level > 3)
cpumask_copy(affinity, cpu_possible_mask);

That matters because cac60bd changes CPU online/offline handling to iterate all components whose affinity contains the CPU. Without the affinity hunk, CPU-less memory nodes stay empty, and level >3 memory components stay tied to their
NUMA node mask instead of all CPUs. That undermines the “include all associated” behavior for those components.

The [fenghuay:] note should be improved. It currently does not mention omitting the mpam_ris_get_affinity() hunk. I think this is not just an annotation problem; the hunk should likely be added unless there is a deliberate branch-specific
reason to omit it.


cac60bd duplicates for_each_mpam_resctrl_control(). The exact same macro is defined twice in drivers/resctrl/mpam_resctrl.c. That is a cleanup/build-hygiene issue, and the commit note should not say “adds” that macro if it was already present.


break;
case MPAM_CLASS_MEMORY:
get_cpumask_from_node_id(comp->comp_id, affinity);
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

In pr#419, this portion of the code had:

		if (cpumask_empty(affinity)) {
			dev_warn_once(&msc->pdev->dev, "CPU-less numa node");
			cpumask_copy(affinity, cpu_possible_mask);
		} else if (class->level > 3)
			cpumask_copy(affinity, cpu_possible_mask);

Do you still need to keep the "else" case here?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

@jamieNguyenNVIDIA The else is based on CPU-less feature which is not supported on Grace. On Grace, only MPAM_CLASS_CACHE is supported. This code is in MPAM_CLASS_MEMORY type and won't be triggered. When this kernel runs on Vera which supports CPU-less feature, the feature will not enabled on this kernel, which is Grace features only.

@nirmoy
Copy link
Copy Markdown
Collaborator

nirmoy commented May 19, 2026

Boro review

Latest watcher review: open review

Head: f3404d4f7d2d

This comment is maintained by nv-pr-bot. It is updated when the GitHub watcher publishes a newer review.

@nirmoy nirmoy added help wanted Extra attention is needed question Further information is requested labels May 21, 2026
@nvidia-bfigg nvidia-bfigg force-pushed the 26.04_linux-nvidia branch 2 times, most recently from bbda548 to 837b23f Compare May 22, 2026 19:36
@fyu1 fyu1 force-pushed the 26.04_linux-nvidia.glue branch 2 times, most recently from c9f54eb to 3889fc6 Compare May 26, 2026 02:27
@nirmoy nirmoy added pending_review_comment and removed question Further information is requested labels May 27, 2026
@jamieNguyenNVIDIA
Copy link
Copy Markdown
Collaborator

Hi @fyu1, can you please rebase this PR?

@fyu1 fyu1 force-pushed the 26.04_linux-nvidia.glue branch from 3889fc6 to 673d4c3 Compare May 28, 2026 22:22
@jamieNguyenNVIDIA
Copy link
Copy Markdown
Collaborator

Comment on lines +831 to +851
static u32 fract16_to_percent(u16 fract, u8 wd)
{
return DIV_ROUND_CLOSEST((fract + 1) * 100, 65536);
}

/*
* Find the band whose upper bound is closest to the specified percentage.
*
* A round-to-nearest policy is followed here as a balanced compromise
* between unexpected under-commit of the resource (where the total of
* a set of resource allocations after conversion is less than the
* expected total, due to rounding of the individual converted
* percentages) and over-commit (where the total of the converted
* allocations is greater than expected).
*/
static u16 percent_to_fract16(u8 pc, u8 wd)
{
return pc ? (((pc * 65536) / 100) - 1) : 0;
}

static u32 mbw_max_to_percent(u16 mbw_max, struct mpam_props *cprops)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Alongside the RIS-reset change, this commit also rewrites the two fixed-point conversion helpers to drop the wd (field-width) argument:

static u32 fract16_to_percent(u16 fract, u8 wd)
{
	return DIV_ROUND_CLOSEST((fract + 1) * 100, 65536);
}

static u16 percent_to_fract16(u8 pc, u8 wd)
{
	return pc ? (((pc * 65536) / 100) - 1) : 0;
}

A couple of things stand out:

  1. The commit message only describes the RIS-reset work and doesn't mention the conversion change. (It looks like it rode along from the forward-port of e0b6de09b2.)

  2. The comment kept above percent_to_fract16() still describes the value as split into (1 << bwa_wd) bands with the low bits ignored, which the new width-independent form no longer matches.

  3. The in-tree kunit test_percent_to_mbw_max() (from b4dbd4e5bc35 "arm_mpam: resctrl: Add kunit test for control format conversions") appears to fail. It computes res.value = percent_to_mbw_max(pc) = percent_to_fract16(pc, width) and asserts:

    KUNIT_EXPECT_LE(test, res.value, res.max_value << res.shift);
    ...
    if (param->pc == 100)
        KUNIT_EXPECT_EQ(test, res.value, res.max_value << res.shift);

    For pc == 100 the new percent_to_fract16() returns 0xFFFF regardless of width, while max_value << shift is ((1 << width) - 1) << (16 - width) — e.g. 0xFF00 (65280) at width 8, 0xC000 (49152) at width 2. So 0xFFFF exceeds the upper bound and fails both the LE assertion and the exact-match for every implemented width below 16.

    There's also a read/write asymmetry on narrow fields: since percent_to_fract16() no longer left-justifies into the top wd bits, a value written and then read back through fract16_to_percent() can shift — at bwa_wd = 2, 50% writes 0x7FFF, the hardware keeps 0x4000, and the read-back reports 25%. (For bwa_wd >= 8 the old and new forms agree, so the divergence is limited to narrow fields.)

Was dropping wd here intentional? If so, should the kunit and the retained comment be updated to match — or should the width handling be preserved for narrow fields?

Comment thread fs/resctrl/rdtgroup.c
@fyu1
Copy link
Copy Markdown
Collaborator Author

fyu1 commented May 29, 2026

duplicate for_each_mpam_resctrl_control

Duplicate for_each_mpam_resctrl_control() is fixed.

@fyu1
Copy link
Copy Markdown
Collaborator Author

fyu1 commented May 29, 2026

@fyu1

cac60bd NVIDIA: SAUCE: arm_mpam: Include all associated 9515328 NVIDIA: SAUCE: arm_mpam: resctrl: Pre-allocate assignable monitors 02743bd NVIDIA: SAUCE: arm_mpam: resctrl: Pre-allocate free running monitors 43f25ff NVIDIA: SAUCE: untested: arm_mpam: resctrl: pick classes for use as mbm counters

What function are these patches providing? It is a Grace feature?

These are for assignment mode for mba and mbm. Without these, mba/mbm won't work. They are not Grace specific.

What are the upstream plans for these patches? (It looks like there were part of the MPAM Part 2 series at one point but were dropped?)
They are being reviewed on LKML: https://lore.kernel.org/lkml/20260520212458.1797221-4-ben.horgan@arm.com/

I verified the 47 patches from upstream were clean picks. No issues with those or with the annotations patch.

cac60bd NVIDIA: SAUCE: arm_mpam: Include all associated

Codex found 2 issues with this patch...

cac60bd drops a source hunk from ac1e5be in drivers/resctrl/mpam_devices.c.

The source patch changes mpam_ris_get_affinity() so memory-class components with empty affinity, or memory classes above level 3, are associated with cpu_possible_mask. The target commit does not carry that over. Current code still just does:

drivers/resctrl/mpam_devices.c:505

case MPAM_CLASS_MEMORY: get_cpumask_from_node_id(comp->comp_id, affinity); /* affinity may be empty for CPU-less memory nodes */ break;

The source has:

if (cpumask_empty(affinity)) { dev_warn_once(..., "CPU-less numa node"); cpumask_copy(affinity, cpu_possible_mask); } else if (class->level > 3) cpumask_copy(affinity, cpu_possible_mask);

That matters because cac60bd changes CPU online/offline handling to iterate all components whose affinity contains the CPU. Without the affinity hunk, CPU-less memory nodes stay empty, and level >3 memory components stay tied to their NUMA node mask instead of all CPUs. That undermines the “include all associated” behavior for those components.

CPU-less feature is not supported on Grace. The code is for MPAM_CLASS_MEMORY type which is not supported on Grace and thus the code won't be executed on Grace. Without the code, CPU-less feature is ignore on Vera, which is expected.

The [fenghuay:] note should be improved. It currently does not mention omitting the mpam_ris_get_affinity() hunk. I think this is not just an annotation problem; the hunk should likely be added unless there is a deliberate branch-specific reason to omit it.

I have updated commit message for omitting this hunk.

cac60bd duplicates for_each_mpam_resctrl_control(). The exact same macro is defined twice in drivers/resctrl/mpam_resctrl.c. That is a cleanup/build-hygiene issue, and the commit note should not say “adds” that macro if it was already present.

Fixed.

henryZe and others added 4 commits May 29, 2026 02:28
The per-RIS flag, in_reset_state, indicates whether or not the MSC
registers are in reset state, and allows avoiding resetting when they are
already in reset state. However, when mpam_apply_config() updates the
configuration it doesn't update the in_reset_state flag and so even after
the configuration update in_reset_state can be true and mpam_reset_ris()
will skip the actual register restoration on subsequent resets.

Once resctrl has a MPAM backend it will use resctrl_arch_reset_all_ctrls()
to reset the MSC configuration on unmount and, if the in_reset_state flag
is bogusly true, fail to reset the MSC configuration. The resulting
non-reset MSC configuration can lead to persistent performance restrictions
even after resctrl is unmounted.

Fix by clearing in_reset_state to false immediately after successful
configuration application, ensuring that the next reset operation
properly restores MSC register defaults.

Fixes: 09b89d2 ("arm_mpam: Allow configuration to be applied and restored during cpu online")
Signed-off-by: Zeng Heng <zengheng4@huawei.com>
Acked-by: Ben Horgan <ben.horgan@arm.com>
[Horgan: rewrite commit message to not be specific to resctrl unmount]
Signed-off-by: Ben Horgan <ben.horgan@arm.com>
Reviewed-by: Gavin Shan <gshan@redhat.com>
Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com>
Reviewed-by: James Morse <james.morse@arm.com>
Tested-by: Gavin Shan <gshan@redhat.com>
Tested-by: Shaopeng Tan <tan.shaopeng@jp.fujitsu.com>
Tested-by: Jesse Chick <jessechick@os.amperecomputing.com>
Signed-off-by: James Morse <james.morse@arm.com>
(cherry picked from commit f91e913)
Signed-off-by: Fenghua Yu <fenghuay@nvidia.com>
To indicate that the configuration, of the controls used by resctrl, in a
RIS need resetting to driver defaults the reset flags in mpam_config are
set. However, these flags are only ever set temporarily at RIS scope in
mpam_reset_ris() and hence mpam_cpu_online() will never reset these
controls to default. As the hardware reset is unknown this leads to unknown
configuration when the control values haven't been configured away from the
defaults.

Use the policy that an unset feature configuration bit means reset. In this
way the mpam_config in the component can encode that it should be in reset
state and mpam_reprogram_msc() will reset controls as needed.

Fixes: 09b89d2 ("arm_mpam: Allow configuration to be applied and restored during cpu online")
Signed-off-by: Ben Horgan <ben.horgan@arm.com>
Reviewed-by: Gavin Shan <gshan@redhat.com>
Reviewed-by: James Morse <james.morse@arm.com>
Tested-by: Gavin Shan <gshan@redhat.com>
Tested-by: Shaopeng Tan <tan.shaopeng@jp.fujitsu.com>
Tested-by: Jesse Chick <jessechick@os.amperecomputing.com>
[ morse: Removed unused reset flags from config structure ]
Signed-off-by: James Morse <james.morse@arm.com>
(cherry picked from commit a1cb657)
Signed-off-by: Fenghua Yu <fenghuay@nvidia.com>
The MPAMSM_EL1 register determines the MPAM configuration for an SMCU. Add
the register definition.

Tested-by: Gavin Shan <gshan@redhat.com>
Tested-by: Shaopeng Tan <tan.shaopeng@jp.fujitsu.com>
Tested-by: Peter Newman <peternewman@google.com>
Tested-by: Zeng Heng <zengheng4@huawei.com>
Tested-by: Punit Agrawal <punit.agrawal@oss.qualcomm.com>
Tested-by: Jesse Chick <jessechick@os.amperecomputing.com>
Reviewed-by: Zeng Heng <zengheng4@huawei.com>
Reviewed-by: Shaopeng Tan <tan.shaopeng@jp.fujitsu.com>
Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com>
Reviewed-by: Gavin Shan <gshan@redhat.com>
Acked-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Ben Horgan <ben.horgan@arm.com>
Signed-off-by: James Morse <james.morse@arm.com>
(cherry picked from commit 29fa1be)
Signed-off-by: Fenghua Yu <fenghuay@nvidia.com>
When KVM enables or disables MPAM traps to EL2 it clears all other bits in
MPAM2_EL2.  Notably, it clears the partition ids (PARTIDs) and performance
monitoring groups (PMGs). Avoid changing these bits in anticipation of
adding support for MPAM in the kernel. Otherwise, on a VHE system with the
host running at EL2 where MPAM2_EL2 and MPAM1_EL1 access the same register,
any attempt to use MPAM to monitor or partition resources for kernel space
would be foiled by running a KVM guest. Additionally, MPAM2_EL2.EnMPAMSM is
always set to 0 which causes MPAMSM_EL1 to always trap. Keep EnMPAMSM set
to 1 when not in a guest so that the kernel can use MPAMSM_EL1.

Tested-by: Gavin Shan <gshan@redhat.com>
Tested-by: Shaopeng Tan <tan.shaopeng@jp.fujitsu.com>
Tested-by: Peter Newman <peternewman@google.com>
Tested-by: Zeng Heng <zengheng4@huawei.com>
Tested-by: Punit Agrawal <punit.agrawal@oss.qualcomm.com>
Tested-by: Jesse Chick <jessechick@os.amperecomputing.com>
Reviewed-by: Zeng Heng <zengheng4@huawei.com>
Reviewed-by: Shaopeng Tan <tan.shaopeng@jp.fujitsu.com>
Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com>
Reviewed-by: Gavin Shan <gshan@redhat.com>
Acked-by: Marc Zyngier <maz@kernel.org>
Signed-off-by: Ben Horgan <ben.horgan@arm.com>
Signed-off-by: James Morse <james.morse@arm.com>
(cherry picked from commit eda1cd1)
Signed-off-by: Fenghua Yu <fenghuay@nvidia.com>
James Morse and others added 28 commits May 29, 2026 02:28
…bm counters

resctrl has two types of counters, NUMA-local and global. MPAM has only
bandwidth counters, but the position of the MSC may mean it counts
NUMA-local, or global traffic.
But the topology information is not available.
Apply a heuristic: the L2 or L3 supports bandwidth monitors, these are
probably NUMA-local. If the memory controller supports bandwidth
monitors, they are probably global.
This also allows us to assert that we don't have the same class
backing two different resctrl events.
Because the class or component backing the event may not be 'the L3',
it is necessary for mpam_resctrl_get_domain_from_cpu() to search
the monitor domains too. This matters the most for 'monitor only'
systems, where 'the L3' control domains may be empty, and the
ctrl_comp pointer NULL.

Signed-off-by: James Morse <james.morse@arm.com>
(cherry picked from commit 40e0b07 https://github.com/NVIDIA/NV-Kernels 24.04_linux-nvidia-6.17-next)
[fenghuay:
  - mon_comp[] is defined in upstream. Remove its definition in this patch.
  - Resolve minor conflicts in `drivers/resctrl/mpam_resctrl.c`;
]
Signed-off-by: Fenghua Yu <fenghuay@nvidia.com>
When there are enough monitors, the resctrl mbm local and total
files can be exposed. These need all the monitors that resctrl
may use to be allocated up front.
Add helpers to do this.
If a different candidate class is discovered, the old array
should be free'd and the allocated monitors returned to the
driver.

Signed-off-by: James Morse <james.morse@arm.com>
(cherry picked from commit 355bc5f https://github.com/NVIDIA/NV-Kernels 24.04_linux-nvidia-6.17-next)
[fenghuay:
  - Resolve minor conflicts in `drivers/resctrl/mpam_resctrl.c`;
]
Signed-off-by: Fenghua Yu <fenghuay@nvidia.com>
When there are not enough monitors, MPAM is able to emulate ABMC by making
a smaller number of monitors assignable. These monitors still need to be
allocated from the driver, and mapped to whichever control/monitor group
resctrl wants to use them with.
Add a second array to hold the monitor values indexed by resctrl's
cntr_id.
When CDP is in use, two monitors are needed so the available number of
counters halves. Platforms witih one monitor will have zero monitors
when CDP is in use.

Signed-off-by: James Morse <james.morse@arm.com>
(forward ported from commit d8a0ad3 https://github.com/NVIDIA/NV-Kernels 24.04_linux-nvidia-6.17-next)
[fenghuay:
  - Resolve minor conflicts in `drivers/resctrl/mpam_resctrl.c`;
  - Report returned value from mpam_resctrl_monitor_init_abmc();
]
Signed-off-by: Fenghua Yu <fenghuay@nvidia.com>
…ABMC use

ABMC has a helper resctrl_arch_config_cntr() for changing the mapping
between 'cntr_id' and a CLOSID/RMID pair.
Add the helper.
For MPAM this is done by updating the mon->mbwu_idx_to_mon[] array,
and as usual CDP means it needs doing in three different ways.

Signed-off-by: James Morse <james.morse@arm.com>
(cherry picked from commit ce6ad9d https://github.com/NVIDIA/NV-Kernels 24.04_linux-nvidia-6.17-next)
[fenghuay:
- Remove empty definition of resctrl_arch_config_cntr()
- Resolve struct rdt_l3_mon_domain parameter in resctrl_arch_config_cntr()
]
Signed-off-by: Fenghua Yu <fenghuay@nvidia.com>
…sctrl_arch_reset_rmid()

resctrl uses resctrl_arch_rmid_read() to read counters. CDP emulation
means the counter may need reading in three different ways. The same
goes for reset.
The helpers behind the resctrl_arch_ functions will be re-used for the
ABMC equivalent functions.
Add the rounding helper for checking monitor values while we're here.

Signed-off-by: James Morse <james.morse@arm.com>
(cherry picked from commit d45ffcb https://github.com/NVIDIA/NV-Kernels 24.04_linux-nvidia-6.17-next)
[fenghuay:
  - resctrl_arch_round_mon_val() has been defined in upstream. No need to re-define it here;
  - Resolve minor conflicts in `drivers/resctrl/mpam_resctrl.c`;
]
Signed-off-by: Fenghua Yu <fenghuay@nvidia.com>
…trl_arch_reset_cntr()

When used in ABMC mode, resctrl uses a different set of helpers to
read and reset the counters.
Add these.

Signed-off-by: James Morse <james.morse@arm.com>
(cherry picked from commit 81af700 https://github.com/NVIDIA/NV-Kernels 24.04_linux-nvidia-6.17-next)
[fenghuay:
- Remove empty definitions of resctrl_arch_cntr_read() and
  resctrl_arch_reset_cntr()
- Resolve struct rdt_l3_mon_domain parameter in resctrl_arch_cntr_read() and
  resctrl_arch_reset_cntr()
]
Signed-off-by: Fenghua Yu <fenghuay@nvidia.com>
Add the required hook to pre-round a userspace memory bandwidth
allocation percentage value to a value acceptable to the driver backend.
For MPAM, no rounding is needed because the driver has all the
information necessary for rounding the value when
resctrl_arch_update_one() is called.
So, just "round" the value to itself here.

Signed-off-by: Dave Martin <Dave.Martin@arm.com>
Signed-off-by: James Morse <james.morse@arm.com>
(cherry picked from commit 935611d https://github.com/NVIDIA/NV-Kernels 24.04_linux-nvidia-6.17-next)
[fenghuay:
  - Resolve minor conflicts in `include/linux/arm_mpam.h`;
]
Signed-off-by: Fenghua Yu <fenghuay@nvidia.com>
…arch

The control value parser for the MB resource currently coerces the
memory bandwidth percentage value from userspace to be an exact
multiple of the bw_gran parameter.
On MPAM systems, this results in somewhat worse-than-worst-case
rounding, since bw_gran is in general only an approximation to the
actual hardware granularity, and the hardware bandwidth allocation
control value is not natively a percentage.
Allow the arch to provide its own conversion that is appropriate for
the hardware, and move the existing conversion to x86.  This will avoid
accumulated error from rounding the value twice on MPAM systems.
Clarify the documentation, but avoid overly exact promises.
Clamping to bw_min and bw_max still feels generic: leave it in the core
code, for now.
No functional change.

Signed-off-by: Dave Martin <Dave.Martin@arm.com>
Signed-off-by: James Morse <james.morse@arm.com>
(cherry picked from commit cabdc68 https://github.com/NVIDIA/NV-Kernels 24.04_linux-nvidia-6.17-next)
Signed-off-by: Fenghua Yu <fenghuay@nvidia.com>
…isable monitor overflow

Resctrl has an overflow handler that runs on each domain every second
to ensure that any overflow of the hardware counter is accounted for.
MPAM can have counters as large as 63 bits, in which case there is no
need to check for overflow.
To allow other architectures to disable this, add a helper that reports
whether counters can overflow.

Signed-off-by: James Morse <james.morse@arm.com>
(cherry picked from commit 6a4360b https://github.com/NVIDIA/NV-Kernels 24.04_linux-nvidia-6.17-next)
Signed-off-by: Fenghua Yu <fenghuay@nvidia.com>
…n overflow

Resctrl has an overflow handler that runs on each domain every second
to ensure that any overflow of the hardware counter is accounted for.
MPAM can have counters as large as 63 bits, in which case there is no
need to check for overflow.
To allow the overflow handler to be disabled, determine if an overflow
can happen. If a class is not implemented, or has the 63bit counter,
it can't overflow.

Signed-off-by: James Morse <james.morse@arm.com>
(cherry picked from commit 0f6aefd https://github.com/NVIDIA/NV-Kernels 24.04_linux-nvidia-6.17-next)
[fenghuay:
  - Resolve minor conflicts in `drivers/resctrl/mpam_resctrl.c`;
]
Signed-off-by: Fenghua Yu <fenghuay@nvidia.com>
Resctrl has an overflow handler that runs on each domain every second
to ensure that any overflow of the hardware counter is accounted for.
MPAM can have counters as large as 63 bits, in which case there is no
need to check for overflow.
Call the new arch helpers to determine this.

Signed-off-by: James Morse <james.morse@arm.com>
(cherry picked from commit 72e375a https://github.com/NVIDIA/NV-Kernels 24.04_linux-nvidia-6.17-next)
Signed-off-by: Fenghua Yu <fenghuay@nvidia.com>
mpam_reprogram_ris_partid() always resets the CMAX/CMIN controls to their
'unrestricted' value.
This prevents the controls from being configured.
Add fields in struct mpam_config, and program these values when they
are set in the features bitmask.

Signed-off-by: James Morse <james.morse@arm.com>
(cherry picked from commit e701b28 https://github.com/NVIDIA/NV-Kernels 24.04_linux-nvidia-6.17-next)
[fenghuay:
  - Resolve minor conflicts in `drivers/resctrl/mpam_devices.c`;
  - Resolve minor conflicts in `drivers/resctrl/mpam_internal.h`;
]
Signed-off-by: Fenghua Yu <fenghuay@nvidia.com>
…re-use

Functions like mbw_max_to_percent() convert a value into MPAMs 16 bit
fixed point fraction format. These are not only used for memory
bandwidth, but cache capcity controls too.
Rename these functions to convert to/from a 'fract16', and add
helpers for the specific mbw_max/cmax controls.

Signed-off-by: James Morse <james.morse@arm.com>
(cherry picked from commit 738f160 https://github.com/NVIDIA/NV-Kernels 24.04_linux-nvidia-6.17-next)
[fenghuay:
  - Resolve minor conflicts in `drivers/resctrl/mpam_resctrl.c`;
  - Resolve minor conflicts in `drivers/resctrl/test_mpam_resctrl.c`;
]
Signed-off-by: Fenghua Yu <fenghuay@nvidia.com>
… separate struct

struct resctrl_membw combines parameters that are related to the control
value, and parameters that are specific to the MBA resource.
To allow the control value parsing and management code to be re-used for
other resources, it needs to be separated from the MBA resource.
Add struct resctrl_mba that holds all the parameters that are specific
to the MBA resource.

Signed-off-by: James Morse <james.morse@arm.com>
(cherry picked from commit c113346 https://github.com/NVIDIA/NV-Kernels 24.04_linux-nvidia-6.17-next)
Signed-off-by: Fenghua Yu <fenghuay@nvidia.com>
parse_cbm() and parse_bw() both test the staged config for an existing
entry. These would indicate user-space has provided a schema with a
duplicate domain entry. e.g:
| L3:0=ffff;1=f00f;0=f00f
If new parsers are added this duplicate domain test has to be duplicated.
Move it to the caller.

Signed-off-by: James Morse <james.morse@arm.com>
(cherry picked from commit 827c80b https://github.com/NVIDIA/NV-Kernels 24.04_linux-nvidia-6.17-next)
[fenghuay:
  - Resolve minor conflicts in `fs/resctrl/ctrlmondata.c`;
]
Signed-off-by: Fenghua Yu <fenghuay@nvidia.com>
…nstead of parse_bw()

MBA is only supported on platforms where the delay inserted by the control
is linear. Resctrl checks the two properties provided by the arch code
match each time it parses part of a new control value.
This doesn't need to be done so frequently, and obscures changes to
parse_bw() to abstract it for use with other control types.
Move this check to the parse_line() caller so it only happens once.

Signed-off-by: James Morse <james.morse@arm.com>
(cherry picked from commit 85be43b https://github.com/NVIDIA/NV-Kernels 24.04_linux-nvidia-6.17-next)
Signed-off-by: Fenghua Yu <fenghuay@nvidia.com>
…de resource

resctrl_get_default_ctrl() is called by both the architecture code and
filesystem code to return the default value for a control. This depends
on the schema format.
parse_bw() doesn't bother checking the bounds it is given if the
resource is in use by mba_sc. This is because the values parsed from
user-space are not the same as those the control should take.
To make this disparity easier to work with, a second different copy
of the schema format is needed, which would need a version of
resctrl_get_default_ctrl(). This would let the resctrl change the
schema format presented to user-space, provided it converts it to match
what the architecture code expects.
Rename resctrl_get_default_ctrl() to make it clear it returns the
resource default.

Signed-off-by: James Morse <james.morse@arm.com>
(cherry picked from commit a4ba73c https://github.com/NVIDIA/NV-Kernels 24.04_linux-nvidia-6.17-next)
[fenghuay:
  - Resolve minor conflicts in `drivers/resctrl/mpam_resctrl.c`;
]
Signed-off-by: Fenghua Yu <fenghuay@nvidia.com>
…g it to be different

parse_bw() doesn't bother checking the bounds it is given if the
resource is in use by mba_sc. This is because the values parsed from
user-space are not the same as those the control should take.
To make this disparity easier to work with, a second different copy
of the schema format is needed, which would need a version of
resctrl_get_default_ctrl(). This would let the resctrl change the
schema format presented to user-space, provided it converts it to match
what the architecture code expects.
Add a second schema format for use with mba_sc. The membw properties
are copied and the schema version is used. When mba_sc is enabled
the schema copy of these properties is modified.

Signed-off-by: James Morse <james.morse@arm.com>
(cherry picked from commit 225d28e https://github.com/NVIDIA/NV-Kernels 24.04_linux-nvidia-6.17-next)
[fenghuay:
  - Resolve minor conflicts in `fs/resctrl/ctrlmondata.c`;
  - Resolve minor conflicts in `include/linux/arm_mpam.h`;
]
Signed-off-by: Fenghua Yu <fenghuay@nvidia.com>
Resctrl allows the architecture code to specify the schema format for a
control. Controls can either take a bitmap, or some kind of number.
If user-space doesn't know what a control is by its name, it could be
told the schema format. 'Some kind of number' isn't useful as the
difference between a percentage and a value in MB/s affects how these
would be programmed, even if resctrl's parsing code doesn't need to
care.
Add the types resctrl already has in addition to 'range'. This
allows architectures to move over before 'range' is removed. These
new schema formats are parsed the same, but will additionally affect
which files are visible.
Schema formats with a double underscore should not be considered
portable between architectures, and are likely to be described to
user-space as 'platform defined'. AMDs MBA resource is configured
with an absolute bandwidth measured in multiples of one eighth of
a GB per second. resctrl needs to be aware of this platform
defined format to ensure the existing 'MB' files continue to be
shown.

Signed-off-by: James Morse <james.morse@arm.com>
(cherry picked from commit bb81e48 https://github.com/NVIDIA/NV-Kernels 24.04_linux-nvidia-6.17-next)
Signed-off-by: Fenghua Yu <fenghuay@nvidia.com>
Resctrl specifies the schema format for MB and SMBA in rdt_resources_all[].
Intel platforms take a percentage for MB, AMD platforms take an absolute
value which isn't MB/s. Currently these are both treated as a 'range'.
Adding support for additional types of control shows that user-space
needs to be told what the control formats are. Today users of resctrl
must already know if their platform is Intel or AMD to know how the
MB resource will behave.
The MPAM support exposes new control types that take a 'percentage'.
The Intel MB resource is also configured by a percentage, so should be
able to expose this to user-space.
Remove the static configuration for schema_fmt in rdt_resources_all[]
and specify it with the other control properties in
__get_mem_config_intel() or __get_mem_config_amd().

Signed-off-by: James Morse <james.morse@arm.com>
(cherry picked from commit 3323499 https://github.com/NVIDIA/NV-Kernels 24.04_linux-nvidia-6.17-next)
[fenghuay:
  - Resolve minor conflicts in `arch/x86/kernel/cpu/resctrl/core.c`;
]
Signed-off-by: Fenghua Yu <fenghuay@nvidia.com>
…tmap controls

MPAM has cache capacity controls that effectively take a percentage.
Resctrl supports percentages, but the collection of files that are
exposed to describe this control belong to the MB resource.
To find the minimum granularity of the percentage cache capacity controls,
user-space is expected to rad the banwdidth_gran file, and know this has
nothing to do with bandwidth.
The only problem here is the name of the file. Add duplicates of these
properties with percentage and bitmap in the name. These will be exposed
based on the schema format.
The existing files must remain tied to the specific resources so that
they remain visible to user-space. Using the same helpers ensures the
values will always be the same regardless of the file used.
These files are not exposed until the new RFTYPE schema flags are
set on a resource 'fflags'.

Signed-off-by: James Morse <james.morse@arm.com>
(cherry picked from commit a38c116 https://github.com/NVIDIA/NV-Kernels 24.04_linux-nvidia-6.17-next)
[fenghuay:
  - Resolve minor conflicts in `fs/resctrl/internal.h`;
]
Signed-off-by: Fenghua Yu <fenghuay@nvidia.com>
…n schema format

MPAM has cache capacity controls that effectively take a percentage.
Resctrl supports percentages, but the collection of files that are
exposed to describe this control belong to the MB resource. New files
have been added that are selected based on the schema format.
Apply the flags to enable these files based on the schema format.
Add a new fflags_from_schema() that is used for controls.

Signed-off-by: James Morse <james.morse@arm.com>
(cherry picked from commit db00568 https://github.com/NVIDIA/NV-Kernels 24.04_linux-nvidia-6.17-next)
[fenghuay:
  - Resolve minor conflicts in `fs/resctrl/rdtgroup.c`;
]
Signed-off-by: Fenghua Yu <fenghuay@nvidia.com>
If more schemas are added to resctrl, user-space needs to know how to
configure them. To allow user-space to configure schema it doesn't know
about, it would be helpful to tell user-space the format, e.g. percentage.
Add a file under info that describes the schema format.
Percentages and 'mbps' are implicitly decimal, bitmaps are expected to be
in hex.

Signed-off-by: James Morse <james.morse@arm.com>
(forward ported from commit f0ae691 https://github.com/NVIDIA/NV-Kernels 24.04_linux-nvidia-6.17-next)
[fenghuay:
  - Resolve minor conflicts in `fs/resctrl/rdtgroup.c`;
  - Add RESCTRL_SCHEMA_RANGE in resctrl_schema_format_show();
]
Signed-off-by: Fenghua Yu <fenghuay@nvidia.com>
MPAM can have both cache portion and cache capacity controls on any cache
that supports MPAM. Cache portion bitmaps can be exposed via resctrl if
they are implemented on L2 or L3.
The cache capacity controls can not be used to isolate portions, which is
in implicit in the L2 or L3 bitmap provided by user-space. These controls
need to be configured with something more like a percentage.
Add the resource enum entries for these two resources. No additional
resctrl code is needed because the architecture code will specify this
resource takes a 'percentage', re-using the support previously used only
for the MB resource.

Signed-off-by: James Morse <james.morse@arm.com>
(cherry picked from commit 2e9f961 https://github.com/NVIDIA/NV-Kernels 24.04_linux-nvidia-6.17-next)
[fenghuay:
  - Resolve minor conflicts in `include/linux/resctrl.h`;
]
Signed-off-by: Fenghua Yu <fenghuay@nvidia.com>
…m cmax

MPAM's maximum cache-capacity controls take a fixed point fraction format.
Instead of dumping this on user-space, convert it to a percentage.
User-space using resctrl already knows how to handle percentages.

Signed-off-by: James Morse <james.morse@arm.com>
(cherry picked from commit 10caa12 https://github.com/NVIDIA/NV-Kernels 24.04_linux-nvidia-6.17-next)
[fenghuay:
  - Resolve minor conflicts in `drivers/resctrl/mpam_resctrl.c`;
]
Signed-off-by: Fenghua Yu <fenghuay@nvidia.com>
… domain setup

The current MPAM driver only considers the first component associated
with an online/offline CPU during domain creation and teardown. This
is insufficient, as CPU-initiated traffic may traverse multiple MSCs
before reaching the target, and each MSC must be programmed consistently
for proper resource partitioning.

Update the MPAM driver to include all components associated with a
given CPU during domain setup/teardown to expose expected schemata
to userspace for effective resource control.

Signed-off-by: Shanker Donthineni <sdonthineni@nvidia.com>
(forward ported from commit ac1e5be https://github.com/NVIDIA/NV-Kernels 24.04_linux-nvidia-6.17-next)
[fenghuay:
  - Leaves drivers/resctrl/mpam_internal.h untouched; mpam_resctrl_offline_cpu()
    is already void in the baseline used here.
  - Tightens callers (mpam_resctrl_pick_mba, mpam_resctrl_pick_counters) around
    traffic_matches_l3() together with topology_matches_l3() and
    cpumask_equal(&class->affinity, cpu_possible_mask) and does not add a
    traffic_matches_l3() function body here, which is already defined in
    upstream.
  - Omits any edit to exposed_alloc_capable or exposed_mon_capable; those
    symbols are already absent from the baseline in favor of
    resctrl_arch_alloc_capable() / resctrl_arch_mon_capable().
  - Does not add MPAM_MAX_EVENT or a
    new for_each_mpam_resctrl_mon() / mpam_resctrl_counters[] sizing hunk
    because that monitor macro and array shape are already in the baseline.
  - Omits INIT_LIST_HEAD_RCU() on res->resctrl_res.ctrl_domains and
    mon_domains, omits moving mpam_resctrl_domain_insert() after
    resctrl_online_*(), and omits adding static void
    mpam_resctrl_online_domain_hdr(); that list setup and insert ordering are
    already in the baseline.
  - Does not replay a void->int conversion for mpam_resctrl_monitor_init() or a
    mpam_pmg_max + 1 num_rmid path; the baseline already has int-returning
    mpam_resctrl_monitor_init() and resctrl_arch_system_num_rmid_idx() for
    num_rmid, so only surrounding line context shifts in this file.
  - Adds mpam_resctrl_mon_from_res() / mpam_resctrl_res_from_mon(),
    mpam_resctrl_monitor_sync_abmc_vals(struct
    rdt_resource *r), extends mpam_resctrl_alloc_domain() /
    mpam_resctrl_get_domain_from_cpu() / mpam_resctrl_get_mon_domain_from_cpu()
    with struct mpam_component *comp, hardens topology_matches_l3() with
    matched_once, switches resctrl_arch_mbm_cntr_assign_enabled() to use
    mon->assigned_counters, and extends mpam_resctrl_pick_domain_id() so
    memory level > 3 uses component IDs like cache-backed classes]
  - Modify matched_once and cpu checking in topology_matches_l3() to
    have a better error handling;
  - Drop cpumask_copy() in mpam_ris_get_affinity(). class->level > 3 is
    not supported on Grace.
]
Signed-off-by: Fenghua Yu <fenghuay@nvidia.com>
…onfig

Reset an RIS by building a default mpam_config and applying it via
mpam_reprogram_ris_partid(), like any other config.

- mpam_init_reset_cfg(): set features and default values only for
  controls supported by the RIS (cpor_part, mbw_part, mbw_max,
  mbw_prop, cmax_cmax, cmax_cmin). Use full masks for CPBM/MBW_PBM
  and MPAMCFG_* defaults for MBW_MAX, CMAX, CMIN.
- mpam_reprogram_ris_partid(): apply cfg for all supported controls
  (no separate reset path).

Signed-off-by: Shanker Donthineni <sdonthineni@nvidia.com>
(forward ported from commit e0b6de0 https://github.com/NVIDIA/NV-Kernels 24.04_linux-nvidia-6.17-next)
[fenghuay:
  - reset_cpbm and reset_mbw_pbm are not used. no need to define them;
  - Resolve minor conflicts in `drivers/resctrl/mpam_devices.c`;
  - Since mpam_init_reset_cfg() has been removed from upstream,
    reset_cfg is init in mpam_reprogram_ris_partid(&reset_cfg);
]
Signed-off-by: Fenghua Yu <fenghuay@nvidia.com>
Add local bytes counter in mpam_resctrl_counters[] to fix missing
mbm_local_bytes monitoring on Grace.

Add mon->assigned_counters check to enable mbm_L3_assignments config
file on Grace.

Signed-off-by: Fenghua Yu <fenghuay@nvidia.com>
@fyu1 fyu1 force-pushed the 26.04_linux-nvidia.glue branch from 673d4c3 to c290cca Compare May 29, 2026 02:40
@nvmochs
Copy link
Copy Markdown
Collaborator

nvmochs commented May 29, 2026

@fyu1

Thanks for addressing my previous issues.


d7c3069 - NVIDIA: SAUCE: resctrl/mpam: reset RIS by applying explicit default config

One other question on the reset-RIS patch: the note says reset_cfg is initialized in mpam_reprogram_ris_partid(), but I don’t see it actually being initialized there. mpam_reset_ris() passes an empty:

  struct mpam_config reset_cfg = {};

and mpam_reprogram_ris_partid() relies on missing cfg feature bits to take reset/default paths.

Most controls look okay with that model, but MBW_PBM looks different:

  if (mpam_has_feature(mpam_feat_mbw_part, rprops)) {
          if (mpam_has_feature(mpam_feat_mbw_part, cfg))
                  mpam_reset_msc_bitmap(msc, MPAMCFG_MBW_PBM, rprops->mbw_pbm_bits);
          else
                  mpam_write_partsel_reg(msc, MBW_PBM, cfg->mbw_pbm);
  }

With an empty reset_cfg, that appears to write cfg->mbw_pbm == 0 rather than a full reset mask. Is mpam_feat_mbw_part/MBW_PBM also unsupported on the target platforms? If so, can you update the backport note to say that explicitly?
Otherwise I think this may need a code adjustment to preserve the source reset behavior.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

help wanted Extra attention is needed pending_review_comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

10 participants