From nobody Mon Feb 9 08:28:21 2026 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1C88119F135 for ; Fri, 17 Jan 2025 15:11: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=1737126663; cv=none; b=p2usAt1loVt2lXsBDahuHhTXjtKXhsag0Wwa/XRJuErSlBaYDC8uYlZpV3e35WOFvUDNfw5I9x0xiWS2HBgpbs4P13citjp08lXtknF3Rp2zMM/h6ZqnDu+xBt0kXNwMI9/4oFmD118l7A/jStvUre9CamfyiKHJOpGLhGJUVxw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737126663; c=relaxed/simple; bh=ADNjwHuSavesbaCvCaLpv+pwIfwWPJMCgw9Q1kHCVkg=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=EzDHneQZWX6QLybMBfJnqpOoxbDW+G/M3PM/gPscbwplokRaISW4XyatxXvgOraz6kb0AZDTGzNecKdbOKo0fKn48ThIh2CIkMUHc1p6B6ZnFFWEqXxdtnVZCXDj3mdc63tnQnrm9bR1uQCY4RhlKckWCXHS2jImuEq2OGSsZ2U= 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 51DB82247; Fri, 17 Jan 2025 07:11:30 -0800 (PST) Received: from e133380.cambridge.arm.com (e133380.arm.com [10.1.197.43]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 335C03F73F; Fri, 17 Jan 2025 07:11:01 -0800 (PST) From: Dave Martin To: linux-kernel@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org, Zeng Heng , Shaopeng Tan , James Morse Subject: [RFC PATCH v2 10/11] arm_mpam: Skip inapplicable cases when reprogramming a resctrl domain Date: Fri, 17 Jan 2025 15:10:20 +0000 Message-Id: <20250117151033.1517882-11-Dave.Martin@arm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250117151033.1517882-1-Dave.Martin@arm.com> References: <20250117151033.1517882-1-Dave.Martin@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" The implementation of resctrl_arch_update_domains() currently iterates over all types of staged configuration changes passed from resctrl, irrespective of whether a given type (CDP_CODE, CDP_DATA or CDP_NONE) makes sense for the affected MPAM resource. Since resctrl will not stage any updates of inappropriate type for the resource, this is mostly harmless. When doing a forced update as a result of a call via resctrl_arch_init_domains() however, there is a need to update the cpartid (intPARTID) even if no staged configuration changes are supplied. This can result in intPARTID being repeatedly reprogrammed with different values. As well as being inefficient, the final value may not be the correct one. To program just once with the correct intPARTID, only apply the update types that actually make sense for the resource. Signed-off-by: Dave Martin --- drivers/platform/arm64/mpam/mpam_resctrl.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/platform/arm64/mpam/mpam_resctrl.c b/drivers/platform/= arm64/mpam/mpam_resctrl.c index f1d0d9f59771..1f31b1455f66 100644 --- a/drivers/platform/arm64/mpam/mpam_resctrl.c +++ b/drivers/platform/arm64/mpam/mpam_resctrl.c @@ -1263,6 +1263,10 @@ static int __resctrl_arch_update_domains(struct rdt_= resource *r, u32 closid, =20 list_for_each_entry(d, &r->ctrl_domains, hdr.list) { for (t =3D 0; t < CDP_NUM_TYPES; t++) { + if ((t =3D=3D CDP_NONE) !=3D + (!cdp_enabled || mpam_resctrl_hide_cdp(r->rid))) + continue; + cfg =3D &d->staged_config[t]; if (!force && !cfg->have_new_ctrl) continue; --=20 2.34.1