[PATCH v10 RESEND 00/15] arm_mpam: Introduce Narrow-PARTID feature
From: Jinjie Ruan
Date: Tue Oct 20 2026 - 10:01:56 EST
Background
==========
In ARM MPAM, a monitoring group is defined by a (PARTID, PMG) pair.
However, many production platforms implement only a single PMG bit,
limiting the total number of monitoring groups long before the request
PARTID space is exhausted.
Hardware Mechanism
===================
Platforms with "PARTID narrowing" mitigate this by mapping multiple
request PARTIDs onto a single internal PARTID. The internal PARTID
dictates the control group configuration, while each individual request
PARTID functions as an independent monitoring group. This decouples
control and monitoring allocation, allowing more monitoring groups
than the PMG constraint normally permits.
Software Strategy
==================
Using request PARTIDs beyond the internal range is only safe when no MPAM
class loses a non-aliasing control. While aliasing controls (e.g., cache
portion bitmaps) can be safely replicated across request PARTIDs,
non-aliasing controls (e.g., cache capacity) are additive and cannot.
To ensure safety, this series implements a completely static grouping
policy evaluated once before resctrl_init(). If any class contains
non-aliasing controls without narrowing capabilities, the expansion
is bypassed. This infrastructure remains completely transparent
to user-space.
Patch Architecture
====================
- Patches 1-6: bugfixes found by sashiko or while testing this series
- Patches 7-9: Preparatory helpers, no functional change
- Patch 10: Track internal and request PARTID limits per class
- Patches 11-12: Driver-side modulo interleaving + flat global RMID
- Patches 13-14: Identify non-aliasing controls; enable the narrowing
- Patch 15: KUnit tests for the narrow-PARTID helpers
Testing
========
Verified on both QEMU and real Hisi hardware:
- Narrowing expands monitoring groups from 4 to 256:
[ 62.602939] mpam:mpam_resctrl_configure_partids: PARTIDs: monitor=256 closid=32 extra=1
[ 63.788467] MPAM enabled with 256 PARTIDs and 4 PMGs
- KUnit: narrow-PARTID helper tests pass.
QEMU branch: https://github.com/ruanjinjie-eng/qemu/tree/mpam
Test cases: https://github.com/ruanjinjie-eng/mpam_testcase
v10 -> v10 RESNED:
- Resend because of SMTP rate limiting.
Changes since v9
- Compatibility with Narrow PARTID and CDP mode
- Fix several sashiko reported issues:
- Return -EBUSY when a CLOSID's RMIDs are only in limbo
- Skip the monitor-context allocation on the force-free limbo path
- Return an correct error pointer from resctrl_arch_mon_ctx_alloc()
on failure.
- Widen the PARTID reset loop counter to u32 to fix the 65536 wrap.
- Fix MPAM enable issue when a MSC fails to probe (e.g. nr_cpus= clipping
the possible CPUs).
- Add KUnit tests for the narrow-PARTID helpers.
- Link to v9: https://lore.kernel.org/all/20261012082337.822258-1-ruanjinjie@xxxxxxxxxx/
Link: https://sashiko.dev/#/patchset/20261012082337.822258-1-ruanjinjie%40huawei.com
Previous Versions
=================
v9: https://lore.kernel.org/all/20261012082337.822258-1-ruanjinjie@xxxxxxxxxx/
v8: https://lore.kernel.org/all/20260413085405.1166412-1-zengheng4@xxxxxxxxxx/
v7: https://lore.kernel.org/all/20260317132141.1272506-1-zengheng4@xxxxxxxxxx/
v6: https://lore.kernel.org/all/20250222112448.2438586-1-zengheng4@xxxxxxxxxx/
v5: https://lore.kernel.org/all/20250217031852.2014939-1-zengheng4@xxxxxxxxxx/
RFC-v4: https://lore.kernel.org/all/20250104101224.873926-1-zengheng4@xxxxxxxxxx/
RFC-v3: https://lore.kernel.org/all/20241207092136.2488426-1-zengheng4@xxxxxxxxxx/
RFC-v2: https://lore.kernel.org/all/20241119135104.595630-1-zengheng4@xxxxxxxxxx/
RFC-v1: https://lore.kernel.org/all/20241114135037.918470-1-zengheng4@xxxxxxxxxx/
Jinjie Ruan (13):
fs/resctrl: Return -EBUSY when per-CLOSID RMIDs are in limbo
fs/resctrl: Skip monitor context allocation when force-freeing RMIDs
arm_mpam: Fix error return in resctrl_arch_mon_ctx_alloc()
arm_mpam: Fix infinite PARTID reset loop when 65536 PARTIDs are
supported
arm_mpam: Don't stall MPAM enable when an MSC fails to probe
fs/resctrl: Add resctrl_arch_rmid_idx_match() helper
arm_mpam: resctrl: Add resctrl_closid_rmid_to_partid_pmg() helper
arm_mpam: Add a helper to check a PARTID is in a CLOSID
arm_mpam: Track the PARTID and internal PARTID limits per class
arm_mpam: Divide the PARTIDs between the control groups
arm_mpam: Identify the non-aliasing controls
arm_mpam: Use the request PARTIDs beyond the internal range
arm_mpam: resctrl: Add kunit tests for narrow PARTID helpers
Zeng Heng (2):
fs/resctrl: Unmount resctrl with the CDP state it was mounted with
arm_mpam: Map resctrl RMIDs onto the request PARTIDs
arch/x86/include/asm/resctrl.h | 6 +
drivers/resctrl/.kunitconfig | 4 +
drivers/resctrl/mpam_devices.c | 160 ++++++++--
drivers/resctrl/mpam_internal.h | 25 ++
drivers/resctrl/mpam_resctrl.c | 227 +++++++++++---
drivers/resctrl/test_mpam_resctrl.c | 466 ++++++++++++++++++++++++++++
fs/resctrl/monitor.c | 36 ++-
fs/resctrl/rdtgroup.c | 46 ++-
include/linux/arm_mpam.h | 1 +
9 files changed, 889 insertions(+), 82 deletions(-)
create mode 100644 drivers/resctrl/.kunitconfig
--
2.34.1