* [RESEND PATCH 1/3] arm_mpam: resctrl: Fix MBA CDP alloc_capable handling on unmount
2026-04-20 14:05 [RESEND PATCH 0/3] arm_mpam: resctrl: Fixes for v7.1-rc1 James Morse
@ 2026-04-20 14:05 ` James Morse
2026-04-20 14:05 ` [RESEND PATCH 2/3] arm_mpam: resctrl: Fix the check for no monitor components found James Morse
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: James Morse @ 2026-04-20 14:05 UTC (permalink / raw)
To: catalin.marinas; +Cc: linux-arm-kernel, will, Ben Horgan, Gavin Shan, Zeng Heng
From: Zeng Heng <zengheng4@huawei.com>
The code to set MBA's alloc_capable to true appears to be trying to
restore alloc_capable on unmount. This can never work because
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.
The alloc_capable setting in resctrl_arch_set_cdp_enabled() is to
re-enable MBA if the caller opts in to separate control values using
CDP for this resource. This doesn't happen today.
Add a comment to describe this.
However a bug remains where MBA allocation is permanently disabled after
the mount with CDP option. Remounting without CDP cannot restore the MBA
partition capability.
Add a check to re-enable MBA when CDP is disabled, which happens on
unmount.
Fixes: 6789fb99282c ("arm_mpam: resctrl: Add CDP emulation")
Signed-off-by: Zeng Heng <zengheng4@huawei.com>
[ morse: Added comment for existing code, added hunk to fix this bug from
Ben H ]
Reviewed-by: James Morse <james.morse@arm.com>
Signed-off-by: James Morse <james.morse@arm.com>
---
drivers/resctrl/mpam_resctrl.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/drivers/resctrl/mpam_resctrl.c b/drivers/resctrl/mpam_resctrl.c
index a9938006d0e6..4205fb2ee312 100644
--- a/drivers/resctrl/mpam_resctrl.c
+++ b/drivers/resctrl/mpam_resctrl.c
@@ -220,10 +220,18 @@ int resctrl_arch_set_cdp_enabled(enum resctrl_res_level rid, bool enable)
if (cdp_enabled && !mpam_resctrl_controls[RDT_RESOURCE_MBA].cdp_enabled)
mpam_resctrl_controls[RDT_RESOURCE_MBA].resctrl_res.alloc_capable = false;
+ /*
+ * If resctrl has attempted to enable CDP on MBA, re-enable MBA as two
+ * configurations will be provided so there is no aliasing problem.
+ */
if (mpam_resctrl_controls[RDT_RESOURCE_MBA].cdp_enabled &&
mpam_resctrl_controls[RDT_RESOURCE_MBA].class)
mpam_resctrl_controls[RDT_RESOURCE_MBA].resctrl_res.alloc_capable = true;
+ /* On unmount when CDP is disabled, re-enable MBA */
+ if (!cdp_enabled && mpam_resctrl_controls[RDT_RESOURCE_MBA].class)
+ mpam_resctrl_controls[RDT_RESOURCE_MBA].resctrl_res.alloc_capable = true;
+
if (enable) {
if (mpam_partid_max < 1)
return -EINVAL;
--
2.53.0
^ permalink raw reply related [flat|nested] 5+ messages in thread* [RESEND PATCH 2/3] arm_mpam: resctrl: Fix the check for no monitor components found
2026-04-20 14:05 [RESEND PATCH 0/3] arm_mpam: resctrl: Fixes for v7.1-rc1 James Morse
2026-04-20 14:05 ` [RESEND PATCH 1/3] arm_mpam: resctrl: Fix MBA CDP alloc_capable handling on unmount James Morse
@ 2026-04-20 14:05 ` James Morse
2026-04-20 14:05 ` [RESEND PATCH 3/3] arm_mpam: resctrl: Make resctrl_mon_ctx_waiters static James Morse
2026-04-20 14:15 ` [RESEND PATCH 0/3] arm_mpam: resctrl: Fixes for v7.1-rc1 Catalin Marinas
3 siblings, 0 replies; 5+ messages in thread
From: James Morse @ 2026-04-20 14:05 UTC (permalink / raw)
To: catalin.marinas; +Cc: linux-arm-kernel, will, Ben Horgan, Gavin Shan, Zeng Heng
From: Ben Horgan <ben.horgan@arm.com>
Dan Carpenter reports that, in mpam_resctrl_alloc_domain(), any_mon_comp is
used in an 'if' condition when it may be uninitialized. Initialize it to
NULL so that the check behaves correctly when no monitor components are
found.
Reported-by: Dan Carpenter <error27@gmail.com>
Fixes: 264c285999fc ("arm_mpam: resctrl: Add monitor initialisation and domain boilerplate")
Signed-off-by: Ben Horgan <ben.horgan@arm.com>
Reviewed-by: Gavin Shan <gshan@redhat.com>
Signed-off-by: James Morse <james.morse@arm.com>
---
drivers/resctrl/mpam_resctrl.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/resctrl/mpam_resctrl.c b/drivers/resctrl/mpam_resctrl.c
index 4205fb2ee312..1b0b37da12af 100644
--- a/drivers/resctrl/mpam_resctrl.c
+++ b/drivers/resctrl/mpam_resctrl.c
@@ -1407,7 +1407,7 @@ mpam_resctrl_alloc_domain(unsigned int cpu, struct mpam_resctrl_res *res)
}
if (r->mon_capable) {
- struct mpam_component *any_mon_comp;
+ struct mpam_component *any_mon_comp = NULL;
struct mpam_resctrl_mon *mon;
enum resctrl_event_id eventid;
--
2.53.0
^ permalink raw reply related [flat|nested] 5+ messages in thread* [RESEND PATCH 3/3] arm_mpam: resctrl: Make resctrl_mon_ctx_waiters static
2026-04-20 14:05 [RESEND PATCH 0/3] arm_mpam: resctrl: Fixes for v7.1-rc1 James Morse
2026-04-20 14:05 ` [RESEND PATCH 1/3] arm_mpam: resctrl: Fix MBA CDP alloc_capable handling on unmount James Morse
2026-04-20 14:05 ` [RESEND PATCH 2/3] arm_mpam: resctrl: Fix the check for no monitor components found James Morse
@ 2026-04-20 14:05 ` James Morse
2026-04-20 14:15 ` [RESEND PATCH 0/3] arm_mpam: resctrl: Fixes for v7.1-rc1 Catalin Marinas
3 siblings, 0 replies; 5+ messages in thread
From: James Morse @ 2026-04-20 14:05 UTC (permalink / raw)
To: catalin.marinas; +Cc: linux-arm-kernel, will, Ben Horgan, Gavin Shan, Zeng Heng
From: Ben Horgan <ben.horgan@arm.com>
resctrl_mon_ctx_waiters is not used outside of this file, so make it
static. This fixes the sparse warning:
drivers/resctrl/mpam_resctrl.c:25:1: warning: symbol 'resctrl_mon_ctx_waiters' was not declared. Should it be static?
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202603281842.c2K96tJA-lkp@intel.com/
Fixes: 2a3c79c61539 ("arm_mpam: resctrl: Allow resctrl to allocate monitors")
Signed-off-by: Ben Horgan <ben.horgan@arm.com>
Reviewed-by: Gavin Shan <gshan@redhat.com>
Signed-off-by: James Morse <james.morse@arm.com>
---
drivers/resctrl/mpam_resctrl.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/resctrl/mpam_resctrl.c b/drivers/resctrl/mpam_resctrl.c
index 1b0b37da12af..226ff6f532fa 100644
--- a/drivers/resctrl/mpam_resctrl.c
+++ b/drivers/resctrl/mpam_resctrl.c
@@ -22,7 +22,7 @@
#include "mpam_internal.h"
-DECLARE_WAIT_QUEUE_HEAD(resctrl_mon_ctx_waiters);
+static DECLARE_WAIT_QUEUE_HEAD(resctrl_mon_ctx_waiters);
/*
* The classes we've picked to map to resctrl resources, wrapped
--
2.53.0
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [RESEND PATCH 0/3] arm_mpam: resctrl: Fixes for v7.1-rc1
2026-04-20 14:05 [RESEND PATCH 0/3] arm_mpam: resctrl: Fixes for v7.1-rc1 James Morse
` (2 preceding siblings ...)
2026-04-20 14:05 ` [RESEND PATCH 3/3] arm_mpam: resctrl: Make resctrl_mon_ctx_waiters static James Morse
@ 2026-04-20 14:15 ` Catalin Marinas
3 siblings, 0 replies; 5+ messages in thread
From: Catalin Marinas @ 2026-04-20 14:15 UTC (permalink / raw)
To: James Morse; +Cc: linux-arm-kernel, will, Ben Horgan, Gavin Shan, Zeng Heng
Hi James,
On Mon, Apr 20, 2026 at 03:05:13PM +0100, James Morse wrote:
> This series is the collected fixes for MPAM series in arm64/for-next/core.
>
> These fix a unmount->remount problem with the CDP emulation,
> an uninitialised variable and a checker warning.
>
> If its easier, there is a branch here:
> https://git.kernel.org/pub/scm/linux/kernel/git/morse/linux.git mpam/glue/v7.0-rc3
I pulled the mpam/glue/v7.0-rc3+fixes into arm64 for-next/core.
Thanks!
--
Catalin
^ permalink raw reply [flat|nested] 5+ messages in thread