From patchwork Fri Jan 17 15:10:15 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dave Martin X-Patchwork-Id: 13943440 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C80EEC02183 for ; Fri, 17 Jan 2025 15:18:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=/SgKZT/g5qzLU/t2GhOBl1tQoCgwhOkpzHqkvoVCzRg=; b=0nF92WPZTeWQY/uNcpzgddKumQ eSVZFX+8wWmOU56//4KyfiOnecYexz7yuWys+tJPmiTnBf8/p5NfOe3DXCSOBPhGsMfySpROu+eMJ mw0hcmfRn3pspHtvGK0vABVU6T249EKHpuM9CVU0s/uJ816teaHKTA8BX1hQIsEXw/LQkzLx/ukQz GmZadVOP/QkagLYODPZEV0FBYfVnG7HejHZvXpWtJUruMnlusaFoVx8fj2P+M019SkG3d7IZw7a0x Kjz4npkCoVbAkShZzvDMjM4p2qBCjCUTa2AO+k9e2cWWBHP/otu0c7aYCYTD3FlNEkosUB8TNj7NB Ik/Lak3g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tYo7J-00000000aq8-1Xkd; Fri, 17 Jan 2025 15:18:37 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tYnzt-00000000ZFe-1FQG for linux-arm-kernel@lists.infradead.org; Fri, 17 Jan 2025 15:10:58 +0000 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 64E1322C8; Fri, 17 Jan 2025 07:11:25 -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 4662E3F73F; Fri, 17 Jan 2025 07:10:56 -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 05/11] arm_mpam: resctrl: Implement arch hook to set up the default CLOSID Date: Fri, 17 Jan 2025 15:10:15 +0000 Message-Id: <20250117151033.1517882-6-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> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250117_071057_387471_01456501 X-CRM114-Status: GOOD ( 12.22 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Since the allocation of CLOSIDs can now depend on parameters such as resctrl filesystem mount options that are not available at arch driver init time, all MPAM resource allocations need to be reprogrammed when resctrl is mounted. Implement resctrl_arch_init_domains() so that resctrl will now reprogram the default CLOSID's resource allocations at filesystem mount time, in the same way as when creating a new resctrl control group. Signed-off-by: Dave Martin --- drivers/platform/arm64/mpam/mpam_resctrl.c | 15 +++++++++++++-- include/linux/arm_mpam.h | 7 +------ 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/drivers/platform/arm64/mpam/mpam_resctrl.c b/drivers/platform/arm64/mpam/mpam_resctrl.c index 30f2caec11d7..aa8a6c077918 100644 --- a/drivers/platform/arm64/mpam/mpam_resctrl.c +++ b/drivers/platform/arm64/mpam/mpam_resctrl.c @@ -1209,7 +1209,8 @@ int resctrl_arch_update_one(struct rdt_resource *r, struct rdt_ctrl_domain *d, } /* TODO: this is IPI heavy */ -int resctrl_arch_update_domains(struct rdt_resource *r, u32 closid) +static int __resctrl_arch_update_domains(struct rdt_resource *r, u32 closid, + bool force) { int err = 0; enum resctrl_conf_type t; @@ -1222,7 +1223,7 @@ int resctrl_arch_update_domains(struct rdt_resource *r, u32 closid) list_for_each_entry(d, &r->ctrl_domains, hdr.list) { for (t = 0; t < CDP_NUM_TYPES; t++) { cfg = &d->staged_config[t]; - if (!cfg->have_new_ctrl) + if (!force && !cfg->have_new_ctrl) continue; err = resctrl_arch_update_one(r, d, closid, t, @@ -1235,6 +1236,16 @@ int resctrl_arch_update_domains(struct rdt_resource *r, u32 closid) return err; } +int resctrl_arch_update_domains(struct rdt_resource *r, u32 closid) +{ + return __resctrl_arch_update_domains(r, closid, false); +} + +int resctrl_arch_init_domains(struct rdt_resource *r, u32 closid) +{ + return __resctrl_arch_update_domains(r, closid, true); +} + void resctrl_arch_reset_resources(void) { int i, idx; diff --git a/include/linux/arm_mpam.h b/include/linux/arm_mpam.h index dd5f18474846..e6b188ab735b 100644 --- a/include/linux/arm_mpam.h +++ b/include/linux/arm_mpam.h @@ -47,12 +47,7 @@ static inline unsigned int resctrl_arch_round_mon_val(unsigned int val) static inline bool resctrl_arch_default_closid_needs_init(void) { - return false; -} - -static inline int resctrl_arch_init_domains(struct rdt_resource *r, u32 closid) -{ - return 0; + return true; } bool resctrl_arch_alloc_capable(void);