public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
From: Zeng Heng <zengheng4@huawei.com>
To: <ben.horgan@arm.com>, <Dave.Martin@arm.com>,
	<james.morse@arm.com>, <tan.shaopeng@jp.fujitsu.com>,
	<reinette.chatre@intel.com>, <fenghuay@nvidia.com>,
	<tglx@kernel.org>, <will@kernel.org>, <hpa@zytor.com>,
	<bp@alien8.de>, <babu.moger@amd.com>,
	<dave.hansen@linux.intel.com>, <mingo@redhat.com>,
	<tony.luck@intel.com>, <gshan@redhat.com>,
	<catalin.marinas@arm.com>
Cc: <linux-arm-kernel@lists.infradead.org>, <x86@kernel.org>,
	<linux-kernel@vger.kernel.org>, <wangkefeng.wang@huawei.com>
Subject: [PATCH v8 next 06/10] arm_mpam: Add boot parameter to limit mpam_intpartid_max
Date: Mon, 13 Apr 2026 16:54:01 +0800	[thread overview]
Message-ID: <20260413085405.1166412-7-zengheng4@huawei.com> (raw)
In-Reply-To: <20260413085405.1166412-1-zengheng4@huawei.com>

Add a new boot parameter "intpartid_max" to allow system administrators
to limit the number of internal PARTIDs used by the MPAM driver for
resource control groups. This provides flexibility to configure the
trade-off between:

* Number of resource control groups (CLOSIDs, limited by intpartid_max)
* Number of monitoring groups (RMIDs, limited by reqpartid and intpartid)

By default, the driver uses all available intPARTIDs for control groups.
With this parameter, users are able to reserve internal PARTIDs to create
additional sub-monitoring groups (provided that the narrow PARTID feature
is successfully enabled).

Example usage:
  mpam.intpartid_max=7

mpam.intpartid_max is set to the maximum number of internal PARTIDs
minus one, which is applied as the limit at initialization time.

Signed-off-by: Zeng Heng <zengheng4@huawei.com>
---
 drivers/resctrl/mpam_devices.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/drivers/resctrl/mpam_devices.c b/drivers/resctrl/mpam_devices.c
index 8fbc8f9f9688..2aeff798a865 100644
--- a/drivers/resctrl/mpam_devices.c
+++ b/drivers/resctrl/mpam_devices.c
@@ -3,6 +3,9 @@
 
 #define pr_fmt(fmt) "%s:%s: " fmt, KBUILD_MODNAME, __func__
 
+#undef KBUILD_MODNAME
+#define KBUILD_MODNAME "mpam"
+
 #include <linux/acpi.h>
 #include <linux/atomic.h>
 #include <linux/arm_mpam.h>
@@ -18,6 +21,7 @@
 #include <linux/irq.h>
 #include <linux/irqdesc.h>
 #include <linux/list.h>
+#include <linux/moduleparam.h>
 #include <linux/lockdep.h>
 #include <linux/mutex.h>
 #include <linux/platform_device.h>
@@ -65,6 +69,7 @@ static DEFINE_MUTEX(mpam_cpuhp_state_lock);
 u16 mpam_partid_max;
 u16 mpam_intpartid_max;
 u8 mpam_pmg_max;
+static u16 bootparam_intpartid_max = USHRT_MAX;
 static bool partid_max_init, partid_max_published;
 static DEFINE_SPINLOCK(partid_max_lock);
 
@@ -2725,6 +2730,7 @@ static void mpam_enable_once(void)
 	 * longer change.
 	 */
 	spin_lock(&partid_max_lock);
+	mpam_intpartid_max = min(mpam_intpartid_max, bootparam_intpartid_max);
 	partid_max_published = true;
 	spin_unlock(&partid_max_lock);
 
@@ -2779,6 +2785,20 @@ static void mpam_enable_once(void)
 		       mpam_partid_max + 1, mpam_intpartid_max + 1, mpam_pmg_max + 1);
 }
 
+static int mpam_intpartid_max_set(const char *val,
+				  const struct kernel_param *kp)
+{
+	return param_set_uint_minmax(val, kp, 1, USHRT_MAX);
+}
+
+static const struct kernel_param_ops mpam_intpartid_max_ops  = {
+	.set = mpam_intpartid_max_set,
+	.get = param_get_uint,
+};
+
+arch_param_cb(intpartid_max, &mpam_intpartid_max_ops,
+	     &bootparam_intpartid_max, 0444);
+
 static void mpam_reset_component_locked(struct mpam_component *comp)
 {
 	struct mpam_vmsc *vmsc;
-- 
2.25.1



  parent reply	other threads:[~2026-04-13  8:55 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-13  8:53 [PATCH v8 next 00/10] arm_mpam: Introduce Narrow-PARTID feature Zeng Heng
2026-04-13  8:53 ` [PATCH v8 next 01/10] fs/resctrl: Fix MPAM Partid parsing errors by preserving CDP state during umount Zeng Heng
2026-04-13  8:53 ` [PATCH v8 next 02/10] arm_mpam: Add intPARTID and reqPARTID support for Narrow-PARTID feature Zeng Heng
2026-04-13  8:53 ` [PATCH v8 next 03/10] arm_mpam: Disable reqPARTID expansion when Narrow-PARTID is unavailable Zeng Heng
2026-04-13  8:53 ` [PATCH v8 next 04/10] arm_mpam: Refactor rmid to reqPARTID/PMG mapping Zeng Heng
2026-04-13  8:54 ` [PATCH v8 next 05/10] arm_mpam: Propagate control group config to sub-monitoring groups Zeng Heng
2026-04-13  8:54 ` Zeng Heng [this message]
2026-04-13  8:54 ` [PATCH v8 next 07/10] fs/resctrl: Add rmid_entry state helpers Zeng Heng
2026-04-13  8:54 ` [PATCH v8 next 08/10] arm_mpam: Implement dynamic reqPARTID allocation for monitoring groups Zeng Heng
2026-04-13  8:54 ` [PATCH v8 next 09/10] fs/resctrl: Wire up rmid expansion and reclaim functions Zeng Heng
2026-04-13  8:54 ` [PATCH v8 next 10/10] arm_mpam: Add mpam_sync_config() for dynamic rmid expansion Zeng Heng
2026-04-16  6:29 ` [PATCH v8 next 00/10] arm_mpam: Introduce Narrow-PARTID feature Shaopeng Tan (Fujitsu)
2026-04-20  7:31 ` Zeng Heng

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=20260413085405.1166412-7-zengheng4@huawei.com \
    --to=zengheng4@huawei.com \
    --cc=Dave.Martin@arm.com \
    --cc=babu.moger@amd.com \
    --cc=ben.horgan@arm.com \
    --cc=bp@alien8.de \
    --cc=catalin.marinas@arm.com \
    --cc=dave.hansen@linux.intel.com \
    --cc=fenghuay@nvidia.com \
    --cc=gshan@redhat.com \
    --cc=hpa@zytor.com \
    --cc=james.morse@arm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=reinette.chatre@intel.com \
    --cc=tan.shaopeng@jp.fujitsu.com \
    --cc=tglx@kernel.org \
    --cc=tony.luck@intel.com \
    --cc=wangkefeng.wang@huawei.com \
    --cc=will@kernel.org \
    --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