[RFC PATCH 00/13] resctrl: Introduce a framework for logical control IDs

From: Yunhui Cui

Date: Sun Nov 29 2026 - 21:30:08 EST


Some resource controllers can accept a wider request-ID namespace than
the number of configuration entries they provide. Arm MPAM PARTID
narrowing is one example: requests carry a PARTID, while an MSC maps it
to a smaller internal PARTID table. A future RISC-V CBQRI backend is
expected to need a similar mapping from request RCIDs to controller-local
entries. Resctrl currently uses one ID both to identify a control group
and to select its hardware entry, so the smallest table limits the number
of groups exposed to user space.

The framework uses a logical control ID in generic resctrl while each
architecture selects a hardware entry according to its own model:

generic resctrl
logical control ID
|
+------------------+------------------+
| | |
x86 arm64 MPAM RISC-V CBQRI
direct index MSC mapping mapping (proposed)
| | |
hardware entry internal PARTID controller entry

Without controller-local request-ID mapping, the same request ID directly
indexes every controller. If g1 configures only A and g2 only B, g1
cannot select its private entry in A and B's root entry while g2 makes
the opposite selection. Each group therefore consumes an entry in both
controllers. Controller-local mapping makes these selections independent,
so A needs entries only for the root group and g1 while B needs only the
root group and g2.

This series gives control groups logical IDs. A new group initially
selects the root policy and consumes no private entry on a narrowing
controller. Its first explicit policy write allocates and programs an
entry only on the affected controllers, then publishes the
request-to-internal ID mapping. Controllers that have not been configured
continue to follow the root policy. A same-value write still creates a
private policy, so a later root update does not change it.

Entry reservation is completed before a multi-controller policy update
and mapping changes are published only after the entries are programmed.
Group removal maps requests back to the root entry before an internal
entry or logical ID can be reused. CDP keeps separate data and code root
entries so the default policies remain distinct.

Identity-mapped architectures retain their current behavior, and I/O
allocation continues to address a hardware entry directly. The generic
framework supports both direct-index and mapped controllers. The RISC-V
backend itself is outside this series.

Base: next-20261127

Yunhui Cui (13):
resctrl: Introduce interfaces for logical control IDs
resctrl: Add prepare, commit and abort hooks for control updates
resctrl: Add a release hook before logical control ID reuse
arm_mpam: Record PARTID narrowing capacity per MSC
arm_mpam: Select PARTID narrowing per component
arm_mpam: Add an internal PARTID allocator
arm_mpam: Add request-to-internal PARTID mapping
arm_mpam: Apply PARTID narrowing to resctrl control groups
arm_mpam: Separate request and internal PARTID limits
arm_mpam: Map CDP data and code defaults separately
arm_mpam: Add kunit tests for PARTID narrowing
selftests/resctrl: Add a test for control ID allocation and reuse
docs/resctrl: Document logical control IDs and hardware entries

Documentation/filesystems/resctrl.rst | 88 ++
arch/x86/kernel/cpu/resctrl/ctrlmondata.c | 38 +-
drivers/resctrl/mpam_devices.c | 857 +++++++++++++++++-
drivers/resctrl/mpam_internal.h | 25 +-
drivers/resctrl/mpam_resctrl.c | 288 +++++-
drivers/resctrl/test_mpam_devices.c | 619 ++++++++++++-
drivers/resctrl/test_mpam_resctrl.c | 172 ++++
fs/resctrl/ctrlmondata.c | 28 +-
fs/resctrl/rdtgroup.c | 18 +-
include/linux/resctrl.h | 17 +-
.../testing/selftests/resctrl/ctrl_id_test.c | 380 ++++++++
tools/testing/selftests/resctrl/resctrl.h | 1 +
.../testing/selftests/resctrl/resctrl_tests.c | 1 +
13 files changed, 2470 insertions(+), 62 deletions(-)
create mode 100644 tools/testing/selftests/resctrl/ctrl_id_test.c

--
2.39.2 (Apple Git-143)