[PATCH v2] arm_mpam: Only schedule mpam_enable work after first successful MSC probe
From: ping.li
Date: Mon Sep 07 2026 - 22:49:34 EST
From: Ping Li <leeonion.muyu@xxxxxxxxx>
mpam_discovery_cpu_online() sets new_device_probed unconditionally after
processing each reachable MSC. Once an MSC has already been probed
(msc->probed is true), later CPUs sharing it skip
mpam_msc_hw_probe() but still leave err at its default value of 0.
As a result, new_device_probed is still set to true, causing
mpam_enable_work to be scheduled again even though no new hardware was
probed.
Set new_device_probed only when mpam_msc_hw_probe() is called and
succeeds.
Signed-off-by: Ping Li <leeonion.muyu@xxxxxxxxx>
---
Changes in v2:
- Drop the Fixes: tag, as the extra mpam_enable() calls cause no real
harm: schedule_work() merges the duplicate work, and mpam_enable()
is a no-op until all MSCs have been probed. This is a cleanup, not a
bug fix.
drivers/resctrl/mpam_devices.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/resctrl/mpam_devices.c b/drivers/resctrl/mpam_devices.c
index 2f09f4b78bd3..fefdcf588932 100644
--- a/drivers/resctrl/mpam_devices.c
+++ b/drivers/resctrl/mpam_devices.c
@@ -1866,13 +1866,15 @@ static int mpam_discovery_cpu_online(unsigned int cpu)
continue;
mutex_lock(&msc->probe_lock);
- if (!msc->probed)
+ if (!msc->probed) {
err = mpam_msc_hw_probe(msc);
+ if (!err)
+ new_device_probed = true;
+ }
mutex_unlock(&msc->probe_lock);
if (err)
break;
- new_device_probed = true;
}
if (new_device_probed && !err)
--
2.34.1