From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0A372402444 for ; Mon, 11 May 2026 15:42:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778514124; cv=none; b=j8m5okcdWsP0InYwpm0nUAPlnMbMQyUVg28suEohvbP8csd7rCNMsfGRThJ24nVXTWAnQ0IleidAxDr5vekzZMfTM1OvHGC1o8h1DQ4Rw1PvFpbmMv/vFJx2OiR6gCxlEL4JlipJ4SsR8NtCiJFiq1ZKhOv1nBJejnfdYJ8m8cM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778514124; c=relaxed/simple; bh=CGFdMXTo+81h7UBgS6WP6D+kCuc8CPMftY7945gx7xo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=eJkekmFaXBS4XPf8INABpvpIZpzcpdmHCWQcg3bQPL7OUGopKoAzNLxNRZfjyX9GLyATv7UHEWPHbaw2PzHy7uY7Kts9tzxUsmBxfkpFSXku8APPkFGyoCU3ZMx1iFp8FYysgvioMVAlUgTgDhn4SFptBFaYlBueXr5IQGPumFM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; dkim=pass (1024-bit key) header.d=arm.com header.i=@arm.com header.b=XLXY9jD4; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=arm.com header.i=@arm.com header.b="XLXY9jD4" Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id A74532BC4; Mon, 11 May 2026 08:41:56 -0700 (PDT) Received: from e134344.cambridge.arm.com (e134344.arm.com [10.1.196.46]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id AB6D13F836; Mon, 11 May 2026 08:41:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=arm.com; s=foss; t=1778514121; bh=CGFdMXTo+81h7UBgS6WP6D+kCuc8CPMftY7945gx7xo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XLXY9jD4ILYWWjsXhybjKuNvkBuivi9PRgLSlN8W2EkfbGWyyKfw9E6W4jWsHbdtU P/eZPjRiJjWjJAeMoH7x9Hhb4CV39WcrDHPYGK+vK7I1/e/xeqtvHVvJM4p1vPQ1u1 lW2bBFZjZ1oFlssuwdvmU8hgP7TwTIRC+9uuqDIA= From: Ben Horgan To: ben.horgan@arm.com Cc: amitsinght@marvell.com, baisheng.gao@unisoc.com, baolin.wang@linux.alibaba.com, carl@os.amperecomputing.com, dave.martin@arm.com, david@kernel.org, dfustini@baylibre.com, fenghuay@nvidia.com, gshan@redhat.com, james.morse@arm.com, jonathan.cameron@huawei.com, kobak@nvidia.com, lcherian@marvell.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, peternewman@google.com, punit.agrawal@oss.qualcomm.com, quic_jiles@quicinc.com, reinette.chatre@intel.com, rohit.mathew@arm.com, scott@os.amperecomputing.com, sdonthineni@nvidia.com, tan.shaopeng@fujitsu.com, xhao@linux.alibaba.com, zengheng4@huawei.com, x86@kernel.org, Shaopeng Tan Subject: [PATCH v3 1/5] arm_mpam: resctrl: Pick classes for use as mbm counters Date: Mon, 11 May 2026 16:41:43 +0100 Message-ID: <20260511154147.557481-2-ben.horgan@arm.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260511154147.557481-1-ben.horgan@arm.com> References: <20260511154147.557481-1-ben.horgan@arm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: James Morse resctrl has two types of counters, NUMA-local and global. MPAM can only count global either using MSC at the L3 cache or in the memory controllers. When global and local equate to the same thing continue just to call it global. Tested-by: Shaopeng Tan Tested-by: Zeng Heng Reviewed-by: Shaopeng Tan Reviewed-by: Jonathan Cameron Signed-off-by: James Morse Signed-off-by: Ben Horgan --- Changes since rfc v1: Move finding any_mon_comp into monitor boilerplate patch Move mpam_resctrl_get_domain_from_cpu() into monitor boilerplate Remove free running check Trim commit message --- drivers/resctrl/mpam_resctrl.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/drivers/resctrl/mpam_resctrl.c b/drivers/resctrl/mpam_resctrl.c index 226ff6f532fa..f70fa65d39e4 100644 --- a/drivers/resctrl/mpam_resctrl.c +++ b/drivers/resctrl/mpam_resctrl.c @@ -606,6 +606,16 @@ static bool cache_has_usable_csu(struct mpam_class *class) return true; } +static bool class_has_usable_mbwu(struct mpam_class *class) +{ + struct mpam_props *cprops = &class->props; + + if (!mpam_has_feature(mpam_feat_msmon_mbwu, cprops)) + return false; + + return true; +} + /* * Calculate the worst-case percentage change from each implemented step * in the control. @@ -983,6 +993,22 @@ static void mpam_resctrl_pick_counters(void) break; } } + + if (class_has_usable_mbwu(class) && + topology_matches_l3(class) && + traffic_matches_l3(class)) { + pr_debug("class %u has usable MBWU, and matches L3 topology and traffic\n", + class->level); + + /* + * We can't distinguish traffic by destination so + * we don't know if it's staying on the same NUMA + * node. Hence, we can't calculate mbm_local except + * when we only have one L3 and it's equivalent to + * mbm_total and so always use mbm_total. + */ + counter_update_class(QOS_L3_MBM_TOTAL_EVENT_ID, class); + } } } -- 2.43.0