提交 34a7d3f7 编写于 作者: W Wang ShaoBo 提交者: Yang Yingliang

arm64/mpam: resctrl: Supplement cdpl2,cdpl3 for mount options

hulk inclusion
category: feature
bugzilla: 34278
CVE: NA

-------------------------------------------------

This supports cdpl2,cdpl3 parameters for mount options, some other options
including capabilities' feature such as priority and hardlimit will be
supported in the future, a simple example like this.

e.g.
   > mount -t resctrl resctrl /sys/fs/resctrl -o cdpl3
   > cd /sys/fs/resctrl && cat schemata
     L3CODE:0=7fff;1=7fff;2=7fff;3=7fff
     L3CODE:0=7fff;1=7fff;2=7fff;3=7fff
     MB:0=100;1=100;2=100;3=100

Note that we only complete this part interface adaption, not mean cdp is
supported currently.
Signed-off-by: NWang ShaoBo <bobo.shaobowang@huawei.com>
Reviewed-by: NXiongfeng Wang <wangxiongfeng2@huawei.com>
Reviewed-by: NCheng Jian <cj.chengjian@huawei.com>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
Signed-off-by: NCheng Jian <cj.chengjian@huawei.com>
上级 c397a143
......@@ -75,6 +75,12 @@ bool rdt_alloc_capable;
* Indicate the max number of monitor supported.
*/
static u32 max_mon_num;
/*
* Indicate if had mount cdpl2/cdpl3 option.
*/
static bool resctrl_cdp_enabled;
/*
* Hi1620 2P Base Address Map
*
......@@ -433,9 +439,76 @@ void release_rdtgroupfs_options(void)
{
}
static void disable_cdp(void)
{
struct mpam_resctrl_res *res;
struct resctrl_resource *r;
for_each_supported_resctrl_exports(res) {
r = &res->resctrl_res;
r->cdp_enable = false;
}
resctrl_cdp_enabled = false;
}
static int try_to_enable_cdp(enum resctrl_resource_level level)
{
struct resctrl_resource *r = mpam_resctrl_get_resource(level);
if (!r || !r->cdp_capable)
return -EINVAL;
r->cdp_enable = true;
resctrl_cdp_enabled = true;
return 0;
}
static int cdpl3_enable(void)
{
return try_to_enable_cdp(RDT_RESOURCE_L3);
}
static int cdpl2_enable(void)
{
return try_to_enable_cdp(RDT_RESOURCE_L2);
}
int parse_rdtgroupfs_options(char *data)
{
char *token;
char *o = data;
int ret = 0;
disable_cdp();
while ((token = strsep(&o, ",")) != NULL) {
if (!*token) {
ret = -EINVAL;
goto out;
}
if (!strcmp(token, "cdpl3")) {
ret = cdpl3_enable();
if (ret)
goto out;
} else if (!strcmp(token, "cdpl2")) {
ret = cdpl2_enable();
if (ret)
goto out;
} else {
ret = -EINVAL;
goto out;
}
}
return 0;
out:
pr_err("Invalid mount option \"%s\"\n", token);
return ret;
}
/*
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册