mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Dave Martin <Dave.Martin@arm.com>
To: linux-kernel@vger.kernel.org
Cc: linux-arm-kernel@lists.infradead.org,
	Zeng Heng <zengheng4@huawei.com>,
	Shaopeng Tan <tan.shaopeng@fujitsu.com>,
	James Morse <james.morse@arm.com>
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:27 +0000	[thread overview]
Message-ID: <20250117151033.1517882-18-Dave.Martin@arm.com> (raw)
In-Reply-To: <20250117151033.1517882-1-Dave.Martin@arm.com>

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 <Dave.Martin@arm.com>
---
 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


  parent reply	other threads:[~2025-01-17 15:11 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-17 15:10 [RFC PATCH v2 00/11] Introduce PARTID grouping support Dave Martin
2025-01-17 15:10 ` [RFC PATCH v2 01/11] arm_mpam: Fix read-back of cloned resource controls under CDP emulation Dave Martin
2025-01-17 15:10 ` [RFC PATCH v2 02/11] arm_mpam: Delete unused function resctrl_arch_set_rmid() Dave Martin
2025-01-17 15:10 ` [RFC PATCH v2 03/11] arm_mpam: Set INTERNAL as needed when setting MSC controls Dave Martin
2025-01-17 15:10 ` [RFC PATCH v2 04/11] fs/resctrl: Add arch hook to set up the default CLOSID Dave Martin
2025-01-17 15:10 ` [RFC PATCH v2 05/11] arm_mpam: resctrl: Implement " Dave Martin
2025-01-17 15:10 ` [RFC PATCH v2 06/11] arm_mpam: Introduce flexible CLOSID/RMID translation Dave Martin
2025-01-29 10:40   ` Shaopeng Tan (Fujitsu)
2025-01-17 15:10 ` [RFC PATCH v2 07/11] arm_mpam: [NFU] Rework ID remapping to use a kernel command-line argument Dave Martin
2025-01-17 15:10 ` [RFC PATCH v2 08/11] arm_mpam: [NFU] Development diagnostics for MPAM ID assignments Dave Martin
2025-01-17 15:10 ` [RFC PATCH v2 09/11] arm_mpam: Add control partition identifier to mpam_config Dave Martin
2025-01-17 15:10 ` [RFC PATCH v2 10/11] arm_mpam: Skip inapplicable cases when reprogramming a resctrl domain Dave Martin
2025-01-17 15:10 ` [RFC PATCH v2 11/11] arm_mpam: Detect whether the system can alias PARTIDs Dave Martin
2025-01-17 15:10 ` [RFC PATCH v2 00/11] Introduce PARTID grouping support Dave Martin
2025-01-17 15:10 ` [RFC PATCH v2 01/11] arm_mpam: Fix read-back of cloned resource controls under CDP emulation Dave Martin
2025-01-17 15:10 ` [RFC PATCH v2 02/11] arm_mpam: Delete unused function resctrl_arch_set_rmid() Dave Martin
2025-01-17 15:10 ` [RFC PATCH v2 03/11] arm_mpam: Set INTERNAL as needed when setting MSC controls Dave Martin
2025-01-17 15:10 ` [RFC PATCH v2 04/11] fs/resctrl: Add arch hook to set up the default CLOSID Dave Martin
2025-01-17 15:10 ` Dave Martin [this message]
2025-01-17 15:10 ` [RFC PATCH v2 06/11] arm_mpam: Introduce flexible CLOSID/RMID translation Dave Martin
2025-01-17 15:10 ` [RFC PATCH v2 07/11] arm_mpam: [NFU] Rework ID remapping to use a kernel command-line argument Dave Martin
2025-01-29 10:57   ` Shaopeng Tan (Fujitsu)
2025-01-17 15:10 ` [RFC PATCH v2 08/11] arm_mpam: [NFU] Development diagnostics for MPAM ID assignments Dave Martin
2025-01-17 15:10 ` [RFC PATCH v2 09/11] arm_mpam: Add control partition identifier to mpam_config Dave Martin
2025-01-17 15:10 ` [RFC PATCH v2 10/11] arm_mpam: Skip inapplicable cases when reprogramming a resctrl domain Dave Martin
2025-01-17 15:10 ` [RFC PATCH v2 11/11] arm_mpam: Detect whether the system can alias PARTIDs Dave Martin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250117151033.1517882-18-Dave.Martin@arm.com \
    --to=dave.martin@arm.com \
    --cc=james.morse@arm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tan.shaopeng@fujitsu.com \
    --cc=zengheng4@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®