public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
From: James Morse <james.morse@arm.com>
To: catalin.marinas@arm.com
Cc: linux-arm-kernel@lists.infradead.org, will@kernel.org,
	Ben Horgan <ben.horgan@arm.com>, Gavin Shan <gshan@redhat.com>,
	Zeng Heng <zengheng4@huawei.com>
Subject: [RESEND PATCH 1/3] arm_mpam: resctrl: Fix MBA CDP alloc_capable handling on unmount
Date: Mon, 20 Apr 2026 15:05:14 +0100	[thread overview]
Message-ID: <20260420140516.3892820-2-james.morse@arm.com> (raw)
In-Reply-To: <20260420140516.3892820-1-james.morse@arm.com>

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



  reply	other threads:[~2026-04-20 14:05 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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 ` [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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260420140516.3892820-2-james.morse@arm.com \
    --to=james.morse@arm.com \
    --cc=ben.horgan@arm.com \
    --cc=catalin.marinas@arm.com \
    --cc=gshan@redhat.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=will@kernel.org \
    --cc=zengheng4@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox