Linux Documentation
 help / color / mirror / Atom feed
* [RFC PATCH v2 00/19] resctrl: Generalize monitor events across resources
@ 2026-10-29 12:35 Jinjie Ruan
  2026-10-29 12:35 ` [RFC PATCH v2 01/19] arm_mpam: resctrl: Leave CDP off when there are too few PARTIDs Jinjie Ruan
                   ` (19 more replies)
  0 siblings, 20 replies; 22+ messages in thread
From: Jinjie Ruan @ 2026-10-29 12:35 UTC (permalink / raw)
  To: reinette.chatre, james.morse, ben.horgan, fenghuay,
	catalin.marinas, will, mark.rutland, corbet, skhan, rdunlap,
	tony.luck, Dave.Martin, babu.moger, tglx, mingo, bp, dave.hansen,
	hpa, tan.shaopeng, jic23, zengheng4, gshan, x86, linux-arm-kernel,
	linux-doc, linux-kernel, linux-riscv
  Cc: ruanjinjie

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


^ permalink raw reply	[flat|nested] 22+ messages in thread

end of thread, other threads:[~2026-10-30 17:09 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-29 12:35 [RFC PATCH v2 00/19] resctrl: Generalize monitor events across resources Jinjie Ruan
2026-10-29 12:35 ` [RFC PATCH v2 01/19] arm_mpam: resctrl: Leave CDP off when there are too few PARTIDs Jinjie Ruan
2026-10-30 16:38   ` Ben Horgan
2026-10-29 12:35 ` [RFC PATCH v2 02/19] fs/resctrl: Generalize __l3_mon_event_count for non-L3 resources Jinjie Ruan
2026-10-29 12:35 ` [RFC PATCH v2 03/19] fs/resctrl: Rename monitor events to drop the L3 prefix Jinjie Ruan
2026-10-29 12:35 ` [RFC PATCH v2 04/19] x86/resctrl: Use the resource-agnostic monitor event names Jinjie Ruan
2026-10-29 12:35 ` [RFC PATCH v2 05/19] arm_mpam: resctrl: " Jinjie Ruan
2026-10-29 12:35 ` [RFC PATCH v2 06/19] resctrl: Remove the L3 " Jinjie Ruan
2026-10-29 12:35 ` [RFC PATCH v2 07/19] arm_mpam: resctrl: Index monitor state by resource and event Jinjie Ruan
2026-10-29 12:36 ` [RFC PATCH v2 08/19] arm_mpam: resctrl: Halve the monitor counts of every resource on CDP Jinjie Ruan
2026-10-29 12:36 ` [RFC PATCH v2 09/19] x86,fs/resctrl: Pass the resource to the monitor event helpers Jinjie Ruan
2026-10-29 12:36 ` [RFC PATCH v2 10/19] fs/resctrl: Track monitor events per resource Jinjie Ruan
2026-10-29 12:36 ` [RFC PATCH v2 11/19] fs/resctrl: Add the L2 monitor events Jinjie Ruan
2026-10-29 12:36 ` [RFC PATCH v2 12/19] fs/resctrl: Set up MBM state and workers for every monitor resource Jinjie Ruan
2026-10-29 12:36 ` [RFC PATCH v2 13/19] fs/resctrl: Check RMID limbo on every resource with occupancy Jinjie Ruan
2026-10-29 12:36 ` [RFC PATCH v2 14/19] fs/resctrl: Manage assignable counters for every monitor resource Jinjie Ruan
2026-10-29 12:36 ` [RFC PATCH v2 15/19] arm_mpam: resctrl: Look up the monitor domain id from the components Jinjie Ruan
2026-10-29 12:36 ` [RFC PATCH v2 16/19] arm_mpam: resctrl: Report counter assignment per resource Jinjie Ruan
2026-10-29 12:36 ` [RFC PATCH v2 17/19] arm_mpam: resctrl: Allow monitoring on resources other than the L3 Jinjie Ruan
2026-10-29 12:36 ` [RFC PATCH v2 18/19] arm_mpam: resctrl: Expose the L2 monitor events Jinjie Ruan
2026-10-29 12:36 ` [RFC PATCH v2 19/19] Documentation: arm64: mpam: Describe " Jinjie Ruan
2026-10-30 17:09 ` [RFC PATCH v2 00/19] resctrl: Generalize monitor events across resources Reinette Chatre

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox