[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <ffc80ae1-cbed-438e-af19-25006fbf4545@arm.com>
Date: Tue, 16 Dec 2025 16:58:32 +0000
From: Ben Horgan <ben.horgan@....com>
To: James Morse <james.morse@....com>, linux-kernel@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org
Cc: D Scott Phillips OS <scott@...amperecomputing.com>,
carl@...amperecomputing.com, lcherian@...vell.com,
bobo.shaobowang@...wei.com, tan.shaopeng@...itsu.com,
baolin.wang@...ux.alibaba.com, Jamie Iles <quic_jiles@...cinc.com>,
Xin Hao <xhao@...ux.alibaba.com>, peternewman@...gle.com,
dfustini@...libre.com, amitsinght@...vell.com,
David Hildenbrand <david@...nel.org>, Dave Martin <dave.martin@....com>,
Koba Ko <kobak@...dia.com>, Shanker Donthineni <sdonthineni@...dia.com>,
fenghuay@...dia.com, baisheng.gao@...soc.com,
Jonathan Cameron <jonathan.cameron@...wei.com>, Gavin Shan
<gshan@...hat.com>, rohit.mathew@....com, reinette.chatre@...el.com,
Punit Agrawal <punit.agrawal@....qualcomm.com>
Subject: Re: [RFC PATCH 24/38] arm_mpam: resctrl: Allow resctrl to allocate
monitors
Hi James,
On 12/5/25 21:58, James Morse wrote:
> When resctrl wants to read a domain's 'QOS_L3_OCCUP', it needs
> to allocate a monitor on the corresponding resource. Monitors are
> allocated by class instead of component.
>
> MBM monitors are much more complicated, if there are enough monitors,
> they will be pre-allocated and free-running. If ABMC is in use instead
> then 'some' are pre-allocated in a different way, and need assigning.
>
> Add helpers to allocate a CSU monitor. These helper return an out
> of range value for MBM counters.
>
> Allocating a montitor context is expected to block until hardware
> resources become available. This only makes sense for QOS_L3_OCCUP
> as unallocated MBM counters are losing data.
>
> Signed-off-by: James Morse <james.morse@....com>
> ---
> Since ABMC got merged it may be possible to remove the monitor alloc
> call for MBM counters from resctrl as this work is now done by ABMC's
> assign call.
> ---
> drivers/resctrl/mpam_internal.h | 14 ++++++-
> drivers/resctrl/mpam_resctrl.c | 68 +++++++++++++++++++++++++++++++++
> include/linux/arm_mpam.h | 4 ++
> 3 files changed, 85 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/resctrl/mpam_internal.h b/drivers/resctrl/mpam_internal.h
> index 05101186af17..3a68ebd498fa 100644
> --- a/drivers/resctrl/mpam_internal.h
> +++ b/drivers/resctrl/mpam_internal.h
> @@ -32,6 +32,14 @@ DECLARE_STATIC_KEY_FALSE(mpam_enabled);
> #define PACKED_FOR_KUNIT
> #endif
>
> +/*
> + * This 'mon' values must not alias an actual monitor, so must be larger than
> + * U16_MAX, but not be confused with an errno value, so smaller than
> + * (u32)-SZ_4K.
> + * USE_PRE_ALLOCATED is used to avoid confusion with an actual monitor.
> + */
> +#define USE_PRE_ALLOCATED (U16_MAX + 1)
> +
> static inline bool mpam_is_enabled(void)
> {
> return static_branch_likely(&mpam_enabled);
> @@ -215,7 +223,11 @@ enum mon_filter_options {
> };
>
> struct mon_cfg {
> - u16 mon;
> + /*
> + * mon must be large enough to hold out of range values like
> + * USE_RMID_IDX
> + */
USE_RMID_IDX -> USE_PRE_ALLOCATED
Thanks,
Ben
Powered by blists - more mailing lists