mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH next] arm_mpam: Fix MBA alloc_capable handling
@ 2026-04-13  9:00 Zeng Heng
  2026-04-17  9:52 ` Ben Horgan
  0 siblings, 1 reply; 5+ messages in thread
From: Zeng Heng @ 2026-04-13  9:00 UTC (permalink / raw)
  To: gshan, reinette.chatre, ben.horgan, fenghuay, james.morse,
	jonathan.cameron, tan.shaopeng
  Cc: linux-kernel, jic23, wangkefeng.wang

The resctrl_arch_set_cdp_enabled() is never invoked with RDT_RESOURCE_MBA
as the rid parameter. Consequently,
mpam_resctrl_controls[RDT_RESOURCE_MBA].cdp_enabled always remains false,
making it unreliable for conditional checks.

The original logic uses this field to determine MBA state, causing a bug
where MBA allocation is permanently disabled after the mount with CDP
option. Remounting without CDP cannot restore the MBA partition capability.

Fix by using the cdp_enabled global parameter directly. Enable MBA
partition only when CDP is disabled and the MBA resource class is
present. Disable MBA partition otherwise.

Fixes: 6789fb99282c ("arm_mpam: resctrl: Add CDP emulation")
Signed-off-by: Zeng Heng <zengheng4@huawei.com>
---
 drivers/resctrl/mpam_resctrl.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/resctrl/mpam_resctrl.c b/drivers/resctrl/mpam_resctrl.c
index a9938006d0e6..161fb8905e28 100644
--- a/drivers/resctrl/mpam_resctrl.c
+++ b/drivers/resctrl/mpam_resctrl.c
@@ -217,12 +217,10 @@ int resctrl_arch_set_cdp_enabled(enum resctrl_res_level rid, bool enable)
 		l3->mon.num_rmid = resctrl_arch_system_num_rmid_idx();
 
 	/* The mbw_max feature can't hide cdp as it's a per-partid maximum. */
-	if (cdp_enabled && !mpam_resctrl_controls[RDT_RESOURCE_MBA].cdp_enabled)
-		mpam_resctrl_controls[RDT_RESOURCE_MBA].resctrl_res.alloc_capable = false;
-
-	if (mpam_resctrl_controls[RDT_RESOURCE_MBA].cdp_enabled &&
-	    mpam_resctrl_controls[RDT_RESOURCE_MBA].class)
+	if (!cdp_enabled && mpam_resctrl_controls[RDT_RESOURCE_MBA].class)
 		mpam_resctrl_controls[RDT_RESOURCE_MBA].resctrl_res.alloc_capable = true;
+	else
+		mpam_resctrl_controls[RDT_RESOURCE_MBA].resctrl_res.alloc_capable = false;
 
 	if (enable) {
 		if (mpam_partid_max < 1)
-- 
2.25.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-04-18  6:14 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-04-13  9:00 [PATCH next] arm_mpam: Fix MBA alloc_capable handling Zeng Heng
2026-04-17  9:52 ` Ben Horgan
2026-04-17 16:07   ` James Morse
2026-04-17 16:31     ` Ben Horgan
2026-04-18  6:14     ` Zeng Heng

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®