From nobody Tue Apr 7 00:46:15 2026 Received: from canpmsgout05.his.huawei.com (canpmsgout05.his.huawei.com [113.46.200.220]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A64293CCA0E for ; Tue, 17 Mar 2026 13:22:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=113.46.200.220 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773753724; cv=none; b=NMVCWZvPF1apAlf2F5Lpu4a/5T6+hrxk0y1S7RCECKkQX+gL6wCMEbXf2i0STHt0JvUAFODMEe2hQ+6ArpFgIWZEbSsuZYz2terCX649BqL6BSWFjB7K2MV7Au92vl9UQyoY+pHvOMR7z0kNlEWkj/AbvuCEK+mMR+dh0sKEnDg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773753724; c=relaxed/simple; bh=VzUNjun2mGsk+mWNnnnzu2CwP9q6z+q/FLkq831gXT4=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=LK/iFNAmHS61f7q7gyxFPlBirvdK4QINXcso4XAt/9jD4Fbn7deW6M8TOTUULEN/26ZGrogluuadDeekQynGH2pw8dmyQM7mgXpTEFBPM8NNguL2Cjbn3hzeaKwR8lSZs7pceEQYpYE/Tyn5Jrf149c2OFgMAt+n5LvuiwFlKeg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=h-partners.com; dkim=pass (1024-bit key) header.d=h-partners.com header.i=@h-partners.com header.b=c98MqViX; arc=none smtp.client-ip=113.46.200.220 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=h-partners.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=h-partners.com header.i=@h-partners.com header.b="c98MqViX" dkim-signature: v=1; a=rsa-sha256; d=h-partners.com; s=dkim; c=relaxed/relaxed; q=dns/txt; h=From; bh=OTG6reFSOo8g9T3aBO/Up0qn8cWllWtbqfq9bTXfeAg=; b=c98MqViXz/3wh52VuIwEmtJ6A4eizPSTyHIA8DCWk8Bgb/8R7eT9AWVJUWK/O19+L1iFCZ55N +lLvJB+QuHVKXmg4oMN28oRK8lMeI3tUKuZ0qbhwC+u3ufuK0+CQTmbSkt77BfngsIjwS9w39wR fvis+iT4Tr9ywrQMkr9hL5Y= Received: from mail.maildlp.com (unknown [172.19.162.144]) by canpmsgout05.his.huawei.com (SkyGuard) with ESMTPS id 4fZssy2w04z12LD2; Tue, 17 Mar 2026 21:16:22 +0800 (CST) Received: from kwepemf100008.china.huawei.com (unknown [7.202.181.222]) by mail.maildlp.com (Postfix) with ESMTPS id 45AF340567; Tue, 17 Mar 2026 21:21:54 +0800 (CST) Received: from huawei.com (10.50.87.109) by kwepemf100008.china.huawei.com (7.202.181.222) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.36; Tue, 17 Mar 2026 21:21:53 +0800 From: Zeng Heng To: , , , , CC: , , , , , , , , , Subject: [PATCH v3 3/9] arm_mpam: Disable Narrow-PARTID when MBA lacks support Date: Tue, 17 Mar 2026 21:21:35 +0800 Message-ID: <20260317132141.1272506-4-zengheng4@huawei.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20260317132141.1272506-1-zengheng4@huawei.com> References: <20260317132141.1272506-1-zengheng4@huawei.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 X-ClientProxiedBy: kwepems500002.china.huawei.com (7.221.188.17) To kwepemf100008.china.huawei.com (7.202.181.222) Content-Type: text/plain; charset="utf-8" MPAM supports mixed systems with MSCs that may or may not implement Narrow-PARTID. However, when the MBA MSC uses percentage-based throttling (non-bitmap partition control) and lacks Narrow-PARTID support, resctrl cannot correctly apply control group configurations across multiple PARTIDs. Since there is no straightforward way to program compatible control values in this scenario, disable Narrow-PARTID system-wide when detected. The detection occurs at initialization time on the first call to get_num_reqpartid() from mpam_resctrl_pick_counters(), which is guaranteed to occur after mpam_resctrl_pick_mba() has set up the MBA resource class. If MBA MSCs lack Narrow-PARTID support, get_num_reqpartid() falls back to returning the number of internal PARTIDs (mpam_intpartid_max). Signed-off-by: Zeng Heng --- drivers/resctrl/mpam_resctrl.c | 38 +++++++++++++++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/drivers/resctrl/mpam_resctrl.c b/drivers/resctrl/mpam_resctrl.c index 222ea1d199e1..1b18c095cfce 100644 --- a/drivers/resctrl/mpam_resctrl.c +++ b/drivers/resctrl/mpam_resctrl.c @@ -240,9 +240,45 @@ u32 resctrl_arch_get_num_closid(struct rdt_resource *i= gnored) return mpam_intpartid_max + 1; } =20 +/* + * Determine the effective number of PARTIDs available for resctrl. + * + * This function performs a one-time check to determine if Narrow-PARTID + * can be used. It must be called after mpam_resctrl_pick_mba() has + * initialized the MBA resource, as the MBA class properties are used + * to detect Narrow-PARTID support. + * + * The first call occurs in mpam_resctrl_pick_counters(), ensuring the + * prerequisite initialization is complete. + */ +static u32 get_num_reqpartid(void) +{ + struct mpam_resctrl_res *res; + struct rdt_resource *r_mba; + struct mpam_props *cprops; + static bool first =3D true; + + if (first) { + r_mba =3D resctrl_arch_get_resource(RDT_RESOURCE_MBA); + res =3D container_of(r_mba, struct mpam_resctrl_res, resctrl_res); + if (!res->class) + goto out; + + /* If MBA MSCs lack Narrow-PARTID support, roll back. */ + cprops =3D &res->class->props; + if (!mpam_has_feature(mpam_feat_partid_nrw, cprops)) + mpam_partid_max =3D mpam_intpartid_max; + + } + +out: + first =3D false; + return mpam_partid_max + 1; +} + u32 resctrl_arch_system_num_rmid_idx(void) { - return (mpam_pmg_max + 1) * (mpam_partid_max + 1); + return (mpam_pmg_max + 1) * get_num_reqpartid(); } =20 u32 resctrl_arch_rmid_idx_encode(u32 closid, u32 rmid) --=20 2.25.1