From: Swapnil Sapkal <swapnil.sapkal@amd.com>
To: <tony.luck@intel.com>, <reinette.chatre@intel.com>,
<babu.moger@amd.com>, <fenghua.yu@intel.com>, <shuah@kernel.org>
Cc: <Dave.Martin@arm.com>, <james.morse@arm.com>,
<peternewman@google.com>, <eranian@google.com>,
<tan.shaopeng@fujitsu.com>, <linux-kernel@vger.kernel.org>,
<linux-kselftest@vger.kernel.org>, <x86@kernel.org>,
<swapnil.sapkal@amd.com>
Subject: [PATCH v6 5/5] selftests/resctrl: Enable MBM and MBA tests on AMD
Date: Tue, 1 Dec 2026 08:34:26 +0000 [thread overview]
Message-ID: <20261201083426.26730-6-swapnil.sapkal@amd.com> (raw)
In-Reply-To: <20261201083426.26730-1-swapnil.sapkal@amd.com>
From: Babu Moger <babu.moger@amd.com>
Now that the UMC (Unified Memory Controller) perf events can be used to
validate the resctrl memory bandwidth numbers on AMD, extend the
vendor_specific gate of the MBM and MBA tests to also cover AMD so that
they run on AMD in addition to Intel.
The tests stay restricted to Intel and AMD: enumerate_mcs() only knows
about the iMC and UMC counters, so keeping the gate (rather than making
the tests universal) leaves other vendors skipped instead of failing.
The MBM test wrote a hardcoded "100" to the memory bandwidth allocation
so that the bandwidth it measures is not throttled. That value is only
correct where the allocation is a percentage. On AMD the allocation is
an absolute bandwidth value in units of 1/8 GB/s, so the write throttled
the benchmark to 12.5 GB/s instead of leaving it unthrottled.
Drop the write. resctrl is mounted for the duration of each test, so the
con_mon grp is created fresh and still carries the resource's default
allocation, which is already the maximum. Writing anything would require
the test to know whether the allocation is a percentage or an absolute
bandwidth value, which is exactly what went wrong.
Signed-off-by: Babu Moger <babu.moger@amd.com>
Co-developed-by: Swapnil Sapkal <swapnil.sapkal@amd.com>
Signed-off-by: Swapnil Sapkal <swapnil.sapkal@amd.com>
---
v5->v6:
- Fixed the issue reported by Sashiko: the MBM test wrote a hardcoded
"100" to leave the bandwidth unthrottled, which is only correct for
the percentage based interface. On AMD the allocation is absolute, so
the write throttled the benchmark to 12.5 GB/s. resctrl is mounted per
test, so the con_mon grp is always created fresh and already carries
the default (maximum) allocation. Drop the write instead of replacing
the value: nothing has to know whether the allocation is a percentage
or an absolute bandwidth value. (Reinette, Sashiko)
v4->v5:
- Extended the vendor_specific gate to ARCH_INTEL | ARCH_AMD instead of
removing it, so unsupported vendors are skipped rather than failed.
tools/testing/selftests/resctrl/mba_test.c | 2 +-
tools/testing/selftests/resctrl/mbm_test.c | 17 +++++++++--------
2 files changed, 10 insertions(+), 9 deletions(-)
diff --git a/tools/testing/selftests/resctrl/mba_test.c b/tools/testing/selftests/resctrl/mba_test.c
index ca87396671f0..fe032798ed53 100644
--- a/tools/testing/selftests/resctrl/mba_test.c
+++ b/tools/testing/selftests/resctrl/mba_test.c
@@ -245,7 +245,7 @@ static bool mba_feature_check(const struct resctrl_test *test)
struct resctrl_test mba_test = {
.name = "MBA",
.resource = "MB",
- .vendor_specific = ARCH_INTEL,
+ .vendor_specific = ARCH_INTEL | ARCH_AMD,
.feature_check = mba_feature_check,
.run_test = mba_run_test,
.cleanup = mba_test_cleanup,
diff --git a/tools/testing/selftests/resctrl/mbm_test.c b/tools/testing/selftests/resctrl/mbm_test.c
index e24c6237a22f..0aab39647100 100644
--- a/tools/testing/selftests/resctrl/mbm_test.c
+++ b/tools/testing/selftests/resctrl/mbm_test.c
@@ -102,19 +102,20 @@ static int mbm_setup(const struct resctrl_test *test,
const struct user_params *uparams,
struct resctrl_val_param *p)
{
- int ret = 0;
-
/* Run NUM_OF_RUNS times */
if (p->num_of_runs >= NUM_OF_RUNS)
return END_OF_TESTS;
- /* Set up shemata with 100% allocation on the first run. */
- if (p->num_of_runs == 0 && resctrl_resource_exists("MB"))
- ret = write_schemata(p->ctrlgrp, "100", uparams->cpu, test->resource);
-
+ /*
+ * The memory bandwidth must not be throttled while it is measured.
+ * The con_mon grp is created for this test run and so still carries
+ * the default allocation, which is the maximum, and no schemata needs
+ * to be written to obtain it. Writing one would need to know whether
+ * the allocation is a percentage or an absolute bandwidth value.
+ */
p->num_of_runs++;
- return ret;
+ return 0;
}
static int mbm_measure(const struct user_params *uparams,
@@ -178,7 +179,7 @@ static bool mbm_feature_check(const struct resctrl_test *test)
struct resctrl_test mbm_test = {
.name = "MBM",
.resource = "MB",
- .vendor_specific = ARCH_INTEL,
+ .vendor_specific = ARCH_INTEL | ARCH_AMD,
.feature_check = mbm_feature_check,
.run_test = mbm_run_test,
.cleanup = mbm_test_cleanup,
--
2.43.0
prev parent reply other threads:[~2026-12-01 8:36 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-01 8:34 [PATCH v6 0/5] selftests/resctrl: Add MBM and MBA test support for AMD Swapnil Sapkal
2026-12-01 8:34 ` [PATCH v6 1/5] selftests/resctrl: Rename variables and functions to generic names Swapnil Sapkal
2026-12-01 8:34 ` [PATCH v6 2/5] selftests/resctrl: Detect vendor to select memory controller sysfs name Swapnil Sapkal
2026-12-01 8:34 ` [PATCH v6 3/5] selftests/resctrl: Add support for MBM and MBA tests on AMD Swapnil Sapkal
2026-12-01 8:34 ` [PATCH v6 4/5] selftests/resctrl: Use bandwidth values for AMD MBA schemata Swapnil Sapkal
2026-12-01 8:34 ` Swapnil Sapkal [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261201083426.26730-6-swapnil.sapkal@amd.com \
--to=swapnil.sapkal@amd.com \
--cc=Dave.Martin@arm.com \
--cc=babu.moger@amd.com \
--cc=eranian@google.com \
--cc=fenghua.yu@intel.com \
--cc=james.morse@arm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=peternewman@google.com \
--cc=reinette.chatre@intel.com \
--cc=shuah@kernel.org \
--cc=tan.shaopeng@fujitsu.com \
--cc=tony.luck@intel.com \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®