From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from canpmsgout01.his.huawei.com (canpmsgout01.his.huawei.com [113.46.200.216]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 850F53AE188 for ; Mon, 13 Apr 2026 08:54:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=113.46.200.216 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776070464; cv=none; b=VunlN6LdbE0V0mErb4kJBlqXpjDuVVZsGLdbRDuKwQrUK7wV49hXn5JS0n+W7qegqgFdyDeMNNe1kW75SjhYt/5emoaq67Am1GMp+Kz4XpF3yn5R+EkNYRLKc7/u6NnbfqdrPiPnHPZVySLaMVpHLwiOVtobu5iT8V4XA2mKEYg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776070464; c=relaxed/simple; bh=8Za6GlA6kXYmI9uOqgebVLNv5NDQH+uXH1/+ICmM/ac=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=t5Orr5vkm0torDyBqH1WJ9AISwB8gVb72kdsAWFro56rnnxWB5FohG+Ko5Dz5QWY26mPSxDA+YlMRjQ48TPhVWAqXtv1WsBKWXbkTf99jKX1GXaJO4uruLh1gw6abLv0l4P5tVRq6I45zoSaPvMGPVfgIHrqq7ox79PLzzNxFkE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=h-partners.com; dkim=pass (1024-bit key) header.d=h-partners.com header.i=@h-partners.com header.b=qCq87qkV; arc=none smtp.client-ip=113.46.200.216 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=h-partners.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=h-partners.com header.i=@h-partners.com header.b="qCq87qkV" dkim-signature: v=1; a=rsa-sha256; d=h-partners.com; s=dkim; c=relaxed/relaxed; q=dns/txt; h=From; bh=kspIqY3IxsH71BJIC1Olrnf73oXURAoru/Y0UiXkbrA=; b=qCq87qkVND4ZsKtl3U6cs/QKcooZ6FL5/Ya/MzsTDneaXpAGciGUnPQ0h5I3yLJvp66wKji8T OGfCxkpxyCksQc/bNtESubwyCs3iA35JY2OItBG0DjtxrLmzmebE+JF+VfLPZ6NrYvEJFz9Okyh MyOEV4DyYylwm0s91R2Y1rY= Received: from mail.maildlp.com (unknown [172.19.162.144]) by canpmsgout01.his.huawei.com (SkyGuard) with ESMTPS id 4fvLfF0ph5z1T4Gh; Mon, 13 Apr 2026 16:48:21 +0800 (CST) Received: from kwepemf100008.china.huawei.com (unknown [7.202.181.222]) by mail.maildlp.com (Postfix) with ESMTPS id DCF4E4056E; Mon, 13 Apr 2026 16:54:18 +0800 (CST) Received: from huawei.com (10.50.87.109) by kwepemf100008.china.huawei.com (7.202.181.222) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.36; Mon, 13 Apr 2026 16:54:18 +0800 From: Zeng Heng To: , , , , , , , , , , , , , , , CC: , , , 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 Message-ID: <20260413085405.1166412-7-zengheng4@huawei.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20260413085405.1166412-1-zengheng4@huawei.com> References: <20260413085405.1166412-1-zengheng4@huawei.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: kwepems100001.china.huawei.com (7.221.188.238) To kwepemf100008.china.huawei.com (7.202.181.222) 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 --- 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 #include #include @@ -18,6 +21,7 @@ #include #include #include +#include #include #include #include @@ -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