[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250117151033.1517882-20-Dave.Martin@arm.com>
Date: Fri, 17 Jan 2025 15:10:29 +0000
From: Dave Martin <Dave.Martin@....com>
To: linux-kernel@...r.kernel.org
Cc: linux-arm-kernel@...ts.infradead.org,
Zeng Heng <zengheng4@...wei.com>,
Shaopeng Tan <tan.shaopeng@...itsu.com>,
James Morse <james.morse@....com>
Subject: [RFC PATCH v2 07/11] arm_mpam: [NFU] Rework ID remapping to use a kernel command-line argument
Hacking the source is an acceptable interface for experimentation,
but not very convenient.
Instead, add a kernel command-line parameter
mpam_partid_per_closid=<n> to specify how many PARTIDs are used to
provide monitoring groups for each resctrl CLOSID.
This change is not intended for upstream.
Signed-off-by: Dave Martin <Dave.Martin@....com>
---
drivers/platform/arm64/mpam/mpam_resctrl.c | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
diff --git a/drivers/platform/arm64/mpam/mpam_resctrl.c b/drivers/platform/arm64/mpam/mpam_resctrl.c
index f834753a3274..eb1ef5d2bc57 100644
--- a/drivers/platform/arm64/mpam/mpam_resctrl.c
+++ b/drivers/platform/arm64/mpam/mpam_resctrl.c
@@ -3,6 +3,9 @@
#define pr_fmt(fmt) "mpam: resctrl: " fmt
+#undef KBUILD_MODNAME
+#define KBUILD_MODNAME "mpam"
+
#include <linux/arm_mpam.h>
#include <linux/cacheinfo.h>
#include <linux/cpu.h>
@@ -10,6 +13,7 @@
#include <linux/errno.h>
#include <linux/limits.h>
#include <linux/list.h>
+#include <linux/moduleparam.h>
#include <linux/printk.h>
#include <linux/rculist.h>
#include <linux/resctrl.h>
@@ -158,6 +162,24 @@ static bool mpam_resctrl_hide_cdp(enum resctrl_res_level rid)
static unsigned int partid_per_closid = 1;
+static int mpam_resctrl_partid_per_closid_set(const char *val,
+ const struct kernel_param *kp)
+{
+ /*
+ * 16 in an arbitrary maximum, sufficient for experimentation
+ * but not ridiculously large:
+ */
+ return param_set_uint_minmax(val, kp, 1, 16);
+}
+
+static const struct kernel_param_ops mpam_resctrl_partid_per_closid_ops = {
+ .set = mpam_resctrl_partid_per_closid_set,
+ .get = param_get_uint,
+};
+
+device_param_cb(partid_per_closid, &mpam_resctrl_partid_per_closid_ops,
+ &partid_per_closid, 0444);
+
static unsigned int mpam_num_pmg(void)
{
return mpam_pmg_max + 1;
--
2.34.1
Powered by blists - more mailing lists