mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [RFC PATCH v3 00/19] arm_mpam: Add L2 cache monitors
@ 2026-11-16 12:58 Jinjie Ruan
  2026-11-16 12:58 ` [RFC PATCH v3 01/19] fs/resctrl: Rename monitor events to drop the L3 prefix Jinjie Ruan
                   ` (19 more replies)
  0 siblings, 20 replies; 21+ messages in thread
From: Jinjie Ruan @ 2026-11-16 12:58 UTC (permalink / raw)
  To: james.morse, ben.horgan, reinette.chatre, fenghuay,
	catalin.marinas, will, mark.rutland, corbet, skhan, rdunlap,
	tony.luck, Dave.Martin, babu.moger, fustini, tglx, mingo, bp,
	dave.hansen, hpa, x86, linux-arm-kernel, linux-doc, linux-kernel
  Cc: ruanjinjie

Resctrl exposes cache occupancy and bandwidth monitoring only at the L3
scope. MPAM can count the same things on an L2 cache: firmware points
an MSC at the cache it belongs to, and its CSU and MBWU counters can
report the occupancy of that L2 slice and the traffic the cache sees.

This series first reworks resctrl's monitor bookkeeping to track events
by scope instead of by resource, and then exposes those counters as
"l2c_occupancy" and "mbm_core_bytes"

The patch set is organized as follows:

- Patches 1-4:   Rename to drop the L3 prefix
- Patches 5-7:   Rework the bookkeeping, index monitor state by resource
                 and event, index the event table by scope and eventid
- Patches 8-13:  Make the core per-resource and add the L2 events
- Patches 14-18: Let the driver pick L2 classes for the L2 resource,
		 and expose the L2 events
- Patch 19:	 Update the documentation

Notes on the user interface
===========================

The L3 event names and semantics, the L3_MON and mon_L3_xx names and
the x86 PERF_PKG files are unchanged.

The L2 bandwidth event is called mbm_core_bytes because it counts the
bytes the L2 cache sees, which is not memory bandwidth.

And mbm_L3_assignments remains L3-only.

Testing
=======

QEMU, topology with L2, L3 and memory-controller MSCs:

- info/L2_MON lists l2c_occupancy and mbm_core_bytes, and per-core
  mon_L2_xx directories are created.

- Reads: l2c_occupancy 262144 bytes (50% of a 512KiB L2),
  llc_occupancy unchanged, mbm_core_bytes advances about 20GB per 2s
  sample.

- CDP halves num_closids and the monitor counts of every monitor
  resource.

- RMID limbo: a freed RMID is marked busy in every L2 and L3 monitor
  domain, and becomes allocatable again once those domains are
  offlined and the busy count reaches zero.

QEMU branch: https://github.com/ruanjinjie-eng/qemu/tree/mpam
Test cases: https://github.com/ruanjinjie-eng/mpam_testcase

This series is rebased on v7.4 rc3 and also available at:
	https://github.com/ruanjinjie-eng/linux/commits/mpam-l2mon-scope

Changes in RFC v3
- The event table is indexed by scope instead of by resource (Reinette)
- Patch 6 is split out so no helper takes an unused argument.
- The RMID limbo threshold is kept per resource, so an L3 domain no
  longer compares its occupancy with an L2-sized value
- Bugfixes are split out  as their own series.
- RFC v2: https://lore.kernel.org/all/20261029123611.1108424-1-ruanjinjie@huawei.com/

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):
  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
  x86,fs/resctrl: Record the resource that enables a monitor event
  x86,fs/resctrl: Track monitor events by scope
  fs/resctrl: Generalize __l3_mon_event_count for non-L3 resources
  fs/resctrl: Add the L2 monitor events
  fs/resctrl: Set up MBM state and workers for every monitor resource
  resctrl: Keep the RMID limbo threshold per resource
  fs/resctrl: Check RMID limbo on every resource with occupancy
  fs/resctrl: Manage assignable counters for every monitor resource
  arm_mpam: resctrl: Halve the monitor counts of every resource on CDP
  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       |  25 +-
 Documentation/filesystems/resctrl.rst   |  11 +
 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   |  10 +-
 arch/x86/kernel/cpu/resctrl/rdtgroup.c  |   8 +-
 drivers/resctrl/mpam_resctrl.c          | 357 ++++++++++++++----------
 fs/resctrl/ctrlmondata.c                |  13 +-
 fs/resctrl/internal.h                   |  55 +++-
 fs/resctrl/monitor.c                    | 328 +++++++++++++---------
 fs/resctrl/rdtgroup.c                   | 158 ++++++-----
 include/linux/resctrl.h                 |  36 ++-
 include/linux/resctrl_types.h           |  16 +-
 14 files changed, 619 insertions(+), 415 deletions(-)

