Commit cb957295 authored by Zeng Heng's avatar Zeng Heng
Browse files

arm64/mpam: update reminder message about MBHDL option

hulk inclusion
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I91YTV


CVE: NA

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

Corrected debugging reminder information about MBHDL option of
schemata interface.

  # echo "MBHDL:1=2" > schemata
  -bash: echo: write error: Invalid argument
  # cat info/last_cmd_status
  MB value 2 exceed 1

Signed-off-by: default avatarZeng Heng <zengheng4@huawei.com>
parent c6bcd162
Loading
Loading
Loading
Loading
+9 −13
Original line number Diff line number Diff line
@@ -340,15 +340,16 @@ parse_bw(char *buf, struct resctrl_resource *r,
		return -EINVAL;
	}

	switch (rr->ctrl_features[type].evt) {
	case QOS_MBA_MAX_EVENT_ID:
	case QOS_MBA_PBM_EVENT_ID:
	case QOS_MBA_MIN_EVENT_ID:
	if (kstrtoul(buf, rr->ctrl_features[type].base, &data)) {
		rdt_last_cmd_printf("Non-decimal digit in MB value %s\n", buf);
		return -EINVAL;
	}
		if (data < r->mbw.min_bw) {

	switch (rr->ctrl_features[type].evt) {
	case QOS_MBA_MAX_EVENT_ID:
	case QOS_MBA_PBM_EVENT_ID:
	case QOS_MBA_MIN_EVENT_ID:
		if (data < r->mbw.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);
			return -EINVAL;
@@ -356,19 +357,14 @@ parse_bw(char *buf, struct resctrl_resource *r,
		data = roundup(data, r->mbw.bw_gran);
		break;
	default:
		if (kstrtoul(buf, rr->ctrl_features[type].base, &data)) {
			rdt_last_cmd_printf("Non-decimal digit in MB value %s\n", buf);
		if (data >= rr->ctrl_features[type].max_wd) {
			rdt_last_cmd_printf("MB value %ld exceed %d\n", data,
					rr->ctrl_features[type].max_wd - 1);
			return -EINVAL;
		}
		break;
	}

	if (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);
		return -EINVAL;
	}

	cfg->new_ctrl[type] = data;
	cfg->ctrl_updated[type] = true;
	cfg->have_new_ctrl = true;