From nobody Thu Apr 2 13:15:14 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 43474C04A95 for ; Fri, 23 Sep 2022 18:03:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232754AbiIWSDW (ORCPT ); Fri, 23 Sep 2022 14:03:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36622 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232752AbiIWSCh (ORCPT ); Fri, 23 Sep 2022 14:02:37 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9185513E7E1; Fri, 23 Sep 2022 11:01:58 -0700 (PDT) Date: Fri, 23 Sep 2022 18:01:55 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1663956117; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=fsAIyuj4x0iEQg9cqv5G9BqMj5jKXDRAGq1wmpP6RCM=; b=KfMpyNoyBP/Eq2IcUPPxbiqfzamWtBMQzsYgFBZi2lqliOlSHXHAYKFuAOr4TSGJMyesfH rfgif7rfc7VFet8pY06dT4nUL6qhjfViPX6cDpnU5JUSMNNQcL/JwupN26ellSiSgHX+Sy O8ZsFOSg6vJBdIdRpP0ZredNGorrbzBh/Av8i4JEGjxMps88HgFY68+CQi3g+qIjkWyIKa xG6W1d2imYY2lNpgy6NXAf7k9Pba8M1ub08ziMu01JwY1R3zkMDo/bD0z6kWtjs4gNx4Wz Zf2wd7X7I6JjOkkrMJrFK2A5xJy6XcMV33d7gz+WHoiBFmfASrBOrGfoYqqV2A== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1663956117; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=fsAIyuj4x0iEQg9cqv5G9BqMj5jKXDRAGq1wmpP6RCM=; b=lmrKcNPW3vmwjQbsNxCOvnVuLCII87nnZpPrUNVGhtkEqWIK7Uug9lVFOd770jOs97qqhF QBHCt1EyFy6CajAg== From: "tip-bot2 for James Morse" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: x86/cache] x86/resctrl: Remove set_mba_sc()s control array re-initialisation Cc: James Morse , Borislav Petkov , Jamie Iles , Shaopeng Tan , Reinette Chatre , Xin Hao , Cristian Marussi , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20220902154829.30399-7-james.morse@arm.com> References: <20220902154829.30399-7-james.morse@arm.com> MIME-Version: 1.0 Message-ID: <166395611583.401.8392213412380309845.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The following commit has been merged into the x86/cache branch of tip: Commit-ID: 1644dfe727cb042ef7f2e773015747954fd0e746 Gitweb: https://git.kernel.org/tip/1644dfe727cb042ef7f2e773015747954= fd0e746 Author: James Morse AuthorDate: Fri, 02 Sep 2022 15:48:14=20 Committer: Borislav Petkov CommitterDate: Thu, 22 Sep 2022 16:08:20 +02:00 x86/resctrl: Remove set_mba_sc()s control array re-initialisation set_mba_sc() enables the 'software controller' to regulate the bandwidth based on the byte counters. This can be managed entirely in the parts of resctrl that move to /fs/, without any extra support from the architecture specific code. set_mba_sc() is called by rdt_enable_ctx() during mount and unmount. It currently resets the arch code's ctrl_val[] and mbps_val[] arrays. The ctrl_val[] was already reset when the domain was created, and by reset_all_ctrls() when the filesystem was last unmounted. Doing the work in set_mba_sc() is not necessary as the values are already at their defaults due to the creation of the domain, or were previously reset during umount(), or are about to reset during umount(). Add a reset of the mbps_val[] in reset_all_ctrls(), allowing the code in set_mba_sc() that reaches in to the architecture specific structures to be removed. Signed-off-by: James Morse Signed-off-by: Borislav Petkov Reviewed-by: Jamie Iles Reviewed-by: Shaopeng Tan Reviewed-by: Reinette Chatre Tested-by: Xin Hao Tested-by: Shaopeng Tan Tested-by: Cristian Marussi Link: https://lore.kernel.org/r/20220902154829.30399-7-james.morse@arm.com --- arch/x86/kernel/cpu/resctrl/rdtgroup.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/arch/x86/kernel/cpu/resctrl/rdtgroup.c b/arch/x86/kernel/cpu/r= esctrl/rdtgroup.c index 5830905..b32ceff 100644 --- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c +++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c @@ -1898,18 +1898,12 @@ void rdt_domain_reconfigure_cdp(struct rdt_resource= *r) static int set_mba_sc(bool mba_sc) { struct rdt_resource *r =3D &rdt_resources_all[RDT_RESOURCE_MBA].r_resctrl; - struct rdt_hw_domain *hw_dom; - struct rdt_domain *d; =20 if (!is_mbm_enabled() || !is_mba_linear() || mba_sc =3D=3D is_mba_sc(r)) return -EINVAL; =20 r->membw.mba_sc =3D mba_sc; - list_for_each_entry(d, &r->domains, list) { - hw_dom =3D resctrl_to_arch_dom(d); - setup_default_ctrlval(r, hw_dom->ctrl_val, hw_dom->mbps_val); - } =20 return 0; } @@ -2327,8 +2321,10 @@ static int reset_all_ctrls(struct rdt_resource *r) hw_dom =3D resctrl_to_arch_dom(d); cpumask_set_cpu(cpumask_any(&d->cpu_mask), cpu_mask); =20 - for (i =3D 0; i < hw_res->num_closid; i++) + for (i =3D 0; i < hw_res->num_closid; i++) { hw_dom->ctrl_val[i] =3D r->default_ctrl; + hw_dom->mbps_val[i] =3D MBA_MAX_MBPS; + } } cpu =3D get_cpu(); /* Update CBM on this cpu if it's in cpu_mask. */