Re: [PATCH v12 09/13] arm_mpam: propagate MSC access errors in mpam_reset_class_locked()
From: Ben Horgan
Date: Fri Oct 02 2026 - 11:42:59 EST
Hi Andre,
On 01/10/2026 16:34, Andre Przywara wrote:
> The mpam_reset_ris() function can return an error, propagate this up
> through mpam_reset_component_locked() to mpam_reset_class_locked(),
> which is exported. The external caller is a void function, so cannot
> really handle the error at the moment, but at least we report everything
> on the MPAM interface side.
>
> Signed-off-by: Andre Przywara <andre.przywara@xxxxxxx>
> Reviewed-by: Jonathan Cameron <jonathan.cameron@xxxxxxxxxxxxxxxx>
Reviewed-by: Ben Horgan <ben.horgan@xxxxxxx>
Thanks,
Ben
> ---
> drivers/resctrl/mpam_devices.c | 24 ++++++++++++++++++------
> drivers/resctrl/mpam_internal.h | 2 +-
> 2 files changed, 19 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/resctrl/mpam_devices.c b/drivers/resctrl/mpam_devices.c
> index 60f6a39176ea1..c639aaa5f38e1 100644
> --- a/drivers/resctrl/mpam_devices.c
> +++ b/drivers/resctrl/mpam_devices.c
> @@ -3007,7 +3007,7 @@ static void mpam_enable_once(void)
> mpam_partid_max + 1, mpam_pmg_max + 1);
> }
>
> -static void mpam_reset_component_locked(struct mpam_component *comp)
> +static int mpam_reset_component_locked(struct mpam_component *comp)
> {
> struct mpam_vmsc *vmsc;
>
> @@ -3021,26 +3021,38 @@ static void mpam_reset_component_locked(struct mpam_component *comp)
> srcu_read_lock_held(&mpam_srcu)) {
> struct mpam_msc *msc = vmsc->msc;
> struct mpam_msc_ris *ris;
> + int ret;
>
> list_for_each_entry_srcu(ris, &vmsc->ris, vmsc_list,
> srcu_read_lock_held(&mpam_srcu)) {
> - if (!ris->in_reset_state)
> - mpam_touch_msc(msc, mpam_reset_ris, ris);
> + if (!ris->in_reset_state) {
> + ret = mpam_touch_msc(msc, mpam_reset_ris, ris);
> + if (ret)
> + return ret;
> + }
> ris->in_reset_state = true;
> }
> }
> +
> + return 0;
> }
>
> -void mpam_reset_class_locked(struct mpam_class *class)
> +int mpam_reset_class_locked(struct mpam_class *class)
> {
> struct mpam_component *comp;
> + int ret;
>
> lockdep_assert_cpus_held();
>
> guard(srcu)(&mpam_srcu);
> list_for_each_entry_srcu(comp, &class->components, class_list,
> - srcu_read_lock_held(&mpam_srcu))
> - mpam_reset_component_locked(comp);
> + srcu_read_lock_held(&mpam_srcu)) {
> + ret = mpam_reset_component_locked(comp);
> + if (ret)
> + return ret;
> + }
> +
> + return 0;
> }
>
> static void mpam_reset_class(struct mpam_class *class)
> diff --git a/drivers/resctrl/mpam_internal.h b/drivers/resctrl/mpam_internal.h
> index 68a6cf2b9cc73..09f8168fb4d2c 100644
> --- a/drivers/resctrl/mpam_internal.h
> +++ b/drivers/resctrl/mpam_internal.h
> @@ -465,7 +465,7 @@ void mpam_enable(struct work_struct *work);
> void mpam_disable(struct work_struct *work);
>
> /* Reset all the RIS in a class under cpus_read_lock() */
> -void mpam_reset_class_locked(struct mpam_class *class);
> +int mpam_reset_class_locked(struct mpam_class *class);
>
> int mpam_apply_config(struct mpam_component *comp, u16 partid,
> struct mpam_config *cfg);