[RFC PATCH v2 07/10] arm_mpam: resctrl: Warn when no monitoring component is found for a CPU

From: Reinette Chatre

Date: Mon Oct 19 2026 - 18:10:06 EST


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;
- }

mpam_resctrl_domain_hdr_init(cpu, any_mon_comp, r->rid, &mon_d->hdr);
mon_d->hdr.type = RESCTRL_MON_DOMAIN;
--
2.55.0