From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 845E019994F for ; Fri, 17 Jan 2025 15:10:57 +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=1737126659; cv=none; b=ScxNarZNnWOK6Jo8p0lnf8KfUT/qlWsSmCZPyKvoLt7XEVoGHVZiwD19E83fWR2pvIUZkXVLVZpoD4JprigR2o5OjFTNC/dFEXXnv4yP1UyfndU+VQFs+c6Z42HHK0VgmpDqF0OYsbJPECaXXCTNSqc8Eyx5OqpMWFvlVcSk5WQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737126659; c=relaxed/simple; bh=0m8BnBfFHglIIJrQhP1M1s20SprA+ngr19EZ58cKUmE=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=uJvI2EQmWP0+ADLY2E8Kj6JiQpr1QCoincS0C41cXK4a6J+HCNpvMDSHMgYCZVyaMkRZTejw25tdPWazePYIIzbMSFYz9rqhJ6NPm3FV0x3/iCRR6A5OgsYOJJLdLYSz06t2FiEW6AAvciSr/l7bSzhK7oXm/XkvE0fEe5TNcA4= 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 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> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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); -- 2.34.1