From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=40.93.198.25 ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1796114120; b=WI8Rli/SvuMQMiFv6XhgrcKKolbXKNDtDBucjNnCvPtNYvC2Lmlff42S/GRyBOmXGXvZ Vxz7UX0SG+MFumR8ZyxH7Ta55l1cqqlyu1QFMAAkiIKoFMaStgRjkeiGh711eW3sypi+9 S7gQN9sZUJKOq1q5m52BgNo13Ic3yXJFTdYZ3O7nTHWu6BnrCE2p/wusT8o3PEX0BaxfC ew/wPORqzf6/PreY2blWC/nHaGkYPaOLD0pG5vN1W+/gsEk4pPB3cEimOj+OXidykt8EP 4IJn1vnZMOilIP3o9UtCm0Q12H+9Wp4zwLwTVuNkAO0RISjeGzrtOBBFkG7io3yq8WQ== ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796114120; h=DMARC-Filter:DKIM-Signature:Received:Received: X-MS-Exchange-Authentication-Results:Received-SPF:Received:Received: From:To:CC:Subject:Date:Message-ID:X-Mailer:MIME-Version: Content-Transfer-Encoding:Content-Type:X-Originating-IP: X-ClientProxiedBy:X-EOPAttributedMessage:X-MS-PublicTrafficType: X-MS-TrafficTypeDiagnostic:X-MS-Office365-Filtering-Correlation-Id: X-MS-Exchange-SenderADCheck:X-MS-Exchange-AntiSpam-Relay: X-Microsoft-Antispam:X-Microsoft-Antispam-Message-Info: X-Forefront-Antispam-Report: X-MS-Exchange-AntiSpam-MessageData-ChunkCount: X-MS-Exchange-AntiSpam-MessageData-0:X-OriginatorOrg: X-MS-Exchange-CrossTenant-OriginalArrivalTime: X-MS-Exchange-CrossTenant-Network-Message-Id: X-MS-Exchange-CrossTenant-Id: X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: X-MS-Exchange-CrossTenant-AuthSource:X-MS-Exchange-CrossTenant-AuthAs: X-MS-Exchange-CrossTenant-FromEntityHeader: X-MS-Exchange-Transport-CrossTenantHeadersStamped; bh=zolWkyAluMdOV+zJg3OR6Yby34VHFryKyodKpePp4HE=; b=2sXXN7kAWbVbssnk3AS61A4U/0A/rX3pr8Tgx2VcXThbP8l9kqECThDIfIYyHSirhr39 pWl1FoEzcYEoOJSduslwgGYcygU++1JAmBqXyGd/qON8Ib4SwhnjKsxBkUPMSfdBUtxJA 0XGEkmztLdxKm5/J5wiNcw6orEmBaXtApo++J9WNBATdSHKOdK5WOoGv7cJpkYD1fmGeh eJz5JkXPR8anMfvx7+PkBn/4+KRhyHraJEymzPCSexByiRuBAK+uPCABRkfBdB6IBeyLn 8LG7twAWFl/dvfMsGpVWCKYxISX6gjJuZLK5LBNPkWaBB3fesS5kTOimMlPHDlT1Bsg== ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass header.d=amd.com header.i=@amd.com header.a=rsa-sha256 header.s=selector1 header.b=igKEiSv2; arc=pass header.oldest-pass=0 smtp.remote-ip=40.93.198.25 Received: from CY7PR03CU001.outbound.protection.outlook.com (mail-westcentralusazon11010025.outbound.protection.outlook.com [40.93.198.25]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (secp384r1) server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 80799606A330; Tue, 1 Dec 2026 08:35:19 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 80799606A330 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key, unprotected) header.d=amd.com header.i=@amd.com header.a=rsa-sha256 header.s=selector1 header.b=igKEiSv2 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=MsIMTODF4WgMcTGS17NapbFhXewpx0MorFlNLTi0lCEcFQtc7COdruiisuoHbKul4Ol3E5+C6OL3u8hgBmNjwxSBaOr9AEIfwPKi441IAWic4ryPpa8U+TxMgNtz8+HGk1m6GECkr92CzYBZFx+9J6Ui+JprSn0qcGwr8ZjfHstKIlY1AYiSY910Wh/PbGc41BuRdxAiAfF9GwxY5w4vAMIxPefQ3ky16ByjM287QZcIDGVKy/sRUT1lutiEQn9qV6vuH6L2Ffo0Y3fqsMX9LGAmQw8p7RrucGMLmveLLpOKiyb1Fk6WjnvQmgH0wOtO2IOwqLsH1M4cmOPCTca/MA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=zolWkyAluMdOV+zJg3OR6Yby34VHFryKyodKpePp4HE=; b=xULh7gwDyzg/bWZzO0QVO4K9xPnU/GTtcwsRw6C6bNAcnZG7eBZGE7yBTJkoZtu+8lw873+ErtYdfrUP91KSHbCuFUu87z/XJi5NUi5VBXXPsXkpURE68uVD2P/kQwyQXWRWVQXoIoxOyKJF/3tTfCXROWXldd3mapkRQhsfeyajzzTQJz+qlGew0Tbd8l9osbZKZezqxwIGS2CtJ18vO4XfWjWsq/OkKD29rNQQe7vDkjM2XWPIdpuiMHEBLE6sZMlVBMqLr3yrvIjPjPohjeWn9X7vo56fg0ARAgziMWuxdZQR313r4jFMV4OM/rRqwZmCvgBdbpjLRfDfia80jw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=intel.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=zolWkyAluMdOV+zJg3OR6Yby34VHFryKyodKpePp4HE=; b=igKEiSv2R+f61722lqzCrWUzK/vxxSdW8yu6/iSVFqIPw8yJHOE8XP0FkU1Q3oe0y2ywJg5ZO2VpDdISxAStI6e5DgGAjLK2hfzA7yxLtQm3Sz+f7f73VqpunHK/PXDx6eAvboaRswND+JVXeiwtFYYY8JfyrNjMEGz9eAn76dg= Received: from BY5PR03CA0022.namprd03.prod.outlook.com (2603:10b6:a03:1e0::32) by MW4PR12MB5641.namprd12.prod.outlook.com (2603:10b6:303:186::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.688.10; Tue, 1 Dec 2026 08:35:16 +0000 Received: from SJ1PEPF000037A6.namprd04.prod.outlook.com (2603:10b6:a03:1e0:cafe::8c) by BY5PR03CA0022.outlook.office365.com (2603:10b6:a03:1e0::32) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.688.10 via Frontend Transport; Tue, 1 Dec 2026 08:35:15 +0000 X-MS-Exchange-Authentication-Results: mx.microsoft.com 1; spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=satlexmb07.amd.com; pr=C Received: from satlexmb07.amd.com (165.204.84.17) by SJ1PEPF000037A6.mail.protection.outlook.com (10.167.244.138) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.688.5 via Frontend Transport; Tue, 1 Dec 2026 08:35:15 +0000 Received: from tapi.amd.com (10.180.168.240) by satlexmb07.amd.com (10.181.42.216) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.57; Tue, 1 Dec 2026 02:35:11 -0600 From: Swapnil Sapkal To: , , , , CC: , , , , , , , , Subject: [PATCH v6 0/5] selftests/resctrl: Add MBM and MBA test support for AMD Date: Tue, 1 Dec 2026 08:34:21 +0000 Message-ID: <20261201083426.26730-1-swapnil.sapkal@amd.com> X-Mailer: git-send-email 2.43.0 X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: satlexmb08.amd.com (10.181.42.217) To satlexmb07.amd.com (10.181.42.216) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ1PEPF000037A6:EE_|MW4PR12MB5641:EE_ X-MS-Office365-Filtering-Correlation-Id: 8628388b-1145-4023-ef4d-08df4f860634 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|36860700016|1800799024|7416014|376014|23010399003|82310400026|10067099003|56012099006|261028144727099003|261102123227099003|261026121527099003|261026140227099003|261021123027099003|261021121427099003|261022105027099003|261009223027099003|11063799006|18002099003|6133799003|13003099007|3023799007; X-Microsoft-Antispam-Message-Info: npLTGe+ojWiGe/YVr667lFBssG92XGOiwAyNkFwfH/u1qg+/Wna0NW6AL8j3T5YeH3W9WfbXcgGTOK2nkq6Kxo3XdnvOz/wucL1MtNms3mGBaIwnOkcTvmOCKK3Vb639mWvFXWpDg3hReAEqZxSqpexgOKpdnqlRlOqLFY6NKTIUnvj018OqvJfo7Tn/Z1CsFpAQ8b/Oce9VufXkhHKJyOUV/w6rbszH1HgXAQubIXGa9bgkyygQ93XaD2NDYVHSD2OYLSFiscPLw1bmKmukMe1yydq9GukHamB6ncBwUkSH/P+CLUZlFTaO/v2Th2vYvlD3Vi4BgWQB+QqXTQ2eB5EMPa4MsqbO7dbEHFSfDiDUyA9EWfTRbZJS1ssRhMfwrjbhYw0LcrzfHvSBHsCQreXnf5bxu9zE5+o8ep5gUXCynERHN8b/GMaqIfWer9B7bZJSjGPeuQYeL3VkUngHbpxc0mC2zYo5jK0utVbMweqiSM5m0kY0j4S27aqkQqXZ8macb6Gkc547cycLqb3UUoELMF4RDrtv+IWlhIglYVr1ZthbpwZYyYFzkoeMiOn6TWsE3pMQzAq91dO9G3Z1oaorIwdmsC7iMElb+A5xMnOtudXl9csb4ughHI1L70Tr473d779rgSsM+7VAzMaLuCdp51G3pDiDzNWyCoRLZ1U= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:satlexmb07.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(36860700016)(1800799024)(7416014)(376014)(23010399003)(82310400026)(10067099003)(56012099006)(261028144727099003)(261102123227099003)(261026121527099003)(261026140227099003)(261021123027099003)(261021121427099003)(261022105027099003)(261009223027099003)(11063799006)(18002099003)(6133799003)(13003099007)(3023799007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: q+IQgxb45ZegQ2du3d9XzqmoJqW5V63DU4v4Q3VE/mNXtfQKvm90N8SwQpM3POrMgqR2h8bBS2nxg97Tw/pyjKdmu20ovnOIRhidOkajRyTl+U2obOMTrJtKdLrtdFeS4zPUkEgSTTEPgDdzdVgTbkKqO8vFUz5YHGv2JK6g8Y7nQYa6GPHcDzQiYqFb0IJ3DFTHI0rWSldxadnsSmvm4bq9ZogyEOSv4RDlwPIFl/kQbzIANSZ1hibl0R/e01AlrW8jGpTXbG4yBkM7Ixwgc3wwtLEzSpCfq+Dy0v535nEvaiRFJiBnwm+X7VVNd6U4Akq242VXwfUbPRkXC3B39ieQ3W+n6Sr/zqUUs35vWnMVNUQeFe0xlVkwcghSxsLpjYveyXbDmOdeTZsBNM1KIeA/Do0v8v2kgEfosUl5yjJbTSzfppfxuUSXY8onM+1Y X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Dec 2026 08:35:15.6977 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8628388b-1145-4023-ef4d-08df4f860634 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[satlexmb07.amd.com] X-MS-Exchange-CrossTenant-AuthSource: SJ1PEPF000037A6.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR12MB5641 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 that can only be opened from a CPU on the same node, so UMCs that fail with -ENODEV are dropped from the counter list and only the ones local to the benchmark are measured. 4. Sweep the AMD MBA schemata using absolute bandwidth values (4 GB/s to 40 GB/s) instead of percentages (10% to 100%). 5. Extend the vendor_specific gate of the tests to Intel and AMD so they run on AMD as well, and stop the MBM test from writing a hardcoded "100" as the unthrottled allocation. Use of AI --------- AI tooling (Claude) was used while preparing this series: to port the original patches across the upstream resctrl_val.c refactors, to help draft commit messages, and to review the changes. All of the resulting code and changelogs were reviewed, corrected and tested by the authors, who take full responsibility for the content. Testing ------- Tested on AMD Zen5 (multi-NUMA) and Intel systems; MBM and MBA tests pass on both. This series applies on top of the kselftest tree's "next" branch. v5: https://lore.kernel.org/all/20261022132517.46805-1-swapnil.sapkal@amd.com/ Changes since v5 (per-patch changelogs are below the '---' of each patch): - Dropped the Assisted-by: tags (commit 1e035297ffda) in favour of the statement above. - Renamed UNCORE_IMC to INTEL_IMC. - Drop memory controllers that cannot be opened (-ENODEV) from mc_counters_list rather than carrying them with an invalid fd, which removes the repeated open attempts and all the fd validity checks. - Reworked the MBA sweep to be index based and bounded by NUM_OF_ALLOCS (now a plain 10), which removes mba_alloc_max() and the 'allocation == 0' sentinel. With the sweep length no longer derived from the per vendor constants, ALLOCATION_MAX and AMD_ALLOCATION_MAX lost their last user and were dropped along with the build time checks on them. - Dropped the unrelated result-count check in check_results(). - Fixed the issue reported by Sashiko: the MBM test wrote a hardcoded "100" to leave the bandwidth unthrottled, which throttled the benchmark to 12.5 GB/s on AMD. The write is dropped entirely, since the con_mon grp is created fresh for each test and already carries the default (maximum) allocation. 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 | 94 +++-- tools/testing/selftests/resctrl/mbm_test.c | 41 +- tools/testing/selftests/resctrl/resctrl.h | 6 +- tools/testing/selftests/resctrl/resctrl_val.c | 377 +++++++++++------- 4 files changed, 314 insertions(+), 204 deletions(-) -- 2.43.0