[RFC PATCH v2 00/19] resctrl: Generalize monitor events across resources
Jinjie Ruan
ruanjinjie at huawei.com
Thu Oct 29 05:35:52 PDT 2026
Resctrl only knows about monitoring at the L3 scope. MPAM monitors are
attached to a resource in an MSC, and firmware says which cache level that
resource is. The driver already finds L2 monitors, but resctrl has
nowhere to show them.
This is not MPAM specific. RISC-V can also place monitors at several
points in the system.
What this series does
=====================
The monitor event IDs lose the L3 from their names and the event
table is indexed by resource and event.
Then L2 can expose l2c_occupancy and mbm_core_bytes. The MBM state,
the overflow worker, RMID limbo and the assignable counters now work
per resource. The MBA software controller stays on the L3.
MPAM keeps its picked class per (resource, event), can pick L2 classes,
and reads L2 bandwidth from an assignable counter.
x86 never has an L2 monitor resource, so its behaviour does not change.
Testing
=======
QEMU with 2 clusters in 1 node: 2 L2 MSCs, 1 L3 MSC, 1 memory MSC.
- Now L2 has its own resctrl interfaces as below:
cat /sys/fs/resctrl/info/L3_MON/mon_features
# llc_occupancy mbm_total_bytes
cat /sys/fs/resctrl/info/L2_MON/mon_features
# l2c_occupancy mbm_core_bytes
ls /sys/fs/resctrl/mon_data
# mon_L2_33685504 mon_L3_33751040
cat /sys/fs/resctrl/mon_data/mon_L3_33751040/llc_occupancy
cat /sys/fs/resctrl/mon_data/mon_L3_33751040/mbm_total_bytes
cat /sys/fs/resctrl/mon_data/mon_L2_33685504/l2c_occupancy
cat /sys/fs/resctrl/mon_data/mon_L2_33685504/mbm_core_bytes
- l2c_occupancy and mbm_core_bytes has real monitoring data as below:
L2_MON: l2c_occupancy = 256 KiB, mbm_core_bytes ~20 GB in 2 s
L3_MON: llc_occupancy = 16 MiB, mbm_total_bytes unchanged
- CDP: the monitor count halves for every monitor resource.
- Unmount/remount and CPU hotplug were also exercised.
- Each patch built for arm64 and x86_64.
QEMU branch: https://github.com/ruanjinjie-eng/qemu/tree/mpam
Test cases: https://github.com/ruanjinjie-eng/mpam_testcase
If everyone agrees the approach is viable, we will next test it
on real hardware.
This series is also available at:
https://github.com/ruanjinjie-eng/linux/tree/mpam-l2mon-rfc_v2_2
Changes in RFC v2
=================
- As Ben suggested, the existing event types now apply to any resource,
instead of adding L2-only event IDs.
- As Ben suggested, L2 bandwidth uses an assignable counter that stays
with the monitoring group, not a monitor borrowed for each read.
- The CDP change also halves the assignable counter count, for every
monitor resource.
- Split by subsystem so resctrl, x86 and MPAM can be reviewed separately.
- Fix a CDP bug: a failed enable left the driver believing CDP was on.
- RFC v1: https://lore.kernel.org/all/20261022084821.4014873-1-ruanjinjie@huawei.com/
Jinjie Ruan (19):
arm_mpam: resctrl: Leave CDP off when there are too few PARTIDs
fs/resctrl: Generalize __l3_mon_event_count for non-L3 resources
fs/resctrl: Rename monitor events to drop the L3 prefix
x86/resctrl: Use the resource-agnostic monitor event names
arm_mpam: resctrl: Use the resource-agnostic monitor event names
resctrl: Remove the L3 monitor event names
arm_mpam: resctrl: Index monitor state by resource and event
arm_mpam: resctrl: Halve the monitor counts of every resource on CDP
x86,fs/resctrl: Pass the resource to the monitor event helpers
fs/resctrl: Track monitor events per resource
fs/resctrl: Add the L2 monitor events
fs/resctrl: Set up MBM state and workers for every monitor resource
fs/resctrl: Check RMID limbo on every resource with occupancy
fs/resctrl: Manage assignable counters for every monitor resource
arm_mpam: resctrl: Look up the monitor domain id from the components
arm_mpam: resctrl: Report counter assignment per resource
arm_mpam: resctrl: Allow monitoring on resources other than the L3
arm_mpam: resctrl: Expose the L2 monitor events
Documentation: arm64: mpam: Describe the L2 monitor events
Documentation/arch/arm64/mpam.rst | 23 +-
Documentation/filesystems/resctrl.rst | 6 +
arch/x86/kernel/cpu/resctrl/core.c | 13 +-
arch/x86/kernel/cpu/resctrl/intel_aet.c | 2 +-
arch/x86/kernel/cpu/resctrl/internal.h | 2 +-
arch/x86/kernel/cpu/resctrl/monitor.c | 4 +-
arch/x86/kernel/cpu/resctrl/rdtgroup.c | 8 +-
drivers/resctrl/mpam_resctrl.c | 362 ++++++++++++++----------
fs/resctrl/ctrlmondata.c | 13 +-
fs/resctrl/internal.h | 13 +-
fs/resctrl/monitor.c | 300 ++++++++++++--------
fs/resctrl/rdtgroup.c | 148 +++++-----
include/linux/resctrl.h | 27 +-
include/linux/resctrl_types.h | 16 +-
14 files changed, 541 insertions(+), 396 deletions(-)
--
2.34.1
More information about the linux-arm-kernel
mailing list