mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jinjie Ruan <ruanjinjie01@gmail.com>
To: babu.moger@amd.com, ben.horgan@arm.com, bp@alien8.de,
	corbet@lwn.net, Dave.Martin@arm.com, fenghuay@nvidia.com,
	james.morse@arm.com, rdunlap@infradead.org,
	reinette.chatre@intel.com, skhan@linuxfoundation.org,
	tony.luck@intel.com, x86@kernel.org,
	linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org
Cc: ruanjinjie@huawei.com
Subject: [RFC PATCH 5/6] fs/resctrl: Reject mba_MBps when the maximum is only a soft limit
Date: Mon,  9 Nov 2026 21:26:20 +0800	[thread overview]
Message-ID: <20261109132621.3862497-6-ruanjinjie01@gmail.com> (raw)
In-Reply-To: <20261109132621.3862497-1-ruanjinjie01@gmail.com>

From: Jinjie Ruan <ruanjinjie@huawei.com>

The MBA software controller lowers the maximum bandwidth control when
the measured bandwidth is above the value the user writes to the
schemata file. It relies on the hardware enforcing that maximum.

A maximum bandwidth control can be implemented as a hard limit, where
requests above the maximum are not serviced, or as a soft limit, where
requests above the maximum are serviced when no other request is
waiting. With only the soft limit, a group that has no competing
traffic keeps using bandwidth above the maximum and the controller
cannot meet the target. MPAM reports this in MPAMF_MBW_IDR.MAX_LIM.

Add resctrl_membw::max_is_soft_limit for architectures whose maximum
control implements only the soft limit, and refuse to mount with the
mba_MBps option when it is set. Architectures that do not set the flag
keep the previous behavior.

Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com>
---
 Documentation/filesystems/resctrl.rst | 6 +++++-
 fs/resctrl/rdtgroup.c                 | 7 ++++++-
 include/linux/resctrl.h               | 5 +++++
 3 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/Documentation/filesystems/resctrl.rst b/Documentation/filesystems/resctrl.rst
index d70aec6f7096..d2dacb00a848 100644
--- a/Documentation/filesystems/resctrl.rst
+++ b/Documentation/filesystems/resctrl.rst
@@ -47,7 +47,11 @@ mount options are:
 	Enable code/data prioritization in L2 cache allocations.
 "mba_MBps":
 	Enable the MBA Software Controller(mba_sc) to specify MBA
-	bandwidth in MiBps
+	bandwidth in MiBps. Refused when the maximum bandwidth control is
+	only a soft limit: requests above the maximum are then still
+	serviced when no other request is waiting, so the software
+	controller cannot keep the bandwidth below the value written to
+	the schemata file.
 "debug":
 	Make debug files accessible. Available debug files are annotated with
 	"Available only with debug option".
diff --git a/fs/resctrl/rdtgroup.c b/fs/resctrl/rdtgroup.c
index 957a3df7af83..572b3d9c79e5 100644
--- a/fs/resctrl/rdtgroup.c
+++ b/fs/resctrl/rdtgroup.c
@@ -2614,6 +2614,10 @@ static void mba_sc_domain_destroy(struct rdt_resource *r,
  * With assignable counters that is only guaranteed when the architecture
  * uses a fixed assignment mode and assigns counters automatically; keep
  * that assignment enabled while the controller is in use.
+ *
+ * The maximum control must also be enforced by the hardware: a soft limit
+ * still services requests above the maximum when no other request is
+ * waiting, so the controller cannot keep bandwidth below a target.
  */
 static bool supports_mba_mbps(void)
 {
@@ -2623,6 +2627,7 @@ static bool supports_mba_mbps(void)
 	return (resctrl_is_mbm_enabled() &&
 		r->alloc_capable && is_mba_linear() &&
 		r->ctrl_scope == rmbm->mon_scope &&
+		!r->membw.max_is_soft_limit &&
 		(!rmbm->mon.mbm_cntr_assignable ||
 		 rmbm->mon.mbm_cntr_assign_fixed));
 }
@@ -3375,7 +3380,7 @@ static int rdt_parse_param(struct fs_context *fc, struct fs_parameter *param)
 		ctx->enable_cdpl2 = true;
 		return 0;
 	case Opt_mba_mbps:
-		msg = "mba_MBps requires MBM and linear scale MBA at L3 scope";
+		msg = "mba_MBps requires MBM, linear scale MBA at L3 scope and an enforced maximum";
 		if (!supports_mba_mbps())
 			return invalfc(fc, msg);
 		ctx->enable_mba_mbps = true;
diff --git a/include/linux/resctrl.h b/include/linux/resctrl.h
index 10dfdca7f4bf..d1f989554031 100644
--- a/include/linux/resctrl.h
+++ b/include/linux/resctrl.h
@@ -250,6 +250,10 @@ enum membw_throttle_mode {
  * @bw_gran:		Granularity at which the memory bandwidth is allocated
  * @delay_linear:	True if memory B/W delay is in linear scale
  * @arch_needs_linear:	True if we can't configure non-linear resources
+ * @max_is_soft_limit:	True if the maximum control only marks traffic as low
+ *			priority. Requests above the maximum are then still
+ *			serviced when no other request is waiting, so the software
+ *			controller cannot keep bandwidth below a target.
  * @throttle_mode:	Bandwidth throttling mode when threads request
  *			different memory bandwidths
  * @mba_sc:		True if MBA software controller(mba_sc) is enabled
@@ -261,6 +265,7 @@ struct resctrl_membw {
 	u32				bw_gran;
 	u32				delay_linear;
 	bool				arch_needs_linear;
+	bool				max_is_soft_limit;
 	enum membw_throttle_mode	throttle_mode;
 	bool				mba_sc;
 	u32				*mb_map;
-- 
2.43.0


  parent reply	other threads:[~2026-11-09 13:27 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-09 13:26 [RFC PATCH 00/6] resctrl: Support mba_MBps on MPAM Jinjie Ruan
2026-11-09 13:26 ` [RFC PATCH 1/6] fs/resctrl: Avoid division by zero in the MBA software controller Jinjie Ruan
2026-11-09 13:26 ` [RFC PATCH 2/6] fs/resctrl: Do not update bandwidth from a failed counter read Jinjie Ruan
2026-11-09 13:26 ` [RFC PATCH 3/6] fs/resctrl: Take the CPU hotplug lock for software controller updates Jinjie Ruan
2026-11-09 13:26 ` [RFC PATCH 4/6] fs/resctrl: Allow mba_MBps with assignable MBM counters Jinjie Ruan
2026-11-09 13:26 ` Jinjie Ruan [this message]
2026-11-09 13:26 ` [RFC PATCH 6/6] arm_mpam: Program the hard limit for the software controller Jinjie Ruan

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=20261109132621.3862497-6-ruanjinjie01@gmail.com \
    --to=ruanjinjie01@gmail.com \
    --cc=Dave.Martin@arm.com \
    --cc=babu.moger@amd.com \
    --cc=ben.horgan@arm.com \
    --cc=bp@alien8.de \
    --cc=corbet@lwn.net \
    --cc=fenghuay@nvidia.com \
    --cc=james.morse@arm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rdunlap@infradead.org \
    --cc=reinette.chatre@intel.com \
    --cc=ruanjinjie@huawei.com \
    --cc=skhan@linuxfoundation.org \
    --cc=tony.luck@intel.com \
    --cc=x86@kernel.org \
    /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

all inboxes | Powered by JetHome®