-- 
2.34.1


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

end of thread, other threads:[~2026-11-27  2:42 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-16 12:58 [RFC PATCH v3 00/19] arm_mpam: Add L2 cache monitors Jinjie Ruan
2026-11-16 12:58 ` [RFC PATCH v3 01/19] fs/resctrl: Rename monitor events to drop the L3 prefix Jinjie Ruan
2026-11-16 12:58 ` [RFC PATCH v3 02/19] x86/resctrl: Use the resource-agnostic monitor event names Jinjie Ruan
2026-11-16 12:58 ` [RFC PATCH v3 03/19] arm_mpam: resctrl: " Jinjie Ruan
2026-11-16 12:58 ` [RFC PATCH v3 04/19] resctrl: Remove the L3 " Jinjie Ruan
2026-11-16 12:59 ` [RFC PATCH v3 05/19] arm_mpam: resctrl: Index monitor state by resource and event Jinjie Ruan
2026-11-16 12:59 ` [RFC PATCH v3 06/19] x86,fs/resctrl: Record the resource that enables a monitor event Jinjie Ruan
2026-11-16 12:59 ` [RFC PATCH v3 07/19] x86,fs/resctrl: Track monitor events by scope Jinjie Ruan
2026-11-16 12:59 ` [RFC PATCH v3 08/19] fs/resctrl: Generalize __l3_mon_event_count for non-L3 resources Jinjie Ruan
2026-11-16 12:59 ` [RFC PATCH v3 09/19] fs/resctrl: Add the L2 monitor events Jinjie Ruan
2026-11-16 12:59 ` [RFC PATCH v3 10/19] fs/resctrl: Set up MBM state and workers for every monitor resource Jinjie Ruan
2026-11-16 12:59 ` [RFC PATCH v3 11/19] resctrl: Keep the RMID limbo threshold per resource Jinjie Ruan
2026-11-16 12:59 ` [RFC PATCH v3 12/19] fs/resctrl: Check RMID limbo on every resource with occupancy Jinjie Ruan
2026-11-16 12:59 ` [RFC PATCH v3 13/19] fs/resctrl: Manage assignable counters for every monitor resource Jinjie Ruan
2026-11-16 12:59 ` [RFC PATCH v3 14/19] arm_mpam: resctrl: Halve the monitor counts of every resource on CDP Jinjie Ruan
2026-11-16 12:59 ` [RFC PATCH v3 15/19] arm_mpam: resctrl: Look up the monitor domain id from the components Jinjie Ruan
2026-11-16 12:59 ` [RFC PATCH v3 16/19] arm_mpam: resctrl: Report counter assignment per resource Jinjie Ruan
2026-11-16 12:59 ` [RFC PATCH v3 17/19] arm_mpam: resctrl: Allow monitoring on resources other than the L3 Jinjie Ruan
2026-11-16 12:59 ` [RFC PATCH v3 18/19] arm_mpam: resctrl: Expose the L2 monitor events Jinjie Ruan
2026-11-16 12:59 ` [RFC PATCH v3 19/19] Documentation: arm64: mpam: Describe " Jinjie Ruan
2026-11-27  2:42 ` [RFC PATCH v3 00/19] arm_mpam: Add L2 cache monitors Jinjie Ruan

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

all inboxes | Powered by JetHome®