mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Fenghua Yu <fenghuay@nvidia.com>
To: Reinette Chatre <reinette.chatre@intel.com>,
	Tony Luck <tony.luck@intel.com>, Ben Horgan <ben.horgan@arm.com>,
	James Morse <james.morse@arm.com>, Will Deacon <will@kernel.org>,
	Dave Martin <Dave.Martin@arm.com>,
	Catalin Marinas <catalin.marinas@arm.com>,
	Shaopeng Tan <tan.shaopeng@fujitsu.com>,
	Chen Yu <yu.c.chen@intel.com>, Babu Moger <babu.moger@amd.com>,
	Drew Fustini <fustini@kernel.org>,
	Vikram Sethi <vsethi@nvidia.com>,
	Shanker Donthineni <sdonthineni@nvidia.com>,
	Newton Liu <newtonl@nvidia.com>,
	Richard Cheng <icheng@nvidia.com>
Cc: linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	Fenghua Yu <fenghuay@nvidia.com>
Subject: [PATCH RFC v1 1/6] resctrl: wire MB_MAXHLM schemata parsing and group setup
Date: Mon,  9 Nov 2026 13:29:32 -0800	[thread overview]
Message-ID: <20261109212937.1409570-2-fenghuay@nvidia.com> (raw)
In-Reply-To: <20261109212937.1409570-1-fenghuay@nvidia.com>

The hard-limit control is a 0/1 value on the MBA resource, not a
separate schemata resource. Parse MB_MAXHLM in the bandwidth parser,
reject values other than 0 and 1, and initialize new groups with the
hard limit off.

Signed-off-by: Fenghua Yu <fenghuay@nvidia.com>
---
 fs/resctrl/ctrlmondata.c | 35 +++++++++++++++++++++++++++++++++++
 fs/resctrl/rdtgroup.c    | 17 +++++++++++++++++
 include/linux/resctrl.h  |  8 +++++++-
 3 files changed, 59 insertions(+), 1 deletion(-)

diff --git a/fs/resctrl/ctrlmondata.c b/fs/resctrl/ctrlmondata.c
index 77a2f2e877a6..9111b0130783 100644
--- a/fs/resctrl/ctrlmondata.c
+++ b/fs/resctrl/ctrlmondata.c
@@ -62,6 +62,29 @@ static struct resctrl_ctrl_priv resctrl_ctrl_priv_all[] = {
 	},
 };
 
+static bool mb_maxhlm_validate(char *buf, u32 *data, struct rdt_resource *r,
+			       struct resctrl_ctrl *ctrl)
+{
+	int ret;
+	u32 mb_maxhlm;
+
+	ret = kstrtou32(buf, 10, &mb_maxhlm);
+	if (ret) {
+		rdt_last_cmd_printf("Invalid MB_MAXHLM value %s\n", buf);
+		return false;
+	}
+
+	if (mb_maxhlm != 0 && mb_maxhlm != 1) {
+		rdt_last_cmd_printf("MB_MAXHLM value %u isn't 0/1\n",
+				    mb_maxhlm);
+		return false;
+	}
+
+	*data = mb_maxhlm;
+
+	return true;
+}
+
 /*
  * Iterator finding enabled controls.
  * Dynamically traverses controls based on active control mode.
@@ -165,6 +188,17 @@ static int parse_bw(struct rdt_parse_data *data, struct rdt_resource_final *f,
 		return -EINVAL;
 	}
 
+	/* Parse mb_maxhlm line */
+	if (ctrl->name == RESCTRL_CTRL_NAME_MAXHLM) {
+		if (!mb_maxhlm_validate(data->buf, &bw_val, r, ctrl))
+			return -EINVAL;
+
+		cfg->new_ctrl = bw_val;
+		cfg->have_new_ctrl = true;
+		return 0;
+	}
+
+	/* Parse mb line */
 	if (!bw_validate(data->buf, &bw_val, r, ctrl))
 		return -EINVAL;
 
@@ -362,6 +396,7 @@ static const char * const resctrl_ctrl_name[] = {
 	[RESCTRL_CTRL_NAME_NODE]	= "NODE",
 	[RESCTRL_CTRL_NAME_REGION0_MIN]		= "REGION0_MIN",
 	[RESCTRL_CTRL_NAME_REGION0_MAX]		= "REGION0_MAX",
+	[RESCTRL_CTRL_NAME_MAXHLM]	= "MAXHLM",
 };
 
 const char *resctrl_ctrl_name_str(enum resctrl_ctrl_name name)
diff --git a/fs/resctrl/rdtgroup.c b/fs/resctrl/rdtgroup.c
index a16e35b587c4..01e69d0d9e96 100644
--- a/fs/resctrl/rdtgroup.c
+++ b/fs/resctrl/rdtgroup.c
@@ -4401,6 +4401,19 @@ static void rdtgroup_init_mba(struct rdt_resource *r, struct resctrl_ctrl *ctrl,
 	}
 }
 
