Skip to content

[26.04_linux-nvidia-bos] MPAM update - #543

Open
ltrager wants to merge 94 commits into
NVIDIA:26.04_linux-nvidia-bosfrom
ltrager:7.0-mpam-update
Open

[26.04_linux-nvidia-bos] MPAM update#543
ltrager wants to merge 94 commits into
NVIDIA:26.04_linux-nvidia-bosfrom
ltrager:7.0-mpam-update

Conversation

@ltrager

@ltrager ltrager commented Aug 12, 2026

Copy link
Copy Markdown
Collaborator

Overview

When backporting MPAM to the linux-nvidia-6.18 kernel I took the latest MPAM/resctrl patch series from LORE and Linus's tree. This left linux-nvidia-6.18-next with newer MPAM/resctrl support than 26.04_linux-nvidia-bos. This PR updates 26.04_linux-nvidia-bos MPAM/resctrl support to mirror what is in linux-nvidia-6.18-next, while retaining the required BOS-specific integration changes.

I have not yet created a bug on launchpad yet as I'd like to get feedback as to whether we want to proceed or not.

Updated Patch Series

Series Changes
arm_mpam: Add MPAM-Fb firmware support v9 Updates the MPAM-Fb support to the complete 12-patch v9 series. Nine patches match LORE directly. Three were adapted to preserve BOS MAX/HARDLIM probing, MBW_PBM/CMAX/CMIN programming, and downstream programming-error handling in the threaded IRQ conversion.
arm_mpam: resctrl: Counter Assignment (ABMC) v5 Replaces the older Arm ABMC implementation with the five-patch v5 series and refreshes the associated ABMC/CDP KUnit coverage. The obsolete free-running-monitor and RMID-hook implementations are absorbed by the v5 design.

New Patch Series

New patch series applied to resolve conflicts with updated series

Subject Source
x86,fs/resctrl: Pave the way for MPAM counter assignment v7 Adds all seven generic resctrl prerequisites using their final commits from Linus’s tree.
fs/resctrl: IOMMU group fixes for tasks interface and cleanup v2 Adds all three v2 fixes for PID parsing, helper cleanup, and IOMMU-group migration when resctrl groups are removed.
KVM: arm64: Force guest EL1 to use user-space's partid configuration 67faed4ccb4f
arm_mpam: Update architecture version check for MPAM MSC 50a42e03cdbd
arm_mpam: Fix MPAMCFG_MBW_PBM register setting 021118ce5ea9

Patches now sourced from Linus's tree

  • 7625632fed43 — fs/resctrl: Tidy up the error path in resctrl_mkdir_event_configs()
  • 94a1206522d1 — x86,fs/resctrl: Create 'event_filter' files read only if they're not configurable
  • f52abe650241 — fs/resctrl: Disallow the software controller when MBM counters are assignable
  • ee3d4c81d89c — fs/resctrl: Add monitor property 'mbm_cntr_assign_fixed'
  • 3aec86e4ea01 — fs/resctrl: Continue counter allocation after failure
  • 9a1646211f8c — fs/resctrl: Document that automatic counter assignment is best effort
  • 1cfa74c683ea — fs/resctrl: Document tasks file behaviour for task id 0 and idle tasks

Reverted and Reapplied Patches

The older versions were reverted before replaying their replacements in dependency order. This avoids layering the newer series over overlapping BOS SAUCE implementations and makes the required conflict resolutions explicit.

Reverted functionality Reverted commit Reapplied commit
Apply T241-MPAM-6 to 63-bit counters 0f0f62d1cd92 62b5c4d7ec21
Fix mbm_L3_assign and mon_local_bytes 9d97d90c12bc 9343a4d7c69a
Add MBA max_lim sysfs support eb2a397ffd99 0375f48339eb
Probe MBW MAX_LIM and hardlim_rw 3f89f038d12e 497927a4144f
Reset RIS using the explicit default configuration 39c973a9670a 2c2b0824b283
Include associated MSC components during domain setup 3ce46c56e790 40878d018a1f
Avoid MSC teardown for software programming errors 7abd6df46f5e 68f7f93b2b89
Determine whether exposed counters can overflow 280d19355685 a4bdf5756702
Assign IOMMU groups to resctrl groups 69037f273891 37844a5cdb78
Add IOMMU QoS state helpers 9f1da5623808 e87d5188d3bd
Add SMMUv3 MPAM query and set helpers f1c8da0cfad3 98377e75e771
Register SMMU capabilities with MPAM 4bfc66310af1 2647763ba37e
Add the this_is_not_abi mount option 1bf2d6c7b578 57dc56521ca0
Allow an MSC to be forced to have an unknown location 5ddc3a894634 a94bee05d160
Allow the maximum PARTID to be overridden 7a882f69a85b 0694f0e9b3af
Split locking around the mon_sel registers 0d9b271e9466 e5a6b275c27c
Expose NRDY retry counts in debugfs 154491fb0815 17c6383eb1fb
Add the MSC/RIS debugfs hierarchy 56836799ed9a b65066184f81
Avoid the dom_data_exit() and rmid_ptrs[] race 4dee6626ad77 9176563c832a
Add ABMC counter read and reset hooks a639261dd308 bf6dfdc6ce01
Add resctrl_arch_config_cntr() for ABMC 77c4e9f9d629 3dd88e6bf668
Add ABMC/CDP KUnit coverage a199cc64eb18 fe2c2b28b50f
Pre-allocate assignable monitors 2d109004824f 6550788495fe
Pick MPAM classes for use as MBM counters eaff6c2bde68 a466792cdf0f

Testing

Built and ran on a Vera system. Greenlit passes all MPAM tests

nvidia@localhost:/home/nvidia/ltrager/greenlit$ sudo glt-test-suite --test-case arm64:test_mpam_resctrl_mount --test-case arm64:test_mpam_resctrl_schemata --test-case arm64:test_mpam_l3_occupancy --test-case arm64:test_mpam_mba_schemata --test-case arm64:test_mpam_resctrl_info
2026-08-11 19:09:32 - [INFO] glt-test-suite: ===== System Information =====
2026-08-11 19:09:32 - [INFO] glt-test-suite: Distribution: Ubuntu
2026-08-11 19:09:32 - [INFO] glt-test-suite: Release: 24.04
2026-08-11 19:09:32 - [INFO] glt-test-suite: Architecture: aarch64
2026-08-11 19:09:32 - [INFO] glt-test-suite: Kernel: 7.0.0-2017-nvidia-bos
2026-08-11 19:09:32 - [INFO] glt-test-suite: DMI:
2026-08-11 19:09:32 - [INFO] glt-test-suite: /sys/class/dmi/id/bios_date:Sat May 30 10:47:02 AM UTC 2026
2026-08-11 19:09:32 - [INFO] glt-test-suite: /sys/class/dmi/id/bios_vendor:NVIDIA
2026-08-11 19:09:32 - [INFO] glt-test-suite: /sys/class/dmi/id/bios_version:NV_SBIOS: 06.01.00.00, OEM_SBIOS: 06.01.00.00
2026-08-11 19:09:32 - [INFO] glt-test-suite: /sys/class/dmi/id/board_name:P3809-BMC
2026-08-11 19:09:32 - [INFO] glt-test-suite: /sys/class/dmi/id/board_serial:1331026110247
2026-08-11 19:09:32 - [INFO] glt-test-suite: /sys/class/dmi/id/board_vendor:NVIDIA
2026-08-11 19:09:32 - [INFO] glt-test-suite: /sys/class/dmi/id/board_version:C01
2026-08-11 19:09:32 - [INFO] glt-test-suite: /sys/class/dmi/id/chassis_serial:1942026270153
2026-08-11 19:09:32 - [INFO] glt-test-suite: /sys/class/dmi/id/chassis_type:28
2026-08-11 19:09:32 - [INFO] glt-test-suite: /sys/class/dmi/id/chassis_vendor:NVIDIA
2026-08-11 19:09:32 - [INFO] glt-test-suite: /sys/class/dmi/id/chassis_version:A.0
2026-08-11 19:09:32 - [INFO] glt-test-suite: /sys/class/dmi/id/ec_firmware_release:26.5
2026-08-11 19:09:32 - [INFO] glt-test-suite: /sys/class/dmi/id/modalias:dmi:bvnNVIDIA:bvrNV_SBIOS06.01.00.00,OEM_SBIOS06.01.00.00:bdSatMay30104702AMUTC2026:efr26.5:svnNVIDIA:pnVRNVL72:pvrA.0:rvnNVIDIA:rnP3809-BMC:rvrC01:cvnNVIDIA:ct28:cvrA.0:sku965-XXXXX-XXXX-XXX:pfaMGX:
2026-08-11 19:09:32 - [INFO] glt-test-suite: /sys/class/dmi/id/product_family:MGX
2026-08-11 19:09:32 - [INFO] glt-test-suite: /sys/class/dmi/id/product_name:VR NVL72
2026-08-11 19:09:32 - [INFO] glt-test-suite: /sys/class/dmi/id/product_serial:183XXXXXXXXXX
2026-08-11 19:09:32 - [INFO] glt-test-suite: /sys/class/dmi/id/product_sku:965-XXXXX-XXXX-XXX
2026-08-11 19:09:32 - [INFO] glt-test-suite: /sys/class/dmi/id/product_uuid:9385286f-53fa-9e88-475f-1a02676a0073
2026-08-11 19:09:32 - [INFO] glt-test-suite: /sys/class/dmi/id/product_version:A.0
2026-08-11 19:09:32 - [INFO] glt-test-suite: /sys/class/dmi/id/sys_vendor:NVIDIA
2026-08-11 19:09:32 - [INFO] glt-test-suite: /sys/class/dmi/id/uevent:MODALIAS=dmi:bvnNVIDIA:bvrNV_SBIOS06.01.00.00,OEM_SBIOS06.01.00.00:bdSatMay30104702AMUTC2026:efr26.5:svnNVIDIA:pnVRNVL72:pvrA.0:rvnNVIDIA:rnP3809-BMC:rvrC01:cvnNVIDIA:ct28:cvrA.0:sku965-XXXXX-XXXX-XXX:pfaMGX:
2026-08-11 19:09:32 - [INFO] glt-test-suite: ============================
2026-08-11 19:09:32 - [WARNING] glt-test-suite: Matching kernel perf binary is missing: /usr/lib/linux-tools/7.0.0-2017-nvidia-bos/perf; installed perf may not include events for the running kernel.
2026-08-11 19:09:32 - [WARNING] glt-test-suite: Linux source code is not in /usr/local/share/greenlit/linux.
2026-08-11 19:09:32 - [INFO] glt-test-suite: == Session /var/cache/greenlit/2026-08-11-19:09:32 started ==
2026-08-11 19:09:32 - [INFO] (arm64) test_mpam_resctrl_mount: resctrl already mounted at /sys/fs/resctrl; mount ability confirmed.
2026-08-11 19:14:02 - [INFO] glt-test-suite:
===========================================================

Summary:
  PASSED            : 5
  FAILED            : 0
  Allowed FAILURE   : 0
  SKIPPED           : 0
  WARNED            : 0

Details:
  [PASSED] arm64:test_mpam_resctrl_mount
  [PASSED] arm64:test_mpam_resctrl_schemata
  [PASSED] arm64:test_mpam_l3_occupancy
  [PASSED] arm64:test_mpam_mba_schemata
  [PASSED] arm64:test_mpam_resctrl_info

===========================================================
2026-08-11 19:14:02 - [INFO] glt-test-suite: == Session /var/cache/greenlit/2026-08-11-19:09:32 completed ==

@ltrager
ltrager requested a review from fyu1 August 12, 2026 01:08
@nirmoy nirmoy added the help wanted Extra attention is needed label Aug 12, 2026
@nirmoy

nirmoy commented Aug 12, 2026

Copy link
Copy Markdown
Collaborator

Boro watcher review skipped

