hulk inclusion category: bugfix bugzilla: https://atomgit.com/openeuler/kernel/issues/8421 ------------------------------------------ Currently, the value of schemata's MBMIN cannot be set to 0, which prevents users from disabling the mbMin feature:
echo MB:0=0 > resctrl/schemata -bash: echo: write error: Invalid argument
Fix it by differentiating min_bw in parse_bw. Fixes: d329f67f844b ("arm64/mpam: update last_cmd_status in parse_cache() and parse_bw()") Signed-off-by: Quanmin Yan <yanquanmin1@huawei.com> --- arch/arm64/kernel/mpam/mpam_resctrl.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/arch/arm64/kernel/mpam/mpam_resctrl.c b/arch/arm64/kernel/mpam/mpam_resctrl.c index b3cc8c709787..b6f9cdb410ef 100644 --- a/arch/arm64/kernel/mpam/mpam_resctrl.c +++ b/arch/arm64/kernel/mpam/mpam_resctrl.c @@ -337,7 +337,7 @@ parse_bw(char *buf, struct resctrl_resource *r, struct resctrl_staged_config *cfg, enum resctrl_ctrl_type type) { - unsigned long data; + unsigned long data, min_bw = 0; struct raw_resctrl_resource *rr = r->res; if (cfg->have_new_ctrl) { @@ -353,10 +353,11 @@ parse_bw(char *buf, struct resctrl_resource *r, switch (rr->ctrl_features[type].evt) { case QOS_MBA_MAX_EVENT_ID: case QOS_MBA_PBM_EVENT_ID: + min_bw = r->mbw.min_bw; case QOS_MBA_MIN_EVENT_ID: - if (data < r->mbw.min_bw || data >= rr->ctrl_features[type].max_wd) { + if (data < min_bw || data >= rr->ctrl_features[type].max_wd) { rdt_last_cmd_printf("MB value %ld out of range [%d,%d]\n", data, - r->mbw.min_bw, rr->ctrl_features[type].max_wd - 1); + (int)min_bw, rr->ctrl_features[type].max_wd - 1); return -EINVAL; } data = roundup(data, r->mbw.bw_gran); -- 2.43.0