]> git.itanic.dy.fi Git - linux-stable/commitdiff
selftests/resctrl: Fix MBM test failure when MBA unavailable
authorIlpo Järvinen <ilpo.jarvinen@linux.intel.com>
Wed, 18 Oct 2023 07:55:26 +0000 (10:55 +0300)
committerShuah Khan <skhan@linuxfoundation.org>
Wed, 18 Oct 2023 20:33:44 +0000 (14:33 -0600)
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 the commit
20d96b25cc4c ("selftests/resctrl: Fix schemata write error check").
That commit 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")
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Reviewed-by: Reinette Chatre <reinette.chatre@intel.com>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
tools/testing/selftests/resctrl/mbm_test.c

index d3c0d30c676a7fb0f5c46ce37c928994b15f606e..741533f2b075884d8983e8635cc454f05d29ea6c 100644 (file)
@@ -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);