[PATCH v5 26/41] arm_mpam: resctrl: Add monitor initialisation and domain boilerplate

Jonathan Cameron jonathan.cameron at huawei.com
Wed Feb 25 03:14:01 PST 2026


On Tue, 24 Feb 2026 17:57:05 +0000
Ben Horgan <ben.horgan at arm.com> wrote:

> Add the boilerplate that tells resctrl about the mpam monitors that are
> available. resctrl expects all (non-telemetry) monitors to be on the L3 and
> so advertise them there and invent an L3 resctrl resource if required. The
> L3 cache itself has to exist as the cache ids are used as the domain
> ids.
> 
> Bring the resctrl monitor domains online and offline based on the cpus
> they contain.
> 
> Support for specific monitor types is left to later.
> 
> Signed-off-by: Ben Horgan <ben.horgan at arm.com>
> ---
> New patch but mostly moved from the existing patches to
> separate the monitors from the controls and the boilerplate
> from the specific counters.
> Use l3->mon_capable in resctrl_arch_mon_capable() as
> resctrl_enable_mon_event() now returns a bool.

Just one trivial comment on short line wrap. I'm not that fussed though so
I don't mind if you only tidy that up if doing a v6.

Reviewed-by: Jonathan Cameron <jonathan.cameron at huawei.com>

> diff --git a/drivers/resctrl/mpam_resctrl.c b/drivers/resctrl/mpam_resctrl.c
> index 29efcad163e6..c14e59e8586d 100644
> --- a/drivers/resctrl/mpam_resctrl.c
> +++ b/drivers/resctrl/mpam_resctrl.c

> +static int mpam_resctrl_monitor_init(struct mpam_resctrl_mon *mon,
> +				     enum resctrl_event_id type)
> +{

...

> +
> +	/*
> +	 * num-rmid is the upper bound for the number of monitoring
> +	 * groups that can exist simultaneously, including the
> +	 * default monitoring group for each control group. Hence,
> +	 * advertise the whole rmid_idx space even though each
> +	 * control group has its own pmg/rmid space. Unfortunately,
> +	 * this does mean userspace needs to know the architecture
> +	 * to correctly interpret this value.
Trivial but that's an oddly short wrap.  Should be.
	 * num-rmid is the upper bound for the number of monitoring groups that
	 * can exist simultaneously, including the default monitoring group for
	 * each control group. Hence, advertise the whole rmid_idx space even 
	 * though each control group has its own pmg/rmid space. Unfortunately,
	 * this does mean userspace needs to know the architecture to correctly
	 * interpret this value.

The wonder of an email client with rulers :)

J
> +	 */
> +	l3->mon.num_rmid = resctrl_arch_system_num_rmid_idx();
> +
> +	if (resctrl_enable_mon_event(type, false, 0, NULL))
> +		l3->mon_capable = true;
> +
> +	return 0;
> +}




More information about the linux-arm-kernel mailing list