The PR watcher skips automatic boro reviews for changes with more than 50 commits. This change currently has 94 commits.

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

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

Head: b7ad9aa2f1a6

This comment is maintained by BaseOS Reviewer. It is updated when the watcher sees a newer head.

@github-actions

github-actions Bot commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

PR Validation Report

Patchscan ✅ No Missing Fixes

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

PR Lint ❌ Errors found

Details
Checking 94 commits...

Cherry-pick digest:
┌──────────────┬──────────────────────────────────────────────────────────────────┬────────────┬─────────┬───────────────────────────┐
│ Local        │ Referenced upstream / Patch subject                              │ Patch-ID   │ Subject │ SoB chain                 │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ b7ad9aa2f1a6 │ [SAUCE] fs/resctrl: continue iommu group migration after errors  │ N/A        │ N/A     │ ltrager                   │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 5f5d363b1098 │ [SAUCE] arm_mpam: quiesce error irq before msc removal           │ N/A        │ N/A     │ ltrager                   │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 4a7d534f166e │ [SAUCE] arm_mpam: fix pcc channel lifetime during msc removal    │ N/A        │ N/A     │ ltrager, ltrager          │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 3c3e4cc8b33f │ [SAUCE] arm_mpam: resctrl: correct check that existing class is  │ N/A        │ N/A     │ horgan, ltrager           │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ b810f6939a9c │ [SAUCE] arm_mpam: initialize all of struct mon_read in mpam_rest │ N/A        │ N/A     │ horgan, ltrager           │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 25cd9ea64369 │ [SAUCE] arm_mpam: apply t241-mpam-6 to 63-bit counters           │ N/A        │ N/A     │ sdonthin, horgan, will, l │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ fae7ee0b2fda │ [SAUCE] arm_mpam: use __ris_msmon_read() for saving mbwu state   │ N/A        │ N/A     │ horgan, ltrager           │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 01bedcf9eda5 │ [SAUCE] fs/resctrl: fix iommu_group reference leaks when iterati │ N/A        │ N/A     │ ltrager, ltrager          │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ cbf0c4ca8ce4 │ [SAUCE] arm_mpam: ensure mbwu counters are reset on restore      │ N/A        │ N/A     │ horgan, ltrager           │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 329ed92121aa │ [SAUCE] fs/resctrl: fix redefinition of iommu helpers with confi │ N/A        │ N/A     │ ltrager, ltrager          │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 2ce3c7845643 │ [SAUCE] fs/resctrl: migrate iommu groups when removing resource  │ N/A        │ N/A     │ zengheng, ltrager         │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 22ca675b2c7e │ [SAUCE] fs/resctrl: remove unused 'of' parameter from rdtgroup_m │ N/A        │ N/A     │ zengheng, ltrager         │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 148918c08fd0 │ [SAUCE] fs/resctrl: fix incorrect pid parsing after iommu group  │ N/A        │ N/A     │ zengheng, ltrager         │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 531e32efd4c8 │ [SAUCE] arm_mpam: fix monitor capability and mbm assign for mb e │ N/A        │ N/A     │ fenghuay, bfigg, ltrager, │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 00c9780597c8 │ [SAUCE] fix mbm_l3_assign and mon_local_bytes                    │ N/A        │ N/A     │ fenghuay, bfigg, ltrager, │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ b1dfaeab8446 │ [SAUCE] arm_mpam: include all msc components during domain setup │ N/A        │ N/A     │ sdonthin, fenghuay, ltrag │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 3c43633c76b9 │ [SAUCE] resctrl: add mba max_lim sysfs and visibility from init  │ N/A        │ N/A     │ fenghuay, ltrager, ltrage │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ abec82ae9e17 │ [SAUCE] arm_mpam: resctrl: determine if any exposed counter can  │ N/A        │ N/A     │ morse, ltrager, ltrager   │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ c7a059df3a33 │ [SAUCE] arm_mpam: expose the number of nrdy retries in debugfs   │ N/A        │ N/A     │ morse, fenghuay, ltrager, │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 32979f7b7ffa │ [SAUCE] arm_mpam: add debugfs entries to show the msc/ris the dr │ N/A        │ N/A     │ morse, fenghuay, ltrager, │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 57c70c0a6159 │ [SAUCE] fs/resctrl: add support for assigning iommu_groups to re │ N/A        │ N/A     │ morse, ltrager, ltrager   │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 77054b28d678 │ [SAUCE] iommu: add helpers to get and set the qos state          │ N/A        │ N/A     │ morse, ltrager, ltrager   │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ bfef4b26f3ce │ [SAUCE] iommu/arm-smmu-v3: add mpam helpers to query and set sta │ N/A        │ N/A     │ morse, ltrager, ltrager   │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 7f7582bca93a │ [SAUCE] iommu/arm-smmu-v3: register smmu capabilities with mpam  │ N/A        │ N/A     │ morse, fenghuay, ltrager, │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ e8add4568f9d │ [SAUCE] arm_mpam: allow msc to be forced to have an unknown loca │ N/A        │ N/A     │ morse, fenghuay, ltrager, │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ ee73fa918d2b │ [SAUCE] fs/resctrl: add this_is_not_abi mount option             │ N/A        │ N/A     │ morse, fenghuay, ltrager, │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 8b9020bf6916 │ [SAUCE] arm_mpam: allow the maximum partid to be overridden from │ N/A        │ N/A     │ morse, fenghuay, ltrager, │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 0ffe9d30ba48 │ [SAUCE] fs/resctrl: avoid a race with dom_data_exit() and rmid_p │ N/A        │ N/A     │ morse, fenghuay, ltrager, │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 8a5e954af448 │ [SAUCE] arm_mpam: resctrl: add kunit test for abmc/cdp interacti │ N/A        │ N/A     │ morse, fenghuay, ltrager, │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 50e7128dcfa0 │ [SAUCE] arm64: mpam: add memory bandwidth usage (mbwu) documenta │ N/A        │ N/A     │ morse, horgan, will, ltra │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ f58268153198 │ [SAUCE] arm_mpam: resctrl: add resctrl_arch_cntr_read() & resctr │ N/A        │ N/A     │ morse, horgan, will, ltra │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 7f8069aadd7b │ [SAUCE] arm_mpam: resctrl: add resctrl_arch_config_cntr() for ab │ N/A        │ N/A     │ morse, horgan, will, ltra │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 56707cf8afab │ [SAUCE] arm_mpam: resctrl: pre-allocate assignable monitors      │ N/A        │ N/A     │ morse, horgan, will, ltra │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 110a3b303dcf │ [SAUCE] arm_mpam: resctrl: pick classes for use as mbm counters  │ N/A        │ N/A     │ morse, horgan, will, ltra │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ db27842dd5d2 │ 1cfa74c683ea fs/resctrl: Document tasks file behaviour for task  │ match      │ match   │ preserved + ltrager added │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 9841293686fb │ 9a1646211f8c fs/resctrl: Document that automatic counter assignm │ match      │ match   │ preserved + ltrager added │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 9508f6a0cf5c │ 3aec86e4ea01 fs/resctrl: Continue counter allocation after failu │ match      │ match   │ preserved + ltrager added │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 522adafe12df │ ee3d4c81d89c fs/resctrl: Add monitor property 'mbm_cntr_assign_f │ match      │ match   │ preserved + ltrager added │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 8ebacfabfb64 │ f52abe650241 fs/resctrl: Disallow the software controller when M │ match      │ match   │ preserved + ltrager added │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ eaa5c97f6363 │ 94a1206522d1 x86,fs/resctrl: Create 'event_filter' files read on │ match      │ match   │ preserved + ltrager added │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 81603074b81c │ 7625632fed43 fs/resctrl: Tidy up the error path in resctrl_mkdir │ match      │ match   │ preserved + ltrager added │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ fb31a8ba034c │ [SAUCE] arm_mpam: detect and enable mpam-fb pcc support          │ N/A        │ N/A     │ przywara, ltrager         │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 32fef9713612 │ [SAUCE] arm_mpam: change mpam-fb error irq to use a threaded irq │ N/A        │ N/A     │ przywara, ltrager         │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ e21a2c68512d │ [SAUCE] arm_mpam: avoid msc teardown for the sw programming erro │ N/A        │ N/A     │ sdonthin, fenghuay, ltrag │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 48b5dca9879b │ [SAUCE] arm_mpam: add mpam-fb msc firmware access support        │ N/A        │ N/A     │ przywara, ltrager         │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 76a2c53684fd │ [SAUCE] arm_mpam: prepare mon_sel locking for mpam-fb            │ N/A        │ N/A     │ przywara, ltrager         │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ de6167be7f13 │ [SAUCE] arm_mpam: propagate msc access errors for interrupt cont │ N/A        │ N/A     │ przywara, ltrager         │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 520e0ea461dc │ [SAUCE] arm_mpam: propagate msc access errors for mpam_reprogram │ N/A        │ N/A     │ przywara, ltrager         │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ be708ebd0abf │ 021118ce5ea9 arm_mpam: Fix MPAMCFG_MBW_PBM register setting      │ match      │ match   │ preserved + ltrager added │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ b09288406f2c │ [SAUCE] resctrl/mpam: reset ris by applying explicit default con │ N/A        │ N/A     │ sdonthin, fenghuay, bfigg │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ ab61e2318156 │ [SAUCE] arm_mpam: propagate msc access errors for state saving f │ N/A        │ N/A     │ przywara, ltrager         │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 5c81cd253d9e │ [SAUCE] arm_mpam: propagate msc access errors for __ris_msmon_re │ N/A        │ N/A     │ przywara, ltrager         │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ ae0abc8a3117 │ [SAUCE] arm_mpam: propagate msc access errors for msmon helpers  │ N/A        │ N/A     │ przywara, ltrager         │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 71d5f61a2fdb │ [SAUCE] arm_mpam: propagate msc access errors for mbwu counters  │ N/A        │ N/A     │ przywara, ltrager         │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 90802827615b │ [SAUCE] arm_mpam: propagate msc access errors for hw_probe funct │ N/A        │ N/A     │ przywara, ltrager         │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ a7449da03dc7 │ [SAUCE] resctrl/mpam: probe mpamf_mbw_idr max_lim and hardlim_rw │ N/A        │ N/A     │ fenghuay, ltrager, ltrage │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 100dc25cc7f7 │ [SAUCE] arm_mpam: let low level msc accessors return an error    │ N/A        │ N/A     │ przywara, ltrager         │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 8fe5c8a55115 │ 50a42e03cdbd arm_mpam: Update architecture version check for MPA │ match      │ match   │ preserved + ltrager added │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ edb2ebc3fd37 │ 67faed4ccb4f KVM: arm64: Force guest EL1 to use user-space's par │ match      │ match   │ preserved + ltrager added │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 8062de7ba962 │ [SAUCE] pci/msi: enable memory decoding before restoring msi-x m │ N/A        │ N/A     │ alifm, bhelgaas, ltrager  │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ da0fdffe43c1 │ [SAUCE] pci: fail flr when config space is inaccessible          │ N/A        │ N/A     │ alifm, bhelgaas, ltrager  │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 4fd97e21dea8 │ [SAUCE] pci: avoid saving config space state if inaccessible     │ N/A        │ N/A     │ alifm, bhelgaas, ltrager  │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 8d2384a39d1b │ [SAUCE] pci: allow per function pci slots to fix slot reset on s │ N/A        │ N/A     │ alifm, bhelgaas, ltrager  │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ a29d9960038d │ [SAUCE] pci: introduce pci_slot_placeholder constant for slot_nr │ N/A        │ N/A     │ alifm, bhelgaas, ltrager  │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 0dd0d680c5c9 │ [Revert] untested: arm_mpam: resctrl: pick classes for use as mb │ N/A        │ N/A     │ ltrager                   │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 73d86fc43ec3 │ [Revert] arm_mpam: resctrl: pre-allocate free running monitors   │ N/A        │ N/A     │ ltrager                   │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 450ba6cbc3b3 │ [Revert] arm_mpam: resctrl: pre-allocate assignable monitors     │ N/A        │ N/A     │ ltrager                   │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 518022a1e44c │ [Revert] arm_mpam: resctrl: add kunit test for abmc/cdp interact │ N/A        │ N/A     │ ltrager                   │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ a2fc01969ace │ [Revert] arm_mpam: resctrl: add resctrl_arch_config_cntr() for a │ N/A        │ N/A     │ ltrager                   │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ d95104cb3884 │ [Revert] arm_mpam: resctrl: add resctrl_arch_rmid_read() and res │ N/A        │ N/A     │ ltrager                   │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ dc0f5a90ad52 │ [Revert] arm_mpam: resctrl: add resctrl_arch_cntr_read() & resct │ N/A        │ N/A     │ ltrager                   │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 7761da285138 │ [Revert] fs/resctrl: avoid a race with dom_data_exit() and rmid_ │ N/A        │ N/A     │ ltrager                   │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 75773f290e7c │ [Revert] arm_mpam: add debugfs entries to show the msc/ris the d │ N/A        │ N/A     │ ltrager                   │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 92ca911f32ec │ [Revert] arm_mpam: expose the number of nrdy retries in debugfs  │ N/A        │ N/A     │ ltrager                   │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ d3b44af90747 │ [Revert] arm_mpam: split the locking around the mon_sel register │ N/A        │ N/A     │ ltrager                   │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 9e7ee821b441 │ [Revert] arm_mpam: allow the maximum partid to be overridden fro │ N/A        │ N/A     │ ltrager                   │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 7c839c4b8885 │ [Revert] arm_mpam: allow msc to be forced to have an unknown loc │ N/A        │ N/A     │ ltrager                   │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 06781f2e2b31 │ [Revert] fs/resctrl: add this_is_not_abi mount option            │ N/A        │ N/A     │ ltrager                   │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 6f1587ddcf5e │ [Revert] iommu/arm-smmu-v3: register smmu capabilities with mpam │ N/A        │ N/A     │ ltrager                   │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ c4aad6780efb │ [Revert] iommu/arm-smmu-v3: add mpam helpers to query and set st │ N/A        │ N/A     │ ltrager                   │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 1b57bf7af97f │ [Revert] iommu: add helpers to get and set the qos state         │ N/A        │ N/A     │ ltrager                   │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 097e679ba82d │ [Revert] fs/resctrl: add support for assigning iommu_groups to r │ N/A        │ N/A     │ ltrager                   │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 0570a92c0cc2 │ [Revert] arm_mpam: resctrl: determine if any exposed counter can │ N/A        │ N/A     │ ltrager                   │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 574f9666489a │ [Revert] arm_mpam: avoid msc teardown for the sw programming err │ N/A        │ N/A     │ ltrager                   │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 2fb9919ed462 │ [Revert] arm_mpam: include all associated msc components during  │ N/A        │ N/A     │ ltrager                   │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 2a59de3e9e97 │ [Revert] resctrl/mpam: reset ris by applying explicit default co │ N/A        │ N/A     │ ltrager                   │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ c32dba8af08a │ [Revert] resctrl/mpam: probe mpamf_mbw_idr max_lim and hardlim_r │ N/A        │ N/A     │ ltrager                   │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 4bf7d2268ab3 │ [Revert] resctrl: add mba max_lim sysfs and visibility from init │ N/A        │ N/A     │ ltrager                   │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 7d5961431795 │ [Revert] fix mbm_l3_assign and mon_local_bytes                   │ N/A        │ N/A     │ ltrager                   │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ dc8f4b456457 │ [Revert] arm_mpam: apply t241-mpam-6 to 63-bit counters          │ N/A        │ N/A     │ ltrager                   │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 68d71f9f4c49 │ [Revert] pci/msi: enable memory decoding before restoring msi-x  │ N/A        │ N/A     │ ltrager                   │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ e56257630911 │ 9b0c3673c885 block: check bio split for unaligned bvec           │ match      │ match   │ preserved + jamien bfigg  │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ d42df40136b3 │ 9453bc6a69ef perf vendor events arm64: Fix Tegra410 Olympus even │ match      │ match   │ preserved + mochs bfigg a │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 9408943a7a66 │ 2d85e13c5526 perf vendor events arm64: fix swapped MetricGroup f │ match      │ match   │ preserved + mochs bfigg a │
└──────────────┴──────────────────────────────────────────────────────────────────┴────────────┴─────────┴───────────────────────────┘