+/* Initialize the MB MAXHLM control with default hardlim off (0). */
+static void rdtgroup_init_mb_hlim(struct resctrl_ctrl *ctrl)
+{
+	struct resctrl_staged_config *cfg;
+	struct rdt_ctrl_domain *d;
+
+	list_for_each_entry(d, &ctrl->domains, hdr.list) {
+		cfg = &d->staged_config[CDP_NONE];
+		cfg->new_ctrl = 0;
+		cfg->have_new_ctrl = true;
+	}
+}
+
 /* Initialize the RDT group's allocations. */
 static int rdtgroup_init_alloc(struct rdtgroup *rdtgrp)
 {
@@ -4416,6 +4429,10 @@ static int rdtgroup_init_alloc(struct rdtgroup *rdtgrp)
 		for_each_enabled_ctrl(ctrl, r) {
 			if (r->rid == RDT_RESOURCE_MBA ||
 			    r->rid == RDT_RESOURCE_SMBA) {
+				if (ctrl->name == RESCTRL_CTRL_NAME_MAXHLM) {
+					rdtgroup_init_mb_hlim(ctrl);
+					continue;
+				}
 				rdtgroup_init_mba(r, ctrl, rdtgrp->closid);
 				if (is_mba_sc(r, ctrl))
 					continue;
diff --git a/include/linux/resctrl.h b/include/linux/resctrl.h
index 3c4675656b51..5711154145f8 100644
--- a/include/linux/resctrl.h
+++ b/include/linux/resctrl.h
@@ -402,6 +402,7 @@ struct resctrl_mon {
  *				line is "MB_NODE".
  * @RESCTRL_CTRL_NAME_REGION0_MIN:	"REGION0_MIN"
  * @RESCTRL_CTRL_NAME_REGION0_MAX:	"REGION0_MAX"
+ * @RESCTRL_CTRL_NAME_MAXHLM:	"MAXHLM"
  */
 enum resctrl_ctrl_name {
 	RESCTRL_CTRL_NAME_DEF,
@@ -410,7 +411,8 @@ enum resctrl_ctrl_name {
 	RESCTRL_CTRL_NAME_NODE,
 	RESCTRL_CTRL_NAME_REGION0_MIN,
 	RESCTRL_CTRL_NAME_REGION0_MAX,
-	RESCTRL_CTRL_NAME_LAST = RESCTRL_CTRL_NAME_REGION0_MAX
+	RESCTRL_CTRL_NAME_MAXHLM,
+	RESCTRL_CTRL_NAME_LAST = RESCTRL_CTRL_NAME_MAXHLM
 };
 
 /**
@@ -616,6 +618,10 @@ static inline u32 resctrl_get_default_ctrlval(struct resctrl_ctrl *ctrl)
 		 */
 		return BIT_MASK(ctrl->bitmap.cbm_len) - 1;
 	case RESCTRL_CTRL_SCALAR:
+		/* The hard-limit toggle defaults to off. */
+		if (ctrl->name == RESCTRL_CTRL_NAME_MAXHLM)
+			return 0;
+
 		return ctrl->scalar.reset_val;
 	}
 
-- 
2.53.0


  reply	other threads:[~2026-11-09 21:29 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-09 21:29 [PATCH RFC v1 0/6] arm_mpam,resctrl: expose MPAM MBW_MAX hard limit Fenghua Yu
2026-11-09 21:29 ` Fenghua Yu [this message]
2026-11-09 21:29 ` [PATCH RFC v1 2/6] arm_mpam: resctrl: probe MPAMF_MBW_IDR MAX_LIM and hardlim_rw Fenghua Yu
2026-11-09 21:29 ` [PATCH RFC v1 3/6] arm_mpam: resctrl: track MBW max hard-limit in config Fenghua Yu
2026-11-09 21:29 ` [PATCH RFC v1 4/6] arm_mpam: resctrl: add MAXHLM control on the MBA resource Fenghua Yu
2026-11-09 21:29 ` [PATCH RFC v1 5/6] arm_mpam: Add MB_MAXHLM_NODE and Node scope Fenghua Yu
2026-11-09 21:29 ` [PATCH RFC v1 6/6] Documentation: resctrl: document MB_MAXHLM for MPAM MBA Fenghua Yu

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=20261109212937.1409570-2-fenghuay@nvidia.com \
    --to=fenghuay@nvidia.com \
    --cc=Dave.Martin@arm.com \
    --cc=babu.moger@amd.com \
    --cc=ben.horgan@arm.com \
    --cc=catalin.marinas@arm.com \
    --cc=fustini@kernel.org \
    --cc=icheng@nvidia.com \
    --cc=james.morse@arm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=newtonl@nvidia.com \
    --cc=reinette.chatre@intel.com \
    --cc=sdonthineni@nvidia.com \
    --cc=tan.shaopeng@fujitsu.com \
    --cc=tony.luck@intel.com \
    --cc=vsethi@nvidia.com \
    --cc=will@kernel.org \
    --cc=yu.c.chen@intel.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

all inboxes | Powered by JetHome®