[RFC 04/12] fs/resctrl: Obtain CPBM upon priority partition presence

From: Amit Singh Tomar
Date: Tue Aug 15 2023 - 11:28:39 EST


Resource control group's "schemata" file represents the cache portion
bit map (XXXX), parsed from buffer with "L3:0=XXXX" format. Now, with
the introduction of priority control, "schemata" file format has changed
to "L3:0=XXXX,X", where cpbm (XXXX) is split from priority mask(X) using
using delimiter ",".

With this change, CPBM is properly fetched from schemata file when priority
partition support is present.

Signed-off-by: Amit Singh Tomar <amitsinght@xxxxxxxxxxx>
---
fs/resctrl/ctrlmondata.c | 3 +++
1 file changed, 3 insertions(+)

diff --git a/fs/resctrl/ctrlmondata.c b/fs/resctrl/ctrlmondata.c
index 27d8bc25a4cb..b19ac2509e38 100644
--- a/fs/resctrl/ctrlmondata.c
+++ b/fs/resctrl/ctrlmondata.c
@@ -108,6 +108,9 @@ static bool cbm_validate(char *buf, u32 *data, struct rdt_resource *r)
unsigned int cbm_len = r->cache.cbm_len;
int ret;

+ if (r->priority_cap)
+ buf = strsep(&buf, ",");
+
ret = kstrtoul(buf, 16, &val);
if (ret) {
rdt_last_cmd_printf("Non-hex character in the mask %s\n", buf);
--
2.25.1