Lint results:
W: f58268153198 ("arm_mpam: resctrl: Add resctrl_arch_cntr_read() & "): subject 75 chars (>72)
W: 8ebacfabfb64 ("fs/resctrl: Disallow the software controller when "): subject 77 chars (>72)
W: eaa5c97f6363 ("x86,fs/resctrl: Create 'event_filter' files read o"): subject 81 chars (>72)
W: a29d9960038d ("PCI: Introduce PCI_SLOT_PLACEHOLDER constant for s"): subject 74 chars (>72)
W: 9408943a7a66 ("perf vendor events arm64: fix swapped MetricGroup "): subject 84 chars (>72)
E: 25cd9ea64369 ("arm_mpam: Apply T241-MPAM-6 to 63-bit counters"): not SAUCE/UBUNTU/Revert but has no upstream reference trailer (cherry picked from commit ... or backported from ...)
E: 50e7128dcfa0 ("arm64: mpam: Add memory bandwidth usage (MBWU) doc"): not SAUCE/UBUNTU/Revert but has no upstream reference trailer (cherry picked from commit ... or backported from ...)
E: f58268153198 ("arm_mpam: resctrl: Add resctrl_arch_cntr_read() & "): not SAUCE/UBUNTU/Revert but has no upstream reference trailer (cherry picked from commit ... or backported from ...)
E: 7f8069aadd7b ("arm_mpam: resctrl: Add resctrl_arch_config_cntr() "): not SAUCE/UBUNTU/Revert but has no upstream reference trailer (cherry picked from commit ... or backported from ...)
E: 56707cf8afab ("arm_mpam: resctrl: Pre-allocate assignable monitor"): not SAUCE/UBUNTU/Revert but has no upstream reference trailer (cherry picked from commit ... or backported from ...)
E: 110a3b303dcf ("arm_mpam: resctrl: Pick classes for use as MBM cou"): not SAUCE/UBUNTU/Revert but has no upstream reference trailer (cherry picked from commit ... or backported from ...)
E: 8062de7ba962 ("PCI/MSI: Enable memory decoding before restoring M"): not SAUCE/UBUNTU/Revert but has no upstream reference trailer (cherry picked from commit ... or backported from ...)
E: da0fdffe43c1 ("PCI: Fail FLR when config space is inaccessible"): not SAUCE/UBUNTU/Revert but has no upstream reference trailer (cherry picked from commit ... or backported from ...)
E: 4fd97e21dea8 ("PCI: Avoid saving config space state if inaccessib"): not SAUCE/UBUNTU/Revert but has no upstream reference trailer (cherry picked from commit ... or backported from ...)
E: 8d2384a39d1b ("PCI: Allow per function PCI slots to fix slot rese"): not SAUCE/UBUNTU/Revert but has no upstream reference trailer (cherry picked from commit ... or backported from ...)
E: a29d9960038d ("PCI: Introduce PCI_SLOT_PLACEHOLDER constant for s"): not SAUCE/UBUNTU/Revert but has no upstream reference trailer (cherry picked from commit ... or backported from ...)

PR metadata:
E: PR targets 26.04_linux-nvidia-bos but body has no https://bugs.launchpad.net/... link

@fyu1

fyu1 commented Aug 12, 2026

Copy link
Copy Markdown
Collaborator

@ltrager, Is it worth to revert a lot of patches which have been tested by various groups to keep pace to upstream?

  1. arm_mpam: Add MPAM-Fb firmware support v9 is not supported on Nvidia platform.
  2. PBM is not supported on Nvidia platform.
  3. control assignment update is mainly cosmetic.
  4. others are mainly cosmetic changes.

@jamieNguyenNVIDIA

Copy link
Copy Markdown
Collaborator

Reviewed all 82 commits with Claude, one deep-dive pass per commit plus a
whole-series integration pass.

Downstream-only — introduced by this PR

1. 57dc56521ca0e drops the mount error-path cleanup.

The reverted 1bf2d6c7b5780 had two disable_abi_playground() calls; the
re-applied version has one. Missing from rdt_get_tree():

	if (ret && ctx->enable_abi_playground)
		disable_abi_playground();

The key is enabled before the first goto out, static_key_enable() is not
refcounted, and only rdt_kill_sb() disables it. So a failed mount -o this_is_not_abi (-EBUSY against an existing mount) latches
resctrl_abi_playground on for the boot, and a mount that never asked for it
starts accepting iommu_group:N in tasks. Nothing later restores the hunk.
Deliberate?

2. 2c2b0824b2838 moves the RIS reset off the width-aware bitmap helper.

The new mpam_init_reset_cfg() sets the feature bit, not just the value:

		mpam_set_feature(mpam_feat_mbw_part, reset_cfg);
		reset_cfg->mbw_pbm = GENMASK(props->mbw_pbm_bits - 1, 0);

so mpam_reprogram_ris_partid() now takes the single-u32 arm instead of
mpam_reset_msc_bitmap(). Previously mpam_reset_ris() passed
struct mpam_config reset_cfg = {} with no feature bits, taking the width-aware
path.

cpbm/mbw_pbm are one u32 each, but cpbm_wd is a 16-bit MPAMF_CPOR_IDR
field and mbw_pbm_bits comes from GENMASK(28, 16); cache_has_usable_cpor()
tests cpbm_wd <= 32 explicitly. Above 32 portions, are the upper words still
reset? At 65+, is GENMASK(wd - 1, 0) an out-of-range shift?

Two side notes on the same commit: the fract16_to_percent/percent_to_fract16
hunks are unrelated to the subject and unmentioned (they drop r->membw.min_bw
to 0, so bw_validate() accepts MB:0=0), and the changelog lists mbw_prop
among the defaulted controls with no mpam_feat_mbw_prop case present.

3. daa0489dc80b5 — the NRDY continue also skips the config capture.

cur_flt/cur_ctl are not invalidated by NRDY but get skipped anyway.
mbwu_state->enabled is written nowhere else and starts false, so after an
NRDY-skipped first save it stays false with MSMON_CFG_MBWU_CTL already written
0 — does mpam_restore_mbwu_state() leave the monitor disabled? The counter is
also read and zeroed before the test, so the sample is discarded rather than
deferred and correction never advances. The base has no NRDY handling in
mpam_save_mbwu_state() at all, so this is all new.

4. 8d82e5debf22brdt_move_group_iommus() aborts on the first error.

It breaks on the first per-group failure and all three callers discard the
return. In rmdir_all_sub() (from == NULL) the iommu_matches_rdtgroup()
filter is bypassed, so a group behind an SMMU without ARM_SMMU_FEAT_MPAM
returns -EIO and every later group keeps the stale PARTID/PMG — the state the
changelog says this removes. rdt_move_group_tasks(), which it says it mirrors,
has no abort path. It also lacks the resctrl_abi_playground gate the other two
iommu entry points carry.

In the MPAM-Fb v9 series — not yet in linux-next

drivers/resctrl/ in linux-next has no mpam_fb.c; this series exists only as
the lore posting, so these could go to Andre before v10 rather than being carried
as downstream deltas.

5. 52d30f1bd138c — nothing selects MAILBOX.

mpam_fb.o is unconditional in mpam-y and calls mbox_send_message(), which
needs CONFIG_MAILBOX and has no stub; the chain is ARM64_MPAM_DRIVER
select ACPI_MPAM if ACPI, a bare bool. arm64 allnoconfig +
CONFIG_ARM64_MPAM=y fails to link. Shipped config is fine (MAILBOX=y) —
select MAILBOX would close it.

