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 <swapnil.sapkal@amd.com>
Subject: [PATCH v5 0/5] selftests/resctrl: Add MBM and MBA test support for AMD
Date: Thu, 22 Oct 2026 13:25:11 +0000 [thread overview]
Message-ID: <20261022132517.46805-1-swapnil.sapkal@amd.com> (raw)
The MBM (Memory Bandwidth Monitoring) and MBA (Memory Bandwidth
Allocation) resctrl selftests validate the bandwidth numbers reported by
resctrl against the memory controller performance counters. Today this
only works on Intel, where the counters are the iMC (Integrated Memory
Controller) PMUs and the tests are gated behind an ARCH_INTEL vendor
check.
This series teaches the tests about the AMD UMC (Unified Memory
Controller) PMUs and enables MBM and MBA on AMD.
The work is done in a few steps:
1. Rename the Intel specific imc/IMC identifiers to the generic
mc/MC so the code can serve both vendors.
2. Detect the vendor and select the memory controller PMU sysfs name
accordingly, keeping the rest of the code generic.
3. Add the AMD UMC support. Unlike Intel, the UMC PMU does not expose
the CAS command events via sysfs, so the read event is programmed
directly (EventCode 0x0a, umask 0x1). All vendor detection is
contained in enumerate_mcs() and dispatched to per-vendor routines.
On AMD each UMC is a per-NUMA-node PMU, so only the UMCs local to
the benchmark CPU are opened; remote-node UMCs would otherwise fail
perf_event_open() with -ENODEV.
4. Sweep the AMD MBA schemata using absolute bandwidth values (4 GB/s
to 40 GB/s) instead of the Intel style percentages (10% to 100%).
5. Extend the vendor_specific gate of the tests to Intel and AMD so
they run on AMD as well. The gate is kept (rather than removed)
so vendors that enumerate_mcs() does not know about are skipped
instead of reported as a failure.
Testing
-------
Tested on AMD Zen5 (single-numa and multi-NUMA); MBM and MBA tests
pass on both.
This series applies on top of the kselftest tree's "next" branch.
v4: https://lore.kernel.org/all/20260810184806.1089507-1-swapnil.sapkal@amd.com/
Changes since v4:
- Rebased onto the kselftest "next" branch. The memory bandwidth
counters there are now kept in a dynamically managed linked list
(instead of a fixed array), so the whole series was reworked on top of
that infrastructure. The enumeration routine is now enumerate_mcs()
and the AMD path allocates and links each UMC counter.
- No other functional changes relative to v4.
Babu Moger (4):
selftests/resctrl: Rename variables and functions to generic names
selftests/resctrl: Detect vendor to select memory controller sysfs
name
selftests/resctrl: Add support for MBM and MBA tests on AMD
selftests/resctrl: Enable MBM and MBA tests on AMD
Swapnil Sapkal (1):
selftests/resctrl: Use bandwidth values for AMD MBA schemata
tools/testing/selftests/resctrl/mba_test.c | 107 +++--
tools/testing/selftests/resctrl/mbm_test.c | 26 +-
tools/testing/selftests/resctrl/resctrl.h | 6 +-
tools/testing/selftests/resctrl/resctrl_val.c | 384 +++++++++++-------
4 files changed, 334 insertions(+), 189 deletions(-)
--
2.43.0
next reply other threads:[~2026-10-22 13:25 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-22 13:25 Swapnil Sapkal [this message]
2026-10-22 13:25 ` [PATCH v5 1/5] selftests/resctrl: Rename variables and functions to generic names Swapnil Sapkal
2026-10-28 18:38 ` Reinette Chatre
2026-10-22 13:25 ` [PATCH v5 2/5] selftests/resctrl: Detect vendor to select memory controller sysfs name Swapnil Sapkal
2026-10-28 18:39 ` Reinette Chatre
2026-10-22 13:25 ` [PATCH v5 3/5] selftests/resctrl: Add support for MBM and MBA tests on AMD Swapnil Sapkal
2026-10-28 18:41 ` Reinette Chatre
2026-10-22 13:25 ` [PATCH v5 4/5] selftests/resctrl: Use bandwidth values for AMD MBA schemata Swapnil Sapkal
2026-10-28 18:45 ` Reinette Chatre
2026-10-22 13:25 ` [PATCH v5 5/5] selftests/resctrl: Enable MBM and MBA tests on AMD Swapnil Sapkal
2026-10-28 18:45 ` Reinette Chatre
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=20261022132517.46805-1-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®