Re: [RFC PATCH v2 07/10] arm_mpam: resctrl: Warn when no monitoring component is found for a CPU
From: Jinjie Ruan
Date: Mon Oct 26 2026 - 09:17:55 EST
在 2026/10/20 6:07, Reinette Chatre 写道:
> Setting up a monitoring domain fails if no monitoring class has a
> component that contains the CPU. This is not expected to happen: a
> resource only supports monitoring when at least one monitoring class
> was picked, and only classes that cover all possible CPUs are picked
> for monitoring.
>
> The failure path calls WARN_ON_ONCE(0), which never warns. The
> unexpected failure is thus silent and the CPU is left without a
> monitoring domain with nothing reporting why.
>
> Warn when no monitoring component is found for the CPU, as is already
> done when setting up a control domain finds no component in the
> resource's class.
>
> Signed-off-by: Reinette Chatre <reinette.chatre@xxxxxxxxx>
> ---
> drivers/resctrl/mpam_resctrl.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/drivers/resctrl/mpam_resctrl.c b/drivers/resctrl/mpam_resctrl.c
> index 022920be1862..63c5bf45856d 100644
> --- a/drivers/resctrl/mpam_resctrl.c
> +++ b/drivers/resctrl/mpam_resctrl.c
> @@ -1665,10 +1665,8 @@ static int mpam_resctrl_setup_mon_domain(unsigned int cpu,
> if (mon_comp)
> any_mon_comp = mon_comp;
> }
> - if (!any_mon_comp) {
> - WARN_ON_ONCE(0);
> + if (WARN_ON_ONCE(!any_mon_comp))
> return -EFAULT;
> - }
Reviewed-by: Jinjie Ruan <ruanjinjie@xxxxxxxxxx>
>
> mpam_resctrl_domain_hdr_init(cpu, any_mon_comp, r->rid, &mon_d->hdr);
> mon_d->hdr.type = RESCTRL_MON_DOMAIN;
--
Best regards,
Jinjie