From: Amit Singh Tomar <amitsinght@marvell.com>
To: <linux-kernel@vger.kernel.org>, <linux-arm-kernel@lists.infradead.org>
Cc: <fenghua.yu@intel.com>, <reinette.chatre@intel.com>,
<james.morse@arm.com>, <gcherian@marvell.com>, <robh@kernel.org>,
<peternewman@google.com>, <dfustini@baylibre.com>,
<jonathan.cameron@huawei.com>,
Amit Singh Tomar <amitsinght@marvell.com>
Subject: [PATCH v1 03/14] arm_mpam: resctrl: extend the schemata list to support priority partition
Date: Wed, 17 Jan 2024 19:43:54 +0530 [thread overview]
Message-ID: <20240117141405.3063506-4-amitsinght@marvell.com> (raw)
In-Reply-To: <20240117141405.3063506-1-amitsinght@marvell.com>
At the moment, "schemata" list is consist of two basic control types .i.e.
cache portion bitmap (CPBM), and memory bandwidth allocation (MBA),
represented as following under schemata file.
MB:0=0100
L3:0=ffff
Lets' extend the "schemata" list to support priority partition control,
This control is listed in following format (last column indicates the
priority value) under schemata file.
L3DSPRI:0=f
Signed-off-by: Amit Singh Tomar <amitsinght@marvell.com>
---
Changes since RFC:
* This patch is reworked, Now in order to configure DSPRI partition control
dedicated schemata is used (L3DSPRI).
---
drivers/platform/mpam/mpam_resctrl.c | 7 +++++-
fs/resctrl/rdtgroup.c | 34 ++++++++++++++++++++++------
include/linux/resctrl.h | 3 +++
include/linux/resctrl_types.h | 3 +++
4 files changed, 39 insertions(+), 8 deletions(-)
diff --git a/drivers/platform/mpam/mpam_resctrl.c b/drivers/platform/mpam/mpam_resctrl.c
index 09618d9ceb1d..6fd2bfeffa0a 100644
--- a/drivers/platform/mpam/mpam_resctrl.c
+++ b/drivers/platform/mpam/mpam_resctrl.c
@@ -729,8 +729,13 @@ static int mpam_resctrl_resource_init(struct mpam_resctrl_res *res)
exposed_alloc_capable = true;
}
- if (has_ppart)
+ if (has_ppart) {
r->priority_cap = true;
+ if (class->props.dspri_wd > 0x10)
+ class->props.dspri_wd = 0x10;
+
+ r->dspri_data_width = (class->props.dspri_wd + 3) / 4;
+ }
/*
* MBWU counters may be 'local' or 'total' depending on where
diff --git a/fs/resctrl/rdtgroup.c b/fs/resctrl/rdtgroup.c
index 12e31d4dddf6..568bb9bb7913 100644
--- a/fs/resctrl/rdtgroup.c
+++ b/fs/resctrl/rdtgroup.c
@@ -2261,7 +2261,7 @@ static int schemata_list_add(struct rdt_resource *r,
enum resctrl_ctrl_type ctrl_type)
{
struct resctrl_schema *s;
- const char *suffix = "";
+ const char *suffix = "", *ext_suffix = "";
int ret, cl;
s = kzalloc(sizeof(*s), GFP_KERNEL);
@@ -2286,12 +2286,22 @@ static int schemata_list_add(struct rdt_resource *r,
break;
}
- if (ctrl_type == SCHEMA_BASIC) {
+ s->ctrl_type = ctrl_type;
+ switch (ctrl_type) {
+ case SCHEMA_DSPRI:
+ ext_suffix = "DSPRI";
+ break;
+ }
+
+ if (ctrl_type == SCHEMA_BASIC)
ret = snprintf(s->name, sizeof(s->name), "%s%s", r->name, suffix);
- if (ret >= sizeof(s->name)) {
- kfree(s);
- return -EINVAL;
- }
+ else
+ ret = snprintf(s->name, sizeof(s->name), "%s%s%s", r->name,
+ suffix, ext_suffix);
+
+ if (ret >= sizeof(s->name)) {
+ kfree(s);
+ return -EINVAL;
}
cl = strlen(s->name);
@@ -2312,7 +2322,9 @@ static int schemata_list_add(struct rdt_resource *r,
* widest cbm/data_width.
*/
if (ctrl_type == SCHEMA_BASIC)
- max_data_width = max(max_data_width, r->data_width);
+ s->max_data_width = max(max_data_width, r->data_width);
+ else
+ s->max_data_width = max(max_data_width, r->dspri_data_width);
INIT_LIST_HEAD(&s->list);
list_add(&s->list, &resctrl_schema_all);
@@ -2322,6 +2334,7 @@ static int schemata_list_add(struct rdt_resource *r,
static int schemata_list_create(void)
{
+ enum resctrl_ctrl_type ctrl_type;
enum resctrl_res_level i;
struct rdt_resource *r;
int ret = 0;
@@ -2345,6 +2358,13 @@ static int schemata_list_create(void)
if (ret)
break;
+ for_each_extend_ctrl_type(ctrl_type) {
+ if (ctrl_type == 1 && r->priority_cap) {
+ ret = schemata_list_add(r, CDP_NONE, SCHEMA_DSPRI);
+ if (ret)
+ break;
+ }
+ }
}
return ret;
diff --git a/include/linux/resctrl.h b/include/linux/resctrl.h
index d49aed80a05e..cb17c7704fd7 100644
--- a/include/linux/resctrl.h
+++ b/include/linux/resctrl.h
@@ -205,6 +205,7 @@ struct resctrl_membw {
* @domains: RCU list of all domains for this resource
* @name: Name to use in "schemata" file.
* @data_width: Character width of data when displaying
+ * @dspri_data_width Character width of dspri value when displaying
* @default_ctrl: Specifies default cache cbm or memory B/W percent.
* @format_str: Per resource format string to show domain value
* @evt_list: List of monitoring events
@@ -223,6 +224,7 @@ struct rdt_resource {
struct list_head domains;
char *name;
int data_width;
+ int dspri_data_width;
u32 default_ctrl;
const char *format_str;
struct list_head evt_list;
@@ -256,6 +258,7 @@ struct resctrl_schema {
enum resctrl_ctrl_type ctrl_type;
struct rdt_resource *res;
u32 num_closid;
+ int max_data_width;
};
/*
diff --git a/include/linux/resctrl_types.h b/include/linux/resctrl_types.h
index b9268ec3ba71..b1a22053d7cd 100644
--- a/include/linux/resctrl_types.h
+++ b/include/linux/resctrl_types.h
@@ -57,6 +57,9 @@ enum resctrl_res_level {
RDT_NUM_RESOURCES,
};
+#define for_each_extend_ctrl_type(t) \
+ for (t = SCHEMA_DSPRI; t != SCHEMA_NUM_CTRL_TYPE; t++)
+
enum resctrl_ctrl_type {
SCHEMA_BASIC = 0,
SCHEMA_DSPRI,
--
2.25.1
next prev parent reply other threads:[~2024-01-17 14:14 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-17 14:13 [PATCH v1 00/14] ARM: MPAM: add support for priority partitioning control Amit Singh Tomar
2024-01-17 14:13 ` [PATCH v1 01/14] fs/resctrl: group the resource control types for schemata list Amit Singh Tomar
2024-01-17 19:21 ` Peter Newman
2024-01-17 14:13 ` [PATCH v1 02/14] arm_mpam: resctrl: Detect priority partitioning capability Amit Singh Tomar
2024-01-17 14:13 ` Amit Singh Tomar [this message]
2024-01-17 14:13 ` [PATCH v1 04/14] fs/resctrl: Set-up downstream priority partition resources Amit Singh Tomar
2024-01-17 14:13 ` [PATCH v1 05/14] fs/resctrl: fetch configuration based on control type Amit Singh Tomar
2024-01-17 14:13 ` [PATCH v1 06/14] arm_mpam: resctrl: Retrieve priority values from arch code Amit Singh Tomar
2024-01-17 14:13 ` [PATCH v1 07/14] fs/resctrl: Schemata write only for intended resource Amit Singh Tomar
2024-01-17 14:13 ` [PATCH v1 08/14] fs/resctrl: Extend schemata write for priority partition control Amit Singh Tomar
2024-01-17 14:14 ` [PATCH v1 09/14] fs/resctrl: set configuration based on Control type Amit Singh Tomar
2024-01-17 14:14 ` [PATCH v1 10/14] arm_mpam: resctrl: Facilitate writing downstream priority value Amit Singh Tomar
2024-01-17 14:14 ` [PATCH v1 11/14] arm_mpam: Fix Downstream and internal priority mask Amit Singh Tomar
2024-01-17 14:14 ` [PATCH v1 12/14] arm_mpam: Program Downstream priority value Amit Singh Tomar
2024-01-17 14:14 ` [PATCH v1 13/14] arm_mpam: Handle resource instances mapped to different controls Amit Singh Tomar
2024-01-17 18:03 ` Peter Newman
2024-01-19 13:01 ` [EXT] " Amit Singh Tomar
2024-01-19 22:05 ` Peter Newman
2024-05-08 13:55 ` Amit Singh Tomar
2024-01-17 14:14 ` [PATCH v1 14/14] arm64/mpam: resctrl: export DSPRI value to info directory Amit Singh Tomar
2024-01-17 23:59 ` [PATCH v1 00/14] ARM: MPAM: add support for priority partitioning control Reinette Chatre
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=20240117141405.3063506-4-amitsinght@marvell.com \
--to=amitsinght@marvell.com \
--cc=dfustini@baylibre.com \
--cc=fenghua.yu@intel.com \
--cc=gcherian@marvell.com \
--cc=james.morse@arm.com \
--cc=jonathan.cameron@huawei.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=peternewman@google.com \
--cc=reinette.chatre@intel.com \
--cc=robh@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®