From: Wang ShaoBo bobo.shaobowang@huawei.com
hulk inclusion category: bugfix bugzilla: 34278 CVE: NA
-------------------------------------------------
Unlike mbw max(Memory Bandwidth Maximum), sometimes we don't want make use of mbw min feature(this for restrict memory bandwidth maximum capacity partition by using MPAMCFG_MBW_MIN, MBMIN row in schemata) and set MPAMCFG_MBW_MIN to 0.
e.g. > mount -t resctrl resctrl /sys/fs/resctrl/ -o mbMin > cd resctrl/ && cat schemata L3:0=7fff;1=7fff;2=7fff;3=7fff MBMIN:0=0;1=0;2=0;3=0
# before revision > echo 'MBMIN:0=0;1=0;2=0;3=0' > schemata > cat schemata L3:0=7fff;1=7fff;2=7fff;3=7fff MBMIN:0=2;1=2;2=2;3=2
# after revision > echo 'MBMIN:0=0;1=0;2=0;3=0' > schemata > cat schemata L3:0=7fff;1=7fff;2=7fff;3=7fff MBMIN:0=0;1=0;2=0;3=0
Fixes: 5a49c4f1983d ("arm64/mpam: Supplement additional useful ctrl features for mount options") Signed-off-by: Wang ShaoBo bobo.shaobowang@huawei.com Reviewed-by: Jian Cheng cj.chengjian@huawei.com Signed-off-by: Yang Yingliang yangyingliang@huawei.com --- arch/arm64/kernel/mpam/mpam_resctrl.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/arch/arm64/kernel/mpam/mpam_resctrl.c b/arch/arm64/kernel/mpam/mpam_resctrl.c index 3998305a08ef6..fb5e7c8e59da5 100644 --- a/arch/arm64/kernel/mpam/mpam_resctrl.c +++ b/arch/arm64/kernel/mpam/mpam_resctrl.c @@ -328,13 +328,18 @@ parse_bw(char *buf, struct resctrl_resource *r,
switch (rr->ctrl_features[type].evt) { case QOS_MBA_MAX_EVENT_ID: - case QOS_MBA_MIN_EVENT_ID: case QOS_MBA_PBM_EVENT_ID: if (kstrtoul(buf, rr->ctrl_features[type].base, &data)) return -EINVAL; data = (data < r->mbw.min_bw) ? r->mbw.min_bw : data; data = roundup(data, r->mbw.bw_gran); break; + case QOS_MBA_MIN_EVENT_ID: + if (kstrtoul(buf, rr->ctrl_features[type].base, &data)) + return -EINVAL; + /* for mbw min feature, 0 of setting is allowed */ + data = roundup(data, r->mbw.bw_gran); + break; default: if (kstrtoul(buf, rr->ctrl_features[type].base, &data)) return -EINVAL;