[RFC PATCH 00/10] arm_mpam: Add extra MPAM controls in resctrl
From: Jinjie Ruan
Date: Thu Oct 22 2026 - 22:52:24 EST
Hi all,
Resctrl today only exposes CBM and the MBA bandwidth percentage.
But MPAM MSCs also have per-PARTID fields for internal priority, capacity
limits, a bandwidth minimum and the MBW_MAX hard-limit bit. The driver
already writes these fields, but resctrl has no schemata line for them,
so userspace can't choose the values.
So this series adds those schemata lines:
- Patch 1 fixes maybe_update_config(): a feature set with value zero
counts as no change, so the register is not written again.
The controls below can be zero, so this comes first.
- Patches 2-4 add mbw_min/max_limit, cmax/cmin and intpri to
mpam_config and write them from mpam_reprogram_ris_partid().
- Patch 5 adds the resource levels, selects the range path by schema_fmt
instead of the MBA/SMBA rid, skips the new resources in info/, and sets
their default value when a group is created.
- Patches 6-7 adjust the fixed-point helpers and clamp cmax_wd.
- Patches 8-10 add the schemata lines:
L2MAX/L3MAX CMAX, percent
L2MIN/L3MIN CMIN, percent
MBMIN MBW_MIN, percent
L2PRI/L3PRI/MBPRI INTPRI, raw value
MBHDL HARDLIM, 0 or 1
MBOPT MBW_MAX, raw fraction
The new resources reuse the class, domains and components of L2/L3/MB; only
the mpam_config field written differs. MBOPT and MBA both write MBW_MAX.
So before this series userspace can only set CBM and the MBA percentage.
After it, you can do:
# echo "L3MAX:33751040=50" > schemata
# echo "MBHDL:33751040=1" > schemata
A new group starts from each resource's default value, so the new controls
stay out of the way until schemata is written.
Tested this with a QEMU that has one L2 MSC, one L3 MSC and one
memory-controller MSC (CMAX_WD 4, INTPRI_WD 2, BWA_WD 16). The guest writes
every new line and reads it back, for example:
WRITE-OK [L3MAX:33751040=50]
SCHEMATA: L3MAX:33751040=50
Then reads the MSC registers:
L3 MSC partid0: PRI(IN)=2 CMIN=0x3000 CMAX=0x7000
mem MSC partid0: PRI(IN)=1 MBW_MIN=0x3fff MBW_MAX=0x1fff HARDLIM=Y
CMIN/CMAX are 4-bit fractions (3/16 for 25%, 7/16 for 50%); MBW_MIN is a
16-bit fraction (0x3fff for 25%); MBOPT writes the raw fraction (8191).
QEMU branch: https://github.com/ruanjinjie-eng/qemu/tree/mpam
Test cases: https://github.com/ruanjinjie-eng/mpam_testcase
This series is also available at:
https://github.com/ruanjinjie-eng/linux/tree/mpam-extra-controls
Jinjie Ruan (10):
arm_mpam: Treat adopting a config feature as a change
arm_mpam: Carry mbw_min and the hard limit in mpam_config
arm_mpam: Carry cmax and cmin in mpam_config
arm_mpam: Carry intpri in mpam_config
fs/resctrl: Prepare for range-format pseudo resources
arm_mpam: Clamp cmax_wd to 16
arm_mpam: Generalize the fixed-point conversion helpers
arm_mpam: resctrl: Expose the capacity controls as pseudo resources
arm_mpam: resctrl: Expose the priority controls as pseudo resources
arm_mpam: resctrl: Expose the bandwidth minimum and limit as pseudo
resources
drivers/resctrl/mpam_devices.c | 59 +++++++--
drivers/resctrl/mpam_internal.h | 8 ++
drivers/resctrl/mpam_resctrl.c | 215 +++++++++++++++++++++++++++++++-
fs/resctrl/rdtgroup.c | 15 ++-
include/linux/resctrl.h | 33 ++++-
5 files changed, 307 insertions(+), 23 deletions(-)
--
2.34.1