[PATCH v2 12/12] arm_mpam: resctrl: Don't stop early when tearing down a class
Ben Horgan
ben.horgan at arm.com
Thu Sep 17 07:56:17 PDT 2026
An MPAM class can back more than one control and more than one
monitor. mpam_resctrl_teardown_class() iterates through all the controls
but stops if it finds a match which means classes backing more than one
class aren't torn down. The same for monitors, in which case the mbwu
counters will be leaked.
Stop terminating the loops early.
As we are already changing mpam_resctrl_teardown_class() remove the
misleading comment. It doesn't call resctrl_exit() and isn't required to do
so as the only caller does it first.
Fixes: fb481ec08699 ("arm_mpam: resctrl: Call resctrl_init() on platforms that can support resctrl")
Reported-by: Sashiko <sashiko-bot at kernel.org>
Signed-off-by: Ben Horgan <ben.horgan at arm.com>
---
Changes since v1:
New patch
---
drivers/resctrl/mpam_resctrl.c | 9 +--------
1 file changed, 1 insertion(+), 8 deletions(-)
diff --git a/drivers/resctrl/mpam_resctrl.c b/drivers/resctrl/mpam_resctrl.c
index 321741a702fe..9cec5843e8fa 100644
--- a/drivers/resctrl/mpam_resctrl.c
+++ b/drivers/resctrl/mpam_resctrl.c
@@ -1943,10 +1943,6 @@ static void mpam_resctrl_teardown_mon(struct mpam_resctrl_mon *mon, struct mpam_
mon->mbwu_idx_to_mon = NULL;
}
-/*
- * The driver is detaching an MSC from this class, if resctrl was using it,
- * pull on resctrl_exit().
- */
void mpam_resctrl_teardown_class(struct mpam_class *class)
{
struct mpam_resctrl_res *res;
@@ -1957,17 +1953,14 @@ void mpam_resctrl_teardown_class(struct mpam_class *class)
might_sleep();
for_each_mpam_resctrl_control(res, rid) {
- if (res->class == class) {
+ if (res->class == class)
res->class = NULL;
- break;
- }
}
for_each_mpam_resctrl_mon(mon, eventid) {
if (mon->class == class) {
mon->class = NULL;
mpam_resctrl_teardown_mon(mon, class);
- break;
}
}
}
--
2.43.0
More information about the linux-arm-kernel
mailing list