Skip to contentSkip to conversation

selftests/resctrl: Don't fail MBM test when schemata doesn't support MB:x=x line

PATCH In review Ilpo Järvinen 2 participants 2 messages Oct 17, 2023

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 selftests/resctrl: Don't fail MBM test when schemata doesn't support MB:x=x line

Commit 20d96b25cc4c ("selftests/resctrl: Fix schemata write error check") exposed a problem in feature detection logic in MBM selftest. If schemata does not support MB:x=x entries, the schemata write to initialize 100% memory bandwidth allocation in mbm_setup() will now fail with -EINVAL due to the error handling corrected by 20d96b25cc4c. Commit 20d96b25cc4c just uncovers the failed write, it is not wrong itself.

If MB:x=x is not supported by schemata, it is safe to assume 100% memory bandwidth is always set. Therefore, the previously ignored error does not make the MBM test itself wrong.

Restore the previous behavior of MBM test by checking MB support before attempting to write it into schemata which results in behavior equivalent to ignoring the write error.

Fixes 20d96b25cc4c ("selftests/resctrl: Fix schemata write error check")
---
 tools/testing/selftests/resctrl/mbm_test.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/resctrl/mbm_test.c +1 -1
index d3c0d30c676a..85987957e7f5 100644
@@ -95,7 +95,7 @@ static int mbm_setup(struct resctrl_val_param *p)
 		return END_OF_TESTS;
 
 	/* Set up shemata with 100% allocation on the first run. */
-	if (p->num_of_runs == 0)
+	if ((p->num_of_runs == 0) && validate_resctrl_feature_request("MB", NULL))
 		ret = write_schemata(p->ctrlgrp, "100", p->cpu_no,
 				     p->resctrl_val);
 
Signature · 1 line
2.30.2
maintainer Reviewed-by on v1 1/1
#1 lore raw

Hi Ilpo,

The subject could be shortened to:
selftests/resctrl: Fix MBM test failure when MBA unavailable

Quoted 27 lines · Ilpo Järvinen

Commit 20d96b25cc4c ("selftests/resctrl: Fix schemata write error check") exposed a problem in feature detection logic in MBM selftest. If schemata does not support MB:x=x entries, the schemata write to initialize 100% memory bandwidth allocation in mbm_setup() will now fail with -EINVAL due to the error handling corrected by 20d96b25cc4c. Commit 20d96b25cc4c just uncovers the failed write, it is not wrong itself.

If MB:x=x is not supported by schemata, it is safe to assume 100% memory bandwidth is always set. Therefore, the previously ignored error does not make the MBM test itself wrong.

Restore the previous behavior of MBM test by checking MB support before attempting to write it into schemata which results in behavior equivalent to ignoring the write error.

Fixes 20d96b25cc4c ("selftests/resctrl: Fix schemata write error check")
---
 tools/testing/selftests/resctrl/mbm_test.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/resctrl/mbm_test.c +0 -0
index d3c0d30c676a..85987957e7f5 100644

tools/testing/selftests/resctrl/mbm_test.c static int mbm_setup(struct resctrl_val_param *p) · line 101

Quoted 8 lines
tools/testing/selftests/resctrl/mbm_test.c +1 -1
@@ -95,7 +95,7 @@ static int mbm_setup(struct resctrl_val_param *p)
 		return END_OF_TESTS;
 
 	/* Set up shemata with 100% allocation on the first run. */
-	if (p->num_of_runs == 0)
+	if ((p->num_of_runs == 0) && validate_resctrl_feature_request("MB", NULL))
 		ret = write_schemata(p->ctrlgrp, "100", p->cpu_no,
 				     p->resctrl_val);
 

Thank you for catching this.

Could you please ensure that this patch passes a "checkpatch.pl --strict" check? With that addressed:

Reinette