Re: [PATCH v6 28/40] arm_mpam: resctrl: Add support for csu counters

From: Gavin Shan

Date: Mon Mar 23 2026 - 23:42:24 EST


On 3/14/26 12:46 AM, Ben Horgan wrote:
From: James Morse <james.morse@xxxxxxx>

resctrl exposes a counter via a file named llc_occupancy. This isn't really
a counter as its value goes up and down, this is a snapshot of the cache
storage usage monitor.

Add some picking code which will only find an L3. The resctrl counter
file is called llc_occupancy but we don't check it is the last one as
it is already identified as L3.

Tested-by: Shaopeng Tan <tan.shaopeng@xxxxxxxxxxxxxx>
Tested-by: Zeng Heng <zengheng4@xxxxxxxxxx>
Tested-by: Punit Agrawal <punit.agrawal@xxxxxxxxxxxxxxxx>
Reviewed-by: Zeng Heng <zengheng4@xxxxxxxxxx>
Reviewed-by: Shaopeng Tan <tan.shaopeng@xxxxxxxxxxxxxx>
Reviewed-by: Jonathan Cameron <jonathan.cameron@xxxxxxxxxx>
Signed-off-by: James Morse <james.morse@xxxxxxx>
Co-developed-by: Dave Martin <dave.martin@xxxxxxx>
Signed-off-by: Dave Martin <dave.martin@xxxxxxx>
Signed-off-by: Ben Horgan <ben.horgan@xxxxxxx>
---
Changes since rfc:
Allow csu counters however many partid or pmg there are
else if -> if
reduce scope of local variables
drop has_csu

Changes since v2:
return -> break so works for mbwu in later patch
add for_each_mpam_resctrl_mon
return error from mpam_resctrl_monitor_init(). It may fail when is abmc
allocation introduced in a later patch.
Squashed in patch from Dave Martin:
https://lore.kernel.org/lkml/20250820131621.54983-1-Dave.Martin@xxxxxxx/

Changes since v3:
resctrl_enable_mon_event() signature update
Restrict the events considered
num-rmid update
Use raw_smp_processor_id()
Tighten heuristics:
Make sure it is the L3
Please shout if this means the counters aren't exposed on any platforms
Drop tags due to change in policy/rework

Changes since v4:
Move generic monitor boilerplate to separate patch
---
drivers/resctrl/mpam_resctrl.c | 83 ++++++++++++++++++++++++++++++++++
1 file changed, 83 insertions(+)

Reviewed-by: Gavin Shan <gshan@xxxxxxxxxx>