6. 4218063d71143 — the PCC channel is freed while the error IRQ is live.

mpam_unregister_irqs() has one caller, mpam_disable().
mpam_msc_drv_remove() calls mpam_msc_destroy() + mpam_free_garbage(), which
runs pcc_mbox_free_channel() and kfree(pcc_chan) while the devm threaded
error IRQ is still registered — devres frees it only after .remove() returns,
and no suppress_bind_attrs blocks sysfs unbind. Can
__mpam_irq_handler()mpam_msc_read_esr() still reach msc->pcc_chan there?

The unbind gap itself is not new — mpam_msc_drv_remove() is byte-identical in
linux-next, so struct mpam_msc has the same exposure upstream. What v9 adds is
a second object freed in that window.

In linux-next — mailing list rather than this PR

Both are reproduced faithfully, so they are not backport defects.

7. a466792cdf0f2counter_update_class() tests the candidate, not the incumbent.

	if (existing_class) {
		if (class->level == 3) {
			pr_debug("Existing class is L3 - L3 wins\n");
			return;

The first test reads class while the debug string and the existing_class->level < class->level test below both mean the incumbent. An L3 candidate against a
level-255 memory incumbent keeps the memory class; reverse the order and L3 wins.
Which class backs mbm_total_bytes therefore follows firmware MPAM table order.
Identical in linux-next (436d111d918ae).

8. 3dd88e6bf6681mbwu_idx_to_mon[] is not keyed by domain.

Indexed by CDP-shifted closid and rmid only, ignoring @d, while resctrl
allocates counter ids per domain and exposes per-domain assignment via
mbm_L3_assignments. Unassigning in one domain reports "Unassigned" in all of
them, and a diverging counter id lets two groups share one hardware monitor.
Also in linux-next

@jamieNguyenNVIDIA

Copy link
Copy Markdown
Collaborator

@ltrager, Is it worth to revert a lot of patches which have been tested by various groups to keep pace to upstream?

  1. arm_mpam: Add MPAM-Fb firmware support v9 is not supported on Nvidia platform.
  2. PBM is not supported on Nvidia platform.
  3. control assignment update is mainly cosmetic.
  4. others are mainly cosmetic changes.

Yes, this does seem a bit risky -- and we're trading SAUCE for a-little-bit-newer SAUCE in many cases.

@ltrager

ltrager commented Aug 12, 2026

Copy link
Copy Markdown
Collaborator Author

Thanks for the review. The purpose of this PR is to bring the MPAM/resctrl patch stack in 26.04_linux-nvidia-bos into alignment with linux-nvidia-6.18-next. I noticed some discrepancy when I started to update the nvidia-kernel-patches-verification tool for the patches I added to linux-nvidia-6.18-next. I audited the differences between linux-nvidia-6.18-next, 26.04_linux-nvidia-bos, and this PR. Maintaining newer MPAM/resctrl support in the 6.18 reference kernel than in 26.04_linux-nvidia-bos, our preferred kernel, creates an avoidable difference between the two patch stacks.

Some apparently unrelated patches are source prerequisites for a conflict-free replay of the aligned stack:

  • Omitting MPAM-Fb entirely causes b65066184f81 ("arm_mpam: Add debugfs entries to show the MSC/RIS the driver discovered") to conflict because it expects the error-returning MSC accessor API introduced by the MPAM-Fb series. This source dependency exists even if MPAM-Fb is not used at runtime on NVIDIA hardware.
  • The PBM fix is required in the source stack. Omitting it causes the following error-propagation patch to conflict in mpam_reprogram_ris_partid() because that patch expects the corrected PBM branch orientation. It is also already in Linus's tree as 021118ce5ea9 and has the same patch ID as the copy in linux-nvidia-6.18-next. The path remains feature-gated, so this does not enable PBM on hardware that does not advertise it.
  • The counter-assignment update is also more than cosmetic: v5 changes the allocation model to per-MPAM-class counters and depends on the seven generic resctrl prerequisite commits now in Linus's tree. The remaining additions include functional KVM PARTID handling, architecture-version validation, IOMMU-group cleanup, reference-leak fixes, and MBWU state fixes.

I am fine dropping this PR but it will mean the linux-nvidia-6.18 reference kernel and patching guide will differ from 26.04_linux-nvidia-bos.

@ltrager

ltrager commented Aug 22, 2026

Copy link
Copy Markdown
Collaborator Author

I compared kernels built from 26.04_linux-nvidia-bos and this PR using the internal vera-perf-check tool. I ran the qualification suite three times on each kernel and averaged the results to reduce run-to-run noise. The same three tests failed consistently on both branches, with no PR-specific failures. Overall performance is effectively unchanged; the MPAM benchmarks trend slightly better, while the remaining benchmarks show only minor differences.

@clsotog

clsotog commented Aug 24, 2026

Copy link
Copy Markdown
Collaborator

Acked-by: Carol L Soto <[email protected]>

@jamieNguyenNVIDIA

Copy link
Copy Markdown
Collaborator

I re-reviewed the current 82-commit head (01cb4e9840ad) against the PR merge
base. The findings do not all have the same provenance: four are regressions
introduced by this refresh, two are incomplete or expanded fixes for
pre-existing behavior, and two were already present in the BOS branch.

Regressions introduced by this refresh

1. 3199f1b55b018 removes the failed-mount cleanup for
this_is_not_abi.

The merge base calls disable_abi_playground() when rdt_get_tree() fails;
the re-applied commit drops that cleanup. enable_abi_playground() runs before
the resctrl_mounted check and static_key_enable() is not refcounted. A second
mount -o this_is_not_abi therefore enables the global key and then returns
-EBUSY, causing the existing mount to accept and display IOMMU-group entries
and report the option even though it was not mounted with it. Please restore
the error-path disable.

2. 6a927ecb038eac truncates RIS reset bitmaps wider than 32 bits.

The base passes an empty struct mpam_config to
mpam_reprogram_ris_partid(), which selects the width-aware
mpam_reset_msc_bitmap() path. The new mpam_init_reset_cfg() sets the CPBM
and MBW_PBM feature bits and stores each bitmap in one u32, forcing the
single-register path. RIS widths are not clamped to 32 bits, and the retained
KUnit test models a 33-bit reset requiring two writes. Upper bitmap words can
therefore retain stale state. Please keep the width-aware reset path for these
controls.

3. 13ddf9f68db5bf leaves an MBWU monitor disabled when its saved value is
NRDY.

mpam_save_mbwu_state() reads cur_flt/cur_ctl, disables the monitor, reads
and zeros its counter, and then continues on NRDY before saving the
configuration, correction, or enabled state. On the first such save,
enabled remains false and mpam_restore_mbwu_state() skips the monitor; the
sample has also already been discarded. The base always saves the configuration
after disabling the monitor. Please preserve the configuration and enabled
state even when the counter sample is unusable.

4. 78cd82f7759f57 adds an undeclared CONFIG_MAILBOX dependency.

mpam_fb.o is linked unconditionally when ARM64_MPAM_DRIVER=y and calls
mbox_send_message(), which has no !CONFIG_MAILBOX stub. MPAM neither selects
nor depends on MAILBOX. I reproduced the resulting valid-config link failure
with arm64 allnoconfig plus CONFIG_ARM64_MPAM=y:

drivers/resctrl/mpam_fb.o: undefined reference to `mbox_send_message'

Enabling CONFIG_MAILBOX=y made the same vmlinux build pass. The Kconfig
dependency needs to be expressed.

Incomplete or expanded fixes for pre-existing behavior

5. e8f43c4fa58d6 only partially fixes stale IOMMU-group assignments.

The base does not migrate IOMMU groups during resctrl group removal, so the
underlying stale-assignment problem is pre-existing. The new helper improves
that behavior, but stops on the first per-group error while all three callers
discard its return and continue deleting the resctrl group and freeing its
RMID/CLOSID. During unmount, an unsupported or non-MPAM IOMMU group can fail
before later assigned groups, leaving those later groups with stale PARTID/PMG
values. Either migration must continue past per-group failures, or deletion must
honor the error instead of silently proceeding.

6. 01cb4e9840ad2 leaves the existing MSC/IRQ lifetime gap open and extends
it to the new PCC resource.

The base already frees struct mpam_msc from mpam_msc_drv_remove() while its
devm error IRQ is released only after .remove() returns. The refresh adds a
PCC channel reachable from that same IRQ path, and the final commit releases the
channel through mpam_free_garbage() without unregistering the IRQ first.
__mpam_irq_handler() can therefore race ordinary device removal or sysfs
unbind and access the freed msc or PCC channel. mpam_unregister_irqs() needs
to run before MSC/PCC destruction on the platform remove path.

Pre-existing in the BOS merge base

These are real issues, but they are not regressions caused by this refresh.
They should be fixed separately here or in their source series.

7. 7a7587de5b0e1 preserves the existing candidate/incumbent typo in
counter_update_class().

The function logs "Existing class is L3" but tests class->level == 3 instead
of existing_class->level == 3. An L3 candidate is discarded when a memory
class is already selected, making the backing class depend on firmware discovery
order. The same bug is present in the PR merge base and in the applied upstream
commit.

8. d6fe836e0374a preserves the existing domainless MBWU monitor mapping.

mbwu_idx_to_mon[] is keyed only by (closid, rmid), while counter assignments
are per rdt_l3_mon_domain; resctrl_arch_config_cntr() receives d but does
not use it when updating the mapping. Assigning or unassigning one domain can
therefore overwrite the hardware-monitor selection used by another domain. The
same global mapping already exists in the PR merge base and in the applied
upstream series.

Re-review coverage

All 82 current commits map to the previously reviewed series: 80 have identical
stable patch IDs. The other two are the revert/re-apply pair around
__check_limbo(); their changed lines are the same and only the newer base
context differs. A no-commit merge of the current target branch was clean,
git diff --check passed, and the merged arm64 vmlinux build passed with
CONFIG_MAILBOX=y.

@ltrager

ltrager commented Aug 31, 2026

Copy link
Copy Markdown
Collaborator Author

@jamieNguyenNVIDIA

1. 3199f1b55b018 removes the failed-mount cleanup for
this_is_not_abi.

Fixed in 16ce8427294d4. The failed-mount path now calls disable_abi_playground() after enabling this_is_not_abi. The resulting patch is patch-identical to the earlier version that contained the cleanup.

2. 6a927ecb038eac truncates RIS reset bitmaps wider than 32 bits.

This was a revert/reapply of 990f4e56511a, but the reapplication had accumulated additional reset-helper and CMAX/CMIN changes. I rewrote it as c9419e57dd0aa; its stable patch ID now exactly matches 990f4e56511a.

3. 13ddf9f68db5bf leaves an MBWU monitor disabled when its saved value is
NRDY.

Agreed. I removed the downstream NRDY/scaling/initialization workarounds and replaced those commit slots with Ben Horgan’s posted MPAM fixes 5–7: 7f6262e68213f, 0afd198267bea, and 486c04d8345f. They are adapted only for the current guard and error-return interfaces. val remains zero-initialized because __ris_msmon_read() accumulates into it.

4. 78cd82f7759f57 adds an undeclared CONFIG_MAILBOX dependency.

Confirmed and reported upstream against MPAM-Fb v9 patch 10/12. The missing dependency is present in the posted LKML patch and was not introduced by conflict resolution in this refresh. The Ubuntu kernel always enables CONFIG_MAILBOX so we are not affected.

5. e8f43c4fa58d6 only partially fixes stale IOMMU-group assignments.

I verified that 26.04_linux-nvidia-bos currently supports assigning IOMMU groups but does not migrate them at all when a resctrl group is removed. The imported migration patch, now fd33760096a73, improves that behavior, although its stop-on-first-error handling remains incomplete. Since this refresh is intended to track the latest LKML-posted series closely, I kept the posted patch unchanged. The continue-on-error behavior should be addressed separately in the source series.

6. 01cb4e9840ad2 leaves the existing MSC/IRQ lifetime gap open and extends it to the new PCC resource.

I verified that 26.04_linux-nvidia-bos already destroys struct mpam_msc during platform removal before its devm-managed error IRQ is released. The MPAM-Fb PCC work extends that existing lifetime gap to the PCC channel. The reviewed 01cb4e9840ad2 downstream follow-up is no longer present in the current revision.

7. 7a7587de5b0e1 preserves the existing candidate/incumbent typo in counter_update_class().

The carried ABMC v5 patch was not modified during this review; c6f0a1478d952 is patch-identical to its pre-review version. It differs from the older b072a22e6c35a implementation in 26.04_linux-nvidia-bos, although both contain the reported typo. The issue is now fixed separately by applying the exact posted follow-up as 813e9fd0e0d35.

8. d6fe836e0374a preserves the existing domainless MBWU monitor mapping.

The carried patch was not modified during this review. The current 19fdb9ba629d5 is patch-identical to upstream commit 6e0e538a75ce, and the same domainless mapping is present in 26.04_linux-nvidia-bos. This should be addressed separately in the source series rather than through a downstream change in this refresh.

@jamieNguyenNVIDIA

Copy link
Copy Markdown
Collaborator

Re-reviewed the current head (813e9fd0e0d3). Four of the eight items from the
previous round are fixed; four remain, and the reset commit has an additional
changelog/content problem. Their provenance differs: items 2 and 4 introduce
new failures into the target tree, item 3 is an incomplete but net-positive
source patch, and items 1 and 5 are already present in the merge base.

Two of the fixes are worth calling out as done properly rather than patched
over: counter_update_class() takes Ben Horgan's upstream patch rather than a
local edit, and the MBWU save path was rewritten to route through
__ris_msmon_read() instead of special-casing NRDY. I re-reviewed the rewrite
fresh: __ris_msmon_read() re-acquires mon_sel_lock, writes CFG_MON_SEL from
ctx->mon, and reads and clears reset_on_next_read while holding that lock.
The T241 scale quirk is also applied in the common read path, so dropping the
separate scale fix is consistent with this rewrite.

Already present in the merge base

1. c9419e57dd0aa no longer does what its changelog describes, and its
percentage conversions are not width-aware.

This commit is patch-identical to 990f4e56511a in the merge base, so neither
the conversion behavior nor the changelog mismatch is a net regression caused
by this PR. The conversion changes came from the older source patch; the stale
message and forward-port note are downstream adaptation problems that the
refresh replays unchanged.

Removing mpam_init_reset_cfg() fixed the bitmap-width regression from the
previous push. The commit message was not updated, however: its subject and
body still describe building an explicit reset configuration in
mpam_init_reset_cfg() and changing mpam_reprogram_ris_partid() to apply it.
That helper no longer exists. The actual reset-related change is one line that
adds a cached cmax default in mpam_reset_component_cfg().

The rest of the commit replaces fract16_to_percent() and
percent_to_fract16() with formulas that never use their wd argument. This
contradicts the surrounding comments: only the upper wd bits are implemented,
the lower bits are ignored, and each value denotes one of 1 << wd bands. It
also breaks the existing KUnit expectations. For example, with wd == 1, the
maximum implemented value is 0x8000, but the new conversion reports 50 rather
than 100. With wd == 8, converting 33% returns non-canonical 0x5479, outside
the test's expected [0x5300, 0x5400] range. The same helper is used for CMAX.

The conversion also makes get_mba_min() return zero for every width. For low
widths this changes the minimum from the upper bound of the first hardware band
(50% when wd == 1) to 0%, allowing bw_validate() to accept MB:0=0 even
though the hardware value zero still represents that first non-zero band.

Almost all of the behavior named by the source patch's changelog was removed
during its earlier downstream adaptation while the message was retained. That
mismatch is worth correcting when the commit is refreshed, but it should not
be described as newly introduced relative to this PR's merge base.

The [fenghuay: ...] note is also inaccurate: reset_cfg is zero-initialized
in mpam_reset_ris(), not in mpam_reprogram_ris_partid().

Can the conversion changes be reverted or split out and justified together
with updated tests, and can the reset commit's subject, body, and forward-port
note be rewritten to describe the remaining diff?

Still outstanding

2. 61549f38bb897 frees the PCC channel before SRCU readers and the error IRQ
are quiesced.

This commit is patch-identical to the posted source patch, so the defect is
inherited rather than created while applying it downstream. PCC support is not
in the merge base, however, so merging this PR introduces the PCC-specific UAF
into the target tree. A separate downstream lifetime fix present in the
previous PR revision was dropped by this refresh.

The current PCC commit calls mpam_pcc_chan_put() as the first operation in
mpam_msc_drv_remove():

static void mpam_msc_drv_remove(struct platform_device *pdev)
{
	struct mpam_msc *msc = platform_get_drvdata(pdev);

	mpam_pcc_chan_put(msc->pcc_chan);

	mutex_lock(&mpam_list_lock);
	mpam_msc_destroy(msc);
	mutex_unlock(&mpam_list_lock);

	mpam_free_garbage();
}

If this drops the final reference, mpam_pcc_chan_release() frees the PCC
mailbox channel, mutex, and wrapper before the MSC is unlinked and before
synchronize_srcu(). An existing or new SRCU reader can still reach that MSC
through the global lists and enter mpam_fb_send_request() using the released
channel.

There is a second path through the error IRQ. The devm threaded IRQ remains
installed until devres cleanup after .remove() returns. A pending handler can
run __mpam_irq_handler() -> mpam_msc_read_esr() ->
mpam_fb_send_request() after the PCC channel has been released. The driver
does not set suppress_bind_attrs, so sysfs unbind can reach this teardown.

The struct mpam_msc/IRQ-dev-id part of this lifetime gap predates the PCC
series, but PCC introduces an earlier channel UAF window before the MSC is even
unlinked. Can the per-MSC IRQ be quiesced and the SRCU grace period completed
before releasing the PCC channel, or should runtime unbind be suppressed if it
is not supported?

3. fd33760096a73 aborts IOMMU-group migration on the first error.

This commit is patch-identical to the posted source patch. The merge base does
not migrate IOMMU groups at all, so the underlying stale-assignment problem is
pre-existing and the commit is a net improvement rather than a regression. It
stops short in one place: rdt_move_group_iommus() breaks out of the walk on
the first per-group failure, and all three call sites discard its return value.

arm_smmu_group_set_mpam() returns -EIO when the SMMU lacks
ARM_SMMU_FEAT_MPAM:

	if (!(master->smmu->features & ARM_SMMU_FEAT_MPAM))
		return -EIO;

In rmdir_all_sub() the from == NULL unmount path bypasses the
iommu_matches_rdtgroup() filter. An unsupported group can therefore fail
ahead of later assigned groups, leaving those later groups with stale
PARTID/PMG values. Teardown then releases their closid and rmid through
closid_free() and free_rmid(). rdt_move_group_tasks(), which the changelog
says this mirrors, has no equivalent abort path.

Should the walk continue after per-group failures, or should group deletion
honor and propagate the error?

4. 04903184af7d6 adds an undeclared CONFIG_MAILBOX dependency.

This commit is patch-identical to the posted source patch, including the
missing Kconfig dependency. MPAM-Fb is not present in the merge base, so this
is an inherited source defect that nevertheless becomes a new valid-config
build regression in the target tree when this PR is merged.

mpam_fb.o is unconditional in mpam-y and calls mbox_send_message(), which
has no !CONFIG_MAILBOX stub. CONFIG_ARM64_MPAM=y selects
ARM64_MPAM_DRIVER, but neither symbol selects MAILBOX.

I reproduced this at the current head with arm64 allnoconfig plus
CONFIG_ARM64_MPAM=y: the resulting configuration has
CONFIG_ARM64_MPAM_DRIVER=y and CONFIG_MAILBOX=n, and the vmlinux link fails:

drivers/resctrl/mpam_fb.o: undefined reference to `mbox_send_message'

Enabling CONFIG_MAILBOX=y makes the same build pass. The target's shipped
arm64 annotations enable both MAILBOX and PCC, so product deployment is not
currently affected, but this remains a valid-config build failure. The gap is
also present in the posted source series. select MAILBOX from
ARM64_MPAM_DRIVER would express the unconditional dependency.

For the mailing list rather than this PR

5. 19fdb9ba629d5 uses a domain-independent mbwu_idx_to_mon[] mapping.

The index is only resctrl_arch_rmid_idx_encode(closid, rmid).
resctrl_arch_config_cntr() receives d but does not use it when updating the
mapping, while resctrl owns d->cntr_cfg per rdt_l3_mon_domain and exposes
per-domain assignments through mbm_L3_assignments.

Unassigning an event in one domain can set the global mapping to -1 while
another domain remains assigned. Assigning different counter ids in different
domains similarly makes the last update select the hardware-monitor index for
all domains. The same domain-independent mapping already exists in the merge
base, and this commit is patch-identical to linux-next. It is therefore both a
pre-existing target-tree problem and a source issue, not a regression caused
by this refresh or a backport-fidelity defect.

Items 2 and 4 introduce new failures into the target tree and look like fixes
needed before merge, even though both defects came from their source patches.
Item 1 is already in the merge base but is worth cleaning up while its commit
is being refreshed. Item 3 needs an explicit decision on whether to carry the
source patch as-is or complete its cleanup behavior here. Item 5 is pre-existing
and belongs on the upstream mailing list.

Saurav Sachidanand and others added 12 commits September 1, 2026 01:20
…fetcher metrics

BugLink: https://bugs.launchpad.net/bugs/2164783

The L1D prefetcher metrics (l1d_cache_rw_miss_ratio, l1d_demand_accesses,
etc.) were incorrectly assigned to MetricGroup "L1I_Prefetcher_Effectiveness"
and vice versa. This causes 'perf stat --metric-group L1D_Prefetcher_Effectiveness'
to display L1I metrics, which is misleading.

Swap the MetricGroup assignments so L1D metrics are in the L1D group and
L1I metrics are in the L1I group.

Fixes: 86ff690 ("perf vendor events arm64: Add Tegra410 Olympus PMU events")
Signed-off-by: Saurav Sachidanand <[email protected]>
Reviewed-by: Besar Wicaksono <[email protected]>
Reviewed-by: Ian Rogers <[email protected]>
Signed-off-by: Namhyung Kim <[email protected]>
(cherry picked from commit 2d85e13 linux-next)
Signed-off-by: Matthew R. Ochs <[email protected]>
Acked-by: Carol L Soto <[email protected]>
Acked-by: Jamie Nguyen <[email protected]>
Signed-off-by: Brad Figg <[email protected]>
BugLink: https://bugs.launchpad.net/bugs/2164783

The name and description for NVIDIA Tegra410 Olympus implementation-defined
event 0x0197 incorrectly indicate a TXREQ limit between one quarter and
one half. Correct them to describe a TXREQ limit below one half.

Fixes: 86ff690 ("perf vendor events arm64: Add Tegra410 Olympus PMU events")
Signed-off-by: Besar Wicaksono <[email protected]>
Reviewed-by: Ian Rogers <[email protected]>
Signed-off-by: Namhyung Kim <[email protected]>
(cherry picked from commit 9453bc6 linux-next)
Signed-off-by: Matthew R. Ochs <[email protected]>
Acked-by: Carol L Soto <[email protected]>
Acked-by: Jamie Nguyen <[email protected]>
Signed-off-by: Brad Figg <[email protected]>
BugLink: https://bugs.launchpad.net/bugs/2165055

Offsets and lengths need to be validated against the dma alignment. This
check was skipped for sufficiently a small bio with a single bvec, which
may allow an invalid request dispatched to the driver. Force the
validation for an unaligned bvec by forcing the bio split path that
handles this condition.

Fixes: 7eac331 ("iomap: simplify direct io validity check")
Fixes: 5ff3f74 ("block: simplify direct io validity check")
Reported-by: Carlos Maiolino <[email protected]>
Signed-off-by: Keith Busch <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Jens Axboe <[email protected]>
(cherry picked from commit 9b0c367)
Signed-off-by: Jamie Nguyen <[email protected]>
Acked-by: Matthew R. Ochs <[email protected]>
Acked-by: Carol L Soto <[email protected]>
Acked-by: Emily Soto <[email protected]>
Signed-off-by: Brad Figg <[email protected]>
…ng MSI-X messages"

This reverts commit 5929ce1.

Signed-off-by: Lee Trager <[email protected]>
This reverts commit 0f0f62d.

This commit is being reverted as part of the process in updating "T241-MPAM-6 fixes"; it is reapplied.

Signed-off-by: Lee Trager <[email protected]>
This reverts commit 9d97d90.

This commit is being reverted as part of the process in updating "ABMC v5 integration adjustments"; it is reapplied.

Signed-off-by: Lee Trager <[email protected]>
…ity from init"

This reverts commit eb2a397.

This commit is being reverted as part of the process in updating "MPAM MBA MAX/HARDLIM support"; it is reapplied.

Signed-off-by: Lee Trager <[email protected]>
…and hardlim_rw"

This reverts commit 3f89f03.

This commit is being reverted as part of the process in updating "MPAM MBA MAX/HARDLIM support"; it is reapplied.

Signed-off-by: Lee Trager <[email protected]>
…efault config"

This reverts commit 39c973a.

This commit is being reverted as part of the process in updating "MPAM MBA MAX/HARDLIM support"; it is reapplied.

Signed-off-by: Lee Trager <[email protected]>
…s during domain setup"

This reverts commit 3ce46c5.

This commit is being reverted as part of the process in updating "ABMC v5 integration adjustments"; it is reapplied.

Signed-off-by: Lee Trager <[email protected]>
…ogramming errors"

This reverts commit 7abd6df.

This commit is being reverted as part of the process in updating "MPAM-Fb integration adjustments"; it is reapplied.

Signed-off-by: Lee Trager <[email protected]>
…unter can overflow"

This reverts commit 280d193.

This commit is being reverted as part of the process in updating "MPAM monitoring integration refresh"; it is reapplied.

Signed-off-by: Lee Trager <[email protected]>
James Morse and others added 27 commits September 1, 2026 01:22
…om the command line

MPAMs bandwidth monitors are only available via resctrl if there are
enough monitors for each combination of partid and pmg to have one.
As it is unlikely anyone built that many monitors, allow the
maximum partid the system will use to be set from the kernel
command-line.
With this, it should be possible for bandwidth monitors to be
enabled by reducing the number of partid in use.

Signed-off-by: James Morse <[email protected]>
(cherry picked from commit f12f00e https://github.com/NVIDIA/NV-Kernels 24.04_linux-nvidia-6.17-next)
[fenghuay:
  - Resolve minor conflicts in `drivers/resctrl/mpam_devices.c`;
]
Signed-off-by: Fenghua Yu <[email protected]>
Signed-off-by: Lee Trager <[email protected]>
Acked-by: Jamie Nguyen <[email protected]>
Acked-by: Carol L Soto <[email protected]>
Acked-by: Seth Forshee <[email protected]>
Acked-by: Fenghua Yu <[email protected]>
Signed-off-by: Lee Trager <[email protected]>
Some later things in the MPAM tree enable behaviour that resctrl doesn't
have upstream. To make it clear to people using the out-of-tree code that
they shouldn't be relying on this in user-space, add a mount option to
enable this stuff.

Signed-off-by: James Morse <[email protected]>
(cherry picked from commit 8bd0025 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 <[email protected]>
Signed-off-by: Lee Trager <[email protected]>
Acked-by: Jamie Nguyen <[email protected]>
Acked-by: Carol L Soto <[email protected]>
Acked-by: Seth Forshee <[email protected]>
Acked-by: Fenghua Yu <[email protected]>
Signed-off-by: Lee Trager <[email protected]>
…cation

The MPAM driver discovers which MSC control which system resources from
firmware tables. The MPAM resctrl picking code then attempts to export
platforms that are Xeon shaped via resctrl.
Occasionally, the presence of one or more MSC prevents the platform
being described as Xeon shaped, and exposed via resctrl. For example
with CPU-less NUMA nodes. The additional node doensn't have an L3,
so can't have domain-ids exposed for the 'MB' memory bandwidth controls.
In this example, some users would prefer to control bandwidth on just
the CPU nodes, instead of having nothing at all.
Allow users an amount of wiggle room by allowing MSC to be forced to
be treated as unknown. This effectively disables parts of the MPAM
functionality.
Unknown MSC are not disabled, They are still probed and contribute to
the system wide properties.
Suggested-by: Dave Martin <[email protected]>

Signed-off-by: James Morse <[email protected]>
(cherry picked from commit 542e79e https://github.com/NVIDIA/NV-Kernels 24.04_linux-nvidia-6.17-next)
Signed-off-by: Fenghua Yu <[email protected]>
Signed-off-by: Lee Trager <[email protected]>
Acked-by: Jamie Nguyen <[email protected]>
Acked-by: Carol L Soto <[email protected]>
Acked-by: Seth Forshee <[email protected]>
Acked-by: Fenghua Yu <[email protected]>
Signed-off-by: Lee Trager <[email protected]>
Traffic in the system can be tagged with a PARTID and PMG. Different
requestors can support a different number of bits for these fields.
Before MPAM can be used, the MPAM driver has to discover the minimum
number of bits supported by any requestor, which affects the range
of PARTID and PMG that can be used.
Detect whether the SMMU supports MPAM, if it does provide the MPAM
driver with the maximum PARTID and PMG values.
Tested-by: Amit Singh Tomar <[email protected]>

Signed-off-by: James Morse <[email protected]>
(cherry picked from commit 254691a https://github.com/NVIDIA/NV-Kernels 24.04_linux-nvidia-6.17-next)
[fenghuay:
  - Resolve minor conflicts in `drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c`;
]
Signed-off-by: Fenghua Yu <[email protected]>
Signed-off-by: Lee Trager <[email protected]>
Acked-by: Jamie Nguyen <[email protected]>
Acked-by: Carol L Soto <[email protected]>
Acked-by: Seth Forshee <[email protected]>
Acked-by: Fenghua Yu <[email protected]>
Signed-off-by: Lee Trager <[email protected]>
…tate

To allow an iommu_group to be moved between resctrl groups as if it
were a CPU thread, the mpam driver needs to be able to set the partid
and pmg for the iommu_group.

Use the properties in the STE, as these only apply to one stream.

The MPAM driver also needs to know the maximum partid and pmg
values that the SMMU can generate. This allows it to determine
the system-wide common supported range of values. Add a helper
to return this id register.

Tested-by: Amit Singh Tomar <[email protected]>
Signed-off-by: James Morse <[email protected]>
(cherry picked from commit 46a241f45ca9b71abf900f31a0c89fcbf24c44c4 https://git.kernel.org/pub/scm/linux/kernel/git/morse/linux.git)
Signed-off-by: Lee Trager <[email protected]>
Acked-by: Jamie Nguyen <[email protected]>
Acked-by: Carol L Soto <[email protected]>
Acked-by: Seth Forshee <[email protected]>
Acked-by: Fenghua Yu <[email protected]>
[ltrager: Fixed the conflict by keeping iommu_driver_get_domain_for_dev(),
the device-based MPAM callbacks for identity mappings from commit
23bcbda
https://github.com/NVIDIA/NV-Kernels 24.04_linux-nvidia-6.17-next, and the
kdump MPAM guard from commit 156c23e
https://github.com/NVIDIA/NV-Kernels/tree/26.04_linux-nvidia-bos.]
Signed-off-by: Lee Trager <[email protected]>
To allow an iommu_group to be moved between resctrl groups as if it
were a CPU thread, the mpam driver needs to be able to set the partid
and pmg for the iommu_group.

Add helpers that call the iommu driver's get/set methods for these
parameters.

Signed-off-by: James Morse <[email protected]>
(cherry picked from commit 5ee2d478b62586acf816699e3cc479f49b682a58 https://git.kernel.org/pub/scm/linux/kernel/git/morse/linux.git)
Signed-off-by: Lee Trager <[email protected]>
Acked-by: Jamie Nguyen <[email protected]>
Acked-by: Carol L Soto <[email protected]>
Acked-by: Seth Forshee <[email protected]>
Acked-by: Fenghua Yu <[email protected]>
[ltrager: Fixed the conflict by keeping the later PCI reset declarations and
stubs and the device-by-device QoS dispatch for identity mappings from commit
23bcbda
https://github.com/NVIDIA/NV-Kernels 24.04_linux-nvidia-6.17-next.]
Signed-off-by: Lee Trager <[email protected]>
…resctrl groups

Arm's MPAM has support for assigning devices behind an IOMMU to a
control or monitor group. This can be used for device-passthrough
for a VM, or user-space drivers using VFIO to ensure the device
is either in the same control group as the CPU threads.
Alternatively, the iommu_group may be assigned to a different
control group with preferential schema values.

Extend the resctrl tasks file to include iommu_groups. These
appear as 'iommu_group:0', where 0 is the group number that
can be found from /sys/kernel/iommu_groups/. iommu_groups
can be moved between resctrl groups by writing this string
in the same way as tasks are moved.
No state is preserved by resctrl, an iommu_group that disappears
will no longer be listed as being part of a resctrl group. A new
iommu_group will appear in the default group.

Add helpers to list and move iommu_groups. Architecture specific
helpers are used to apply the closid/rmid to the iommu_group due
to the way MPAM emulates CDP.

Tested-by: Amit Singh Tomar <[email protected]>
Signed-off-by: James Morse <[email protected]>
(cherry picked from commit 98b622c413ee64b8e05f93f0ff5f8cf85776afba https://git.kernel.org/pub/scm/linux/kernel/git/morse/linux.git)
[ltrager:
 - Resolved merge conflict relating to magic numbers now defined as macros, additional log output in drivers/acpi/arm64/mpam.c
 - Drop drivers/acpi/arm64/mpam.c hunks — the locator parsing they amended was removed along with the dropped "arm_mpam: Parse the rest of the ACPI table"
]
Signed-off-by: Lee Trager <[email protected]>
Acked-by: Jamie Nguyen <[email protected]>
Acked-by: Carol L Soto <[email protected]>
Acked-by: Seth Forshee <[email protected]>
Acked-by: Fenghua Yu <[email protected]>
Signed-off-by: Lee Trager <[email protected]>
…driver discovered

Not all of MPAM is visible through the resctrl user-space interface.
To make it easy to debug why certain devices were not exposed through
resctrl, allow the properties of the devices to be read through debugfs.
This adds an mpam directory to debugfs, and exposes the devices as well
as the hierarchy that was built.

Signed-off-by: James Morse <[email protected]>
(backported from commit e8f0f21 https://github.com/NVIDIA/NV-Kernels 24.04_linux-nvidia-6.17-next)
[fenghuay:
  - Resolve minor conflicts in `drivers/resctrl/mpam_devices.c`;
 ltrager:
  - Resolve minor conflicts in `drivers/resctrl/mpam_devices.c`;
]
Signed-off-by: Fenghua Yu <[email protected]>
Signed-off-by: Lee Trager <[email protected]>
Acked-by: Jamie Nguyen <[email protected]>
Acked-by: Carol L Soto <[email protected]>
Acked-by: Seth Forshee <[email protected]>
Acked-by: Fenghua Yu <[email protected]>
Acked-by: Nirmoy Das <[email protected]>
[ltrager: Kept the later force-disable debugfs node while restoring the updated MSC and RIS discovery hierarchy.]
Signed-off-by: Lee Trager <[email protected]>
It's really popular to tie NRDY high, and then act surprised when the OS
never reads the counters, because they aren't ready. The spec obliges
hardware to clear this bit automatically before the firmware advertised
timeout.
To make it easier to find errant hardware, count the number of retries
and expose that number in debugfs.

Signed-off-by: James Morse <[email protected]>
(backported from commit 4fa427c https://github.com/NVIDIA/NV-Kernels 24.04_linux-nvidia-6.17-next)
[fenghuay:
  - Resolve minor conflicts in `drivers/resctrl/mpam_devices.c`;
]
Signed-off-by: Fenghua Yu <[email protected]>
[ltrager: Refresh NRDY counting for the v5 propagated-error read paths.]
Signed-off-by: Lee Trager <[email protected]>
Acked-by: Jamie Nguyen <[email protected]>
Acked-by: Carol L Soto <[email protected]>
Acked-by: Seth Forshee <[email protected]>
Acked-by: Fenghua Yu <[email protected]>
Acked-by: Nirmoy Das <[email protected]>
Signed-off-by: Lee Trager <[email protected]>
…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 <[email protected]>
(backported from commit 5cbe15bd6c1d393cf1ffe2b259a3be54a5345e1e https://git.kernel.org/pub/scm/linux/kernel/git/morse/linux.git)
[ltrager: Minor merge conflict]
Signed-off-by: Lee Trager <[email protected]>
Acked-by: Jamie Nguyen <[email protected]>
Acked-by: Carol L Soto <[email protected]>
Acked-by: Seth Forshee <[email protected]>
Acked-by: Fenghua Yu <[email protected]>
Signed-off-by: Lee Trager <[email protected]>
Add rdt_mb_max_lim_show() and the max_lim entry in res_common_files[].
Add mb_max_lim_init() to call resctrl_file_fflags_init("max_lim", ...)
when arch_has_mb_max_lim, and invoke it from resctrl_init() after
io_alloc_init().

(forward ported from commit be13cad https://github.com/NVIDIA/NV-Kernels 24.04_linux-nvidia-6.17-next)
[fenghuay:
  - Resolve minor conflicts in `fs/resctrl/rdtgroup.c`;
 ltrager:
  - Call mb_max_lim_init() before resctrl_mon_init(), which 'Include all MSC
    components' renamed from resctrl_l3_mon_resource_init().
]
Signed-off-by: Fenghua Yu <[email protected]>
Signed-off-by: Lee Trager <[email protected]>
Acked-by: Jamie Nguyen <[email protected]>
Acked-by: Carol L Soto <[email protected]>
Acked-by: Seth Forshee <[email protected]>
Acked-by: Fenghua Yu <[email protected]>
Signed-off-by: Lee Trager <[email protected]>
A single MPAM class can contain multiple MSC components, and a CPU may
be associated with more than one of them. Domain create/destroy only
walked the first matching component, so controls and monitors were not
installed for the rest. Traffic through those omitted components then
had no resctrl domain and bandwidth accounting or schemata did not
apply where expected.

Iterate every component associated with a CPU on online/offline and key
domain lookup and allocation by component so each MSC instance gets its
own resctrl domain.

Signed-off-by: Shanker Donthineni <[email protected]>
Signed-off-by: Fenghua Yu <[email protected]>
(backported from commit 46160db https://github.com/NVIDIA/NV-Kernels/tree/26.04_linux-nvidia-bos)
[ltrager:
 - Refresh the multi-MSC and MBA-backed monitor changes for ABMC v5.
 - Preserve v5 per-counter assignments and targeted counter reset.
 - Derive num_mbm_cntrs from the monitoring class selected for each resource.
 - Retain downstream MB_HLIM initialization in resctrl_init().
]
Signed-off-by: Lee Trager <[email protected]>
Acked-by: Jamie Nguyen <[email protected]>
Acked-by: Carol L Soto <[email protected]>
Acked-by: Seth Forshee <[email protected]>
Acked-by: Fenghua Yu <[email protected]>
Acked-by: Nirmoy Das <[email protected]>
Signed-off-by: Lee Trager <[email protected]>
BugLink: https://bugs.launchpad.net/bugs/2154527

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 <[email protected]>
Acked-by: Jamie Nguyen <[email protected]>
Acked-by: Carol L Soto <[email protected]>
Signed-off-by: Brad Figg <[email protected]>
(backported from commit 059412d https://github.com/NVIDIA/NV-Kernels/tree/26.04_linux-nvidia-bos)
[ltrager: Keep ABMC v5 resource synchronization keyed to assigned MBM counters.]
Signed-off-by: Lee Trager <[email protected]>
Acked-by: Seth Forshee <[email protected]>
Acked-by: Fenghua Yu <[email protected]>
Acked-by: Nirmoy Das <[email protected]>
Signed-off-by: Lee Trager <[email protected]>
… events

BugLink: https://bugs.launchpad.net/bugs/2157922

When mbm_total_bytes is exposed on MBA for memory-level MSC monitors,
resctrl_arch_mon_capable() must reflect mon_capable on the backing
resource, not only L3. Also gate MBM counter auto-assign and unassign
on each enabled event's resource so MBA-backed mbm_total_bytes gets
ABMC setup on group create and cleanup on group delete.

Signed-off-by: Fenghua Yu <[email protected]>
Acked-by: Matthew R. Ochs <[email protected]>
Acked-by: Carol L Soto <[email protected]>
Signed-off-by: Brad Figg <[email protected]>
(cherry picked from commit 568443a https://github.com/NVIDIA/NV-Kernels/tree/24.04_linux-nvidia-6.17-next)
Signed-off-by: Lee Trager <[email protected]>
Acked-by: Jamie Nguyen <[email protected]>
Acked-by: Seth Forshee <[email protected]>
Acked-by: Fenghua Yu <[email protected]>
Signed-off-by: Lee Trager <[email protected]>
…p token

When the tasks interface receives an "iommu_group:id" configuration,
the original code fails to skip the PID parsing logic after processing
the IOMMU group. This causes the same token to be incorrectly passed
to kstrtoint() as a PID, resulting in -EINVAL.

Restructure the conditional logic to use explicit if-else branches,
ensuring that IOMMU group tokens are processed by rdtgroup_move_iommu()
and then skipped.

This fix also enables proper handling of mixed configurations with
multiple consecutive iommu_group:id and pid entries (e.g.,
echo "iommu_group:1,1234,iommu_group:2,5678" > tasks).

Fixes: 98b622c413ee ("fs/resctrl: Add support for assigning iommu_groups to resctrl groups")
Signed-off-by: Zeng Heng <[email protected]>
(cherry picked from https://lore.kernel.org/r/[email protected])
Signed-off-by: Lee Trager <[email protected]>
…_move_iommu()

The 'of' (kernfs_open_file) parameter in rdtgroup_move_iommu() is
not used within the function body. Remove it to simplify the
interface and eliminate the unnecessary argument passing.

Signed-off-by: Zeng Heng <[email protected]>
(cherry picked from https://lore.kernel.org/r/[email protected])
Signed-off-by: Lee Trager <[email protected]>
…e groups

When deleting a control group, monitor group, or unmounting the resctrl
filesystem, migrate all associated IOMMU groups to the appropriate
destination:
  * Control group deletion: move IOMMU groups to the default group
  * Monitor group deletion: move IOMMU groups to the parent control group
  * Filesystem unmount: move all IOMMU groups to the default group

Without this migration, IOMMU groups remain bound to stale PARTID/PMG
values of the destroyed group, causing them to "disappear" from the
resctrl interface.

Add rdt_move_group_iommus() to handle this migration, mirroring the
existing rdt_move_group_tasks() pattern for task migration.

When deleting a control group or unmounting the resctrl file system, it
is necessary to move its all iommu_groups back to the default group. When
removing a monitor group, need to move its iommu_groups back to the parent
control group.

Otherwise, these iommu_groups remain bound to the old PARTID and PMG, and
they will appear to "disappear" from the resctrl fs.

Signed-off-by: Zeng Heng <[email protected]>
(cherry picked from https://lore.kernel.org/r/[email protected])
Signed-off-by: Lee Trager <[email protected]>
…FIG_RESCTRL_IOMMU=n

resctrl.h declares resctrl_arch_set_iommu_closid_rmid() and the two
match helpers under #ifdef CONFIG_RESCTRL_IOMMU, with static inline
stubs in the #else branch. mpam_resctrl.c defines the same functions
unconditionally, handling CONFIG_RESCTRL_IOMMU=n inside the function
bodies with IS_ENABLED() checks.

RESCTRL_IOMMU is only selected when ARM_SMMU_V3 is enabled, so building
with ARM64_MPAM_RESCTRL_FS=y and ARM_SMMU_V3=n pulls the static inline
stubs into mpam_resctrl.c alongside its out-of-line definitions:

  drivers/resctrl/mpam_resctrl.c:388:5: error: redefinition of 'resctrl_arch_set_iommu_closid_rmid'
  drivers/resctrl/mpam_resctrl.c:404:6: error: redefinition of 'resctrl_arch_match_iommu_closid'
  drivers/resctrl/mpam_resctrl.c:421:6: error: redefinition of 'resctrl_arch_match_iommu_closid_rmid'

Drop the stubs and declare the prototypes unconditionally. The
definitions already handle the disabled case internally, and on
architectures that never implement them every caller is behind an
IS_ENABLED(CONFIG_RESCTRL_IOMMU) check, so the calls are removed as
dead code.

Co-Authored-By: Claude Fable 5 <[email protected]>
Signed-off-by: Lee Trager <[email protected]>
Acked-by: Jamie Nguyen <[email protected]>
Acked-by: Carol L Soto <[email protected]>
Acked-by: Seth Forshee <[email protected]>
Acked-by: Fenghua Yu <[email protected]>
(cherry picked from commit 6024242 https://github.com/NVIDIA/NV-Kernels/tree/linux-nvidia-6.18-next)
Signed-off-by: Lee Trager <[email protected]>
When an MSC becomes inaccessible due to cpu offline CFG_MBWU_CTL is set to
zero in mpam_save_mbwu_state(). This is very likely to mean that the config
will mismatch when restoring and so the monitor will be reset. However, the
state may have been lost and so there are no guarantees. Ensure the reset
happens by setting the reset_on_next_read and remove the unnecessary writes
from mpam_save_mbwu_state().

Fixes: 41e8a14 ("arm_mpam: Track bandwidth counter state for power management")
Signed-off-by: Ben Horgan <[email protected]>
(cherry picked from https://lore.kernel.org/r/[email protected])
Signed-off-by: Lee Trager <[email protected]>
…ting groups

iommu_group_get_from_kobj() returns with a reference held on
group->devices_kobj, which the caller must release with
iommu_group_put(). The explicit kobject_get() taken before the call
only compensates for the kobject_put(&group->kobj) that
iommu_group_get_from_kobj() performs internally.

Neither show_rdt_iommu() nor rdt_move_group_iommus() ever calls
iommu_group_put(), so each leaks one iommu_group reference per group
in the kset on every invocation: every read of a tasks file for the
former, and every ctrl/mon group rmdir or resctrl unmount for the
latter. Since devices_kobj pins the group's kobject, leaked groups
can never be freed.

rdt_move_group_iommus() additionally leaks the iterator's reference
on group_kobj on its error paths: kset_get_next_obj() only drops the
reference on the current kobject when it is passed back as @Prev on
the next call, so breaking out of the loop early leaks it.

Drop the iommu_group reference at the end of each loop iteration, and
drop the group_kobj reference before breaking out of the loop on
error.

Reported in upstream review - https://lore.kernel.org/all/[email protected]/

Fixes: 7b8c62d ("NVIDIA: SAUCE: fs/resctrl: Add support for assigning iommu_groups to resctrl groups")
Fixes: a110864 ("NVIDIA: SAUCE: fs/resctrl: Migrate IOMMU groups when removing resource groups")
Signed-off-by: Lee Trager <[email protected]>
Acked-by: Jamie Nguyen <[email protected]>
Acked-by: Carol L Soto <[email protected]>
Acked-by: Seth Forshee <[email protected]>
Acked-by: Fenghua Yu <[email protected]>
(cherry picked from commit a4d885b https://github.com/NVIDIA/NV-Kernels/tree/linux-nvidia-6.18-next)
Signed-off-by: Lee Trager <[email protected]>
mbwu_save_mbwu_state() reads the MBWU counters and adds that to a saved
correction value. However, the type of counter to read is determined by the
RIS rather than the class and overflow is not taken into account. Fix this
and mitigate against further divergence by using the same helper as used
for user reads, __ris_msmon_read().

Fixes: 41e8a14 ("arm_mpam: Track bandwidth counter state for power management")
Signed-off-by: Ben Horgan <[email protected]>
(cherry picked from https://lore.kernel.org/r/[email protected])
Signed-off-by: Lee Trager <[email protected]>
T241-MPAM-6 causes all MBWU counter formats to count 64-byte
requests instead of bytes. Commit dc48eb1 excluded the 63-bit
MSMON_MBWU_LWD format while scaling the shorter counters. Systems
selecting the preferred 63-bit counter consequently report bandwidth
values that are 64 times too small.

Apply the scale to both the sampled value and overflow correction for
the 63-bit format. Unsigned arithmetic retains modulo-u64 behavior
when the scaled counter range exceeds u64.

Fixes: dc48eb1 ("arm_mpam: Add workaround for T241-MPAM-6")
Link: https://lore.kernel.org/lkml/[email protected]/
Signed-off-by: Shanker Donthineni <[email protected]>
Reviewed-by: Fenghua Yu <[email protected]>
Tested-by: Fenghua Yu <[email protected]>
Reviewed-by: Ben Horgan <[email protected]>
Signed-off-by: Ben Horgan <[email protected]>
Signed-off-by: Will Deacon <[email protected]>
Signed-off-by: Lee Trager <[email protected]>
…store_mbwu_state()

m->err may be read before initialization in __ris_msmon_read() when called
from mpam_restore_mbwu_state().

Initialize the whole struct mon_read in mpam_restore_mbwu_state() and fix
the spelling of mbwu in the name.

Fixes: 41e8a14 ("arm_mpam: Track bandwidth counter state for power management")
Signed-off-by: Ben Horgan <[email protected]>
(cherry picked from https://lore.kernel.org/r/[email protected])
[ltrager: Keep val zero-initialized because __ris_msmon_read() accumulates into it.]
Signed-off-by: Lee Trager <[email protected]>
…s L3

The class used to back mbm_total_bytes can be either at the L3 or the
memory. If a platform had candidate classes at both the memory and the L3
then, as the check for whether the existing class is L3 or not in
counter_update_class() is broken, the class that will be chosen depends on
which order the classes are considered and so the probe order.

Fix the check.

Fixes: 1458c4f ("arm_mpam: resctrl: Add support for csu counters")
Signed-off-by: Ben Horgan <[email protected]>
(cherry picked from https://lore.kernel.org/r/[email protected])
Signed-off-by: Lee Trager <[email protected]>
mpam_msc_drv_remove() releases the PCC channel before unlinking the
MSC from the SRCU-protected lists. If this drops the final channel
reference, an existing reader can dereference the freed channel through
its retained MSC.

Simply moving the release after mpam_free_garbage() is insufficient. A
concurrent garbage collector can claim the queued MSC and wait for the
grace period while the remove caller finds an empty garbage list and
releases the channel immediately.

Add an optional garbage release callback and use it to drop each MSC
PCC reference after the collector completes synchronize_srcu(). This
also releases PCC references when mpam_disable() destroys the MSCs.

Fixes: 7d5003e ("NVIDIA: SAUCE: arm_mpam: detect and enable MPAM-Fb PCC support")
Signed-off-by: Lee Trager <[email protected]>
Acked-by: Nirmoy Das <[email protected]>
Acked-by: Seth Forshee <[email protected]>
(cherry picked from commit b7436bb https://github.com/NVIDIA/NV-Kernels/tree/linux-nvidia-6.18-next)
Signed-off-by: Lee Trager <[email protected]>
The error IRQ is devm-managed and is not released until after the platform
driver remove callback returns. mpam_msc_drv_remove() queues the MSC for
deferred freeing, and the garbage collector can free it and drop its PCC channel
before devres unregisters the IRQ. A pending threaded handler can then
dereference the freed MSC or PCC channel.

Factor the per-MSC portion of mpam_unregister_irqs() into a helper and call it
before unlinking the MSC. devm_free_irq() synchronizes with active handlers
before returning. The existing deferred garbage release then waits for SRCU
readers before releasing the PCC channel and MSC.

Fixes: 49aa621 ("arm_mpam: Register and enable IRQs")
Signed-off-by: Lee Trager <[email protected]>
rdt_move_group_iommus() stops walking IOMMU groups after the first migration
error. Its callers discard the return value and continue tearing down the
resctrl group, so later IOMMU groups can retain stale CLOSID and RMID values.

Continue walking after per-group failures while preserving the first error as
the return value. Advancing kset_get_next_obj() releases the iterator reference
for the previous object, so remove the explicit error-path kobject_put()
together with the break.

Fixes: 2ce3c78 ("NVIDIA: SAUCE: fs/resctrl: Migrate IOMMU groups when removing resource groups")
Signed-off-by: Lee Trager <[email protected]>
@jamieNguyenNVIDIA

Copy link
Copy Markdown
Collaborator

Re-reviewed the force-pushed head (b7ad9aa2f1a6) against the PR base and
the previously reviewed head (813e9fd0e0d3). The IOMMU continuation fix is
correct, and the ordinary MPAM-Fb PCC teardown path is now ordered correctly.
The following items still need resolution or clarification before ack. Their
provenance differs: item 1 is an incomplete fix for a pre-existing BOS bug,
item 2 is newly introduced by the downstream fix, item 3 is inherited from
the source series but becomes a new BOS build failure, and item 4 is specific
to this force-push.

IRQ teardown

1. 5f5d363b1098 still leaves a per-CPU error IRQ registered while freeing
its MSC.

The PPI lifetime gap predates this PR: the BOS platform remove path does not
unregister error IRQs. The new commit attempts to fix it, but its PPI branch
calls free_percpu_irq() without first disabling the interrupt on every
relevant CPU:

	if (irq_is_percpu(irq)) {
		msc->reenable_error_ppi = 0;
		free_percpu_irq(irq, msc->error_dev_id);
	}

The IRQ core requires disable_percpu_irq() on each CPU before
free_percpu_irq(). If a PPI is still enabled, __free_percpu_irq() warns and
returns without removing the action. The MPAM helper then clears
error_irq_req and frees the MSC, so a subsequent PPI can reach
mpam_ppi_handler() through an error_dev_id pointing at the freed object.

The old global teardown satisfied this prerequisite because removing the
CPUHP state invoked mpam_cpu_offline() on each online CPU. The new
per-device remove path does not. Can it disable the PPI on all enabled CPUs
while CPUs are locked before calling free_percpu_irq()?

2. 5f5d363b1098 calls the MMIO access helper without holding MPAM SRCU.

mpam_unregister_msc_irq() calls mpam_touch_msc() to disable the hardware
error interrupt. For an MMIO MSC, that helper explicitly requires both the
CPU hotplug lock and an MPAM SRCU read-side section:

	lockdep_assert_cpus_held();
	WARN_ON_ONCE(!srcu_read_lock_held(&mpam_srcu));

The old mpam_unregister_irqs() caller holds both. The new
mpam_msc_drv_remove() caller holds only cpus_read_lock(), so removing an
enabled MMIO MSC with an error IRQ reaches the warning. This is a regression
introduced by the new downstream fix, not inherited from the source series.

Inherited source defect that becomes a BOS regression

3. 48b5dca9879b still has an undeclared CONFIG_MAILBOX dependency.

This commit is patch-identical to the posted MPAM-Fb source patch, including
the missing dependency, so this was not introduced by downstream conflict
resolution. MPAM-Fb is absent from the merge base, however, so the PR adds a
new valid-config failure to BOS.

I reproduced it at the new head with arm64 allnoconfig plus
CONFIG_ARM64_MPAM=y. That produces CONFIG_ARM64_MPAM_DRIVER=y with
CONFIG_MAILBOX=n, and the vmlinux link fails:

drivers/resctrl/mpam_fb.o: undefined reference to `mbox_send_message'

Enabling CONFIG_MAILBOX=y made the same build pass. The shipped target
annotations enable MAILBOX, so the product configuration is not currently
affected, but ARM64_MPAM_DRIVER should select its unconditional mailbox
dependency.

Force-push stack construction

4. The push is based on an older target commit and includes an unrelated
PCI series.

The PR base is 165a079e52d1, but the current head's merge base is
ab2723ae9159. The head replays the target's final three commits under new
hashes. Their stable patch IDs and resulting trees match the target, so this
does not cause a content conflict, but it inflates the PR to 94 commits and
adds duplicate history. Can the branch be rebased onto 165a079e52d1?

The push also adds a revert of the existing MSI-X SAUCE patch followed by five
upstream-derived PCI commits. The final MSI-X behavior was already in BOS, but
the series additionally introduces per-function s390 slot-reset behavior and
generic config-save/FLR accessibility checks. I found no concrete defect in
those patches, but they are unrelated to the MPAM/resctrl refresh, absent from
the PR description, and have no PCI or s390 testing reported here. Can they be
split into a separate PR, or can their inclusion and testing be documented?

Fixed by this push

  • 4a7d534f166e releases the PCC channel only after the MSC is unlinked and
    the SRCU grace period completes.
  • PCC MSCs cannot use PPIs, so 5f5d363b1098 correctly synchronizes their
    hard and threaded IRQ handlers with devm_free_irq() before destruction.
  • b7ad9aa2f1a6 continues IOMMU-group migration after errors while preserving
    the first error and balancing iterator references. The previous IOMMU
    early-abort finding can be closed.

One broader lifetime race remains pre-existing in BOS: platform remove is not
serialized with the global mpam_disable() teardown, so it can obtain a NULL
or stale msc. This was not introduced by the refresh, although PCC adds
another resource reachable through the stale object. The reset-conversion and
domain-independent MBWU mapping issues discussed in the previous review are
also unchanged and pre-existing; I am not repeating them as refresh
regressions here.

For verification, git diff --check passed, a merge-tree simulation against
165a079e52d1 completed without a content conflict, and the arm64 build failed
with MAILBOX=n and passed with MAILBOX=y as described above.

@ltrager

ltrager commented Sep 1, 2026

Copy link
Copy Markdown
Collaborator Author

1. c9419e57dd0aa no longer does what its changelog describes, and its
percentage conversions are not width-aware.

c9419e5 is patch-identical to 990f4e5 from the PR merge base and carries the same changelog. It only appears in this PR as I had to revert it and then reapply it to cleanly update the patch sets described above. Neither the conversion behavior nor the changelog/content mismatch was introduced by this refresh. I agree that the historical forward-port message no longer describes the adapted diff precisely, but feel rewriting here is out of scope for this PR.

2. 61549f38bb897 frees the PCC channel before SRCU readers and the error IRQ
are quiesced.

cherry-picked b7436bb which I wrote to fix a similar issue from linux-nvidia-6.18-next. Added an additional SAUCE fix(5f5d363) for the IRQ issue.

3. fd33760096a73 aborts IOMMU-group migration on the first error.

I added a SAUCE patch(b7ad9aa) that continues walking the remaining IOMMU groups while preserving the first error as the function’s return value. Since advancing kset_get_next_obj() releases the previous iterator reference, the error-path kobject_put() is removed together with the break.

4. 04903184af7d6 adds an undeclared CONFIG_MAILBOX dependency.

Upstream agrees to the added dependency. I do not think its worth carrying a SAUCE patch as CONFIG_MALIBOX is enabled for various other devices.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.