From nobody Mon Apr 6 12:11:31 2026 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id F068A3ED135 for ; Thu, 19 Mar 2026 16:55:56 +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=1773939361; cv=none; b=UofTyVQm/jQ4S8ej4uiUZfGkbtNj6JAlPlx8HafdSTFjgUpYymmfoQJP6nyaUkh8WSG8GGGjx4PH2KJ3/PCP4rOrgQXJscFu6g4TFD79/qGu8vL3GVmWUfgSzefP/RMoAevGSKa9vDQWqEfRn8p2lqv6RqL/AQCvKXWMQasAmsU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773939361; c=relaxed/simple; bh=cQs7Zb17BxXtW7eqrzOrybpoXrCYtCI2RwxODmg7i0Q=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=AKVEMM+Z7GFjB8srOxW/MMaByKrUdoOVu1MXLu7VuX+lzDZjberKgQRwSn4L0HTfyVTQZRephuri+4/kz8RMl4S00b8zSaUtTarAkuGV/GAEcUN+/oNWlB+hv79iIyOdCH+zbyk/faFF44TnNPEEzHLlUUEKI/9RE7E5C+W1vag= 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; 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 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 321561A25; Thu, 19 Mar 2026 09:55:50 -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 391E33F7BD; Thu, 19 Mar 2026 09:55:53 -0700 (PDT) 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, Shaopeng Tan Subject: [RFC PATCH v2 1/5] arm_mpam: resctrl: Pick classes for use as mbm counters Date: Thu, 19 Mar 2026 16:55:36 +0000 Message-ID: <20260319165540.381410-2-ben.horgan@arm.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260319165540.381410-1-ben.horgan@arm.com> References: <20260319165540.381410-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: quoted-printable Content-Type: text/plain; charset="utf-8" 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 a7691c66553a..c17577e52f58 100644 --- a/drivers/resctrl/mpam_resctrl.c +++ b/drivers/resctrl/mpam_resctrl.c @@ -598,6 +598,16 @@ static bool cache_has_usable_csu(struct mpam_class *cl= ass) return true; } =20 +static bool class_has_usable_mbwu(struct mpam_class *class) +{ + struct mpam_props *cprops =3D &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. @@ -981,6 +991,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); + } } } =20 --=20 2.43.0