mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Yunhui Cui <cuiyunhui@bytedance.com>
To: tony.luck@intel.com, reinette.chatre@intel.com,
	ben.horgan@arm.com, Dave.Martin@arm.com, james.morse@arm.com,
	babu.moger@amd.com, fustini@kernel.org, tglx@kernel.org,
	mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com,
	hpa@zytor.com, fenghuay@nvidia.com, shuah@kernel.org,
	corbet@lwn.net, skhan@linuxfoundation.org, rdunlap@infradead.org,
	x86@kernel.org, linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-riscv@lists.infradead.org, linux-kselftest@vger.kernel.org,
	kunit-dev@googlegroups.com, linux-doc@vger.kernel.org
Cc: Yunhui Cui <cuiyunhui@bytedance.com>
Subject: [RFC PATCH 01/13] resctrl: Introduce interfaces for logical control IDs
Date: Mon, 30 Nov 2026 10:29:17 +0800	[thread overview]
Message-ID: <20261130022929.71748-2-cuiyunhui@bytedance.com> (raw)
In-Reply-To: <20261130022929.71748-1-cuiyunhui@bytedance.com>

resctrl currently uses a control group ID both to identify the group and
to select a hardware entry. Request-ID mapping allows these IDs to
differ, while I/O allocation continues to identify a physical entry.
Introduce separate architecture interfaces for control-group
initialization, policy updates and I/O allocation. The x86 and MPAM
backends retain their existing identity behavior.

Signed-off-by: Yunhui Cui <cuiyunhui@bytedance.com>
---
 arch/x86/kernel/cpu/resctrl/ctrlmondata.c | 19 +++++++++++++++++--
 drivers/resctrl/mpam_resctrl.c            | 19 +++++++++++++++++--
 fs/resctrl/ctrlmondata.c                  |  4 ++--
 fs/resctrl/rdtgroup.c                     |  2 +-
 include/linux/resctrl.h                   |  7 ++++++-
 5 files changed, 43 insertions(+), 8 deletions(-)

diff --git a/arch/x86/kernel/cpu/resctrl/ctrlmondata.c b/arch/x86/kernel/cpu/resctrl/ctrlmondata.c
index 46ec3fa368ebf..1c2b20f623a37 100644
--- a/arch/x86/kernel/cpu/resctrl/ctrlmondata.c
+++ b/arch/x86/kernel/cpu/resctrl/ctrlmondata.c
@@ -47,7 +47,7 @@ int resctrl_arch_update_one(struct rdt_resource *r, struct rdt_ctrl_domain *d,
 	return 0;
 }
 
-int resctrl_arch_update_domains(struct rdt_resource *r, u32 closid)
+static int resctrl_arch_update_domains_id(struct rdt_resource *r, u32 id)
 {
 	struct resctrl_staged_config *cfg;
 	struct rdt_hw_ctrl_domain *hw_dom;
@@ -67,7 +67,7 @@ int resctrl_arch_update_domains(struct rdt_resource *r, u32 closid)
 			if (!cfg->have_new_ctrl)
 				continue;
 
-			idx = resctrl_get_config_index(closid, t);
+			idx = resctrl_get_config_index(id, t);
 			if (cfg->new_ctrl == hw_dom->ctrl_val[idx])
 				continue;
 			hw_dom->ctrl_val[idx] = cfg->new_ctrl;
@@ -89,6 +89,21 @@ int resctrl_arch_update_domains(struct rdt_resource *r, u32 closid)
 	return 0;
 }
 
+int resctrl_arch_init_ctrl_domains(struct rdt_resource *r, u32 logical_ctrl_id)
+{
+	return resctrl_arch_update_domains_id(r, logical_ctrl_id);
+}
+
+int resctrl_arch_update_domains(struct rdt_resource *r, u32 logical_ctrl_id)
+{
+	return resctrl_arch_update_domains_id(r, logical_ctrl_id);
+}
+
+int resctrl_arch_update_io_alloc(struct rdt_resource *r, u32 physical_ctrl_id)
+{
+	return resctrl_arch_update_domains_id(r, physical_ctrl_id);
+}
+
 u32 resctrl_arch_get_config(struct rdt_resource *r, struct rdt_ctrl_domain *d,
 			    u32 closid, enum resctrl_conf_type type)
 {
diff --git a/drivers/resctrl/mpam_resctrl.c b/drivers/resctrl/mpam_resctrl.c
index 5468367776e26..2cb098eaf22a1 100644
--- a/drivers/resctrl/mpam_resctrl.c
+++ b/drivers/resctrl/mpam_resctrl.c
@@ -1505,7 +1505,7 @@ int resctrl_arch_update_one(struct rdt_resource *r, struct rdt_ctrl_domain *d,
 	return mpam_apply_config(dom->ctrl_comp, partid, &cfg);
 }
 
-int resctrl_arch_update_domains(struct rdt_resource *r, u32 closid)
+static int resctrl_arch_update_domains_id(struct rdt_resource *r, u32 id)
 {
 	int err;
 	struct rdt_ctrl_domain *d;
@@ -1523,7 +1523,7 @@ int resctrl_arch_update_domains(struct rdt_resource *r, u32 closid)
 			if (!cfg->have_new_ctrl)
 				continue;
 
-			err = resctrl_arch_update_one(r, d, closid, t,
+			err = resctrl_arch_update_one(r, d, id, t,
 						      cfg->new_ctrl);
 			if (err)
 				return err;
@@ -1533,6 +1533,21 @@ int resctrl_arch_update_domains(struct rdt_resource *r, u32 closid)
 	return 0;
 }
 
+int resctrl_arch_init_ctrl_domains(struct rdt_resource *r, u32 logical_ctrl_id)
+{
+	return resctrl_arch_update_domains_id(r, logical_ctrl_id);
+}
+
+int resctrl_arch_update_domains(struct rdt_resource *r, u32 logical_ctrl_id)
+{
+	return resctrl_arch_update_domains_id(r, logical_ctrl_id);
+}
+
+int resctrl_arch_update_io_alloc(struct rdt_resource *r, u32 physical_ctrl_id)
+{
+	return resctrl_arch_update_domains_id(r, physical_ctrl_id);
+}
+
 void resctrl_arch_reset_all_ctrls(struct rdt_resource *r)
 {
 	struct mpam_resctrl_res *res;
diff --git a/fs/resctrl/ctrlmondata.c b/fs/resctrl/ctrlmondata.c
index a37b245fd02a0..eb3248350254b 100644
--- a/fs/resctrl/ctrlmondata.c
+++ b/fs/resctrl/ctrlmondata.c
@@ -827,7 +827,7 @@ static int resctrl_io_alloc_init_cbm(struct resctrl_schema *s, u32 closid)
 			       sizeof(d->staged_config[0]));
 	}
 
-	ret = resctrl_arch_update_domains(r, closid);
+	ret = resctrl_arch_update_io_alloc(r, closid);
 out:
 	rdt_staged_configs_clear();
 	return ret;
@@ -1058,7 +1058,7 @@ ssize_t resctrl_io_alloc_cbm_write(struct kernfs_open_file *of, char *buf,
 	if (ret)
 		goto out_clear_configs;
 
-	ret = resctrl_arch_update_domains(r, io_alloc_closid);
+	ret = resctrl_arch_update_io_alloc(r, io_alloc_closid);
 
 out_clear_configs:
 	rdt_staged_configs_clear();
diff --git a/fs/resctrl/rdtgroup.c b/fs/resctrl/rdtgroup.c
index c56cc1507c917..caa9fe68308e5 100644
--- a/fs/resctrl/rdtgroup.c
+++ b/fs/resctrl/rdtgroup.c
@@ -3861,7 +3861,7 @@ static int rdtgroup_init_alloc(struct rdtgroup *rdtgrp)
 				goto out;
 		}
 
-		ret = resctrl_arch_update_domains(r, rdtgrp->closid);
+		ret = resctrl_arch_init_ctrl_domains(r, rdtgrp->closid);
 		if (ret < 0) {
 			rdt_last_cmd_puts("Failed to initialize allocations\n");
 			goto out;
diff --git a/include/linux/resctrl.h b/include/linux/resctrl.h
index b6b4519a51908..a5e3e4b3fd836 100644
--- a/include/linux/resctrl.h
+++ b/include/linux/resctrl.h
@@ -410,7 +410,12 @@ static inline u32 resctrl_get_default_ctrl(struct rdt_resource *r)
 /* The number of closid supported by this resource regardless of CDP */
 u32 resctrl_arch_get_num_closid(struct rdt_resource *r);
 u32 resctrl_arch_system_num_rmid_idx(void);
-int resctrl_arch_update_domains(struct rdt_resource *r, u32 closid);
+
+int resctrl_arch_init_ctrl_domains(struct rdt_resource *r, u32 logical_ctrl_id);
+
+int resctrl_arch_update_domains(struct rdt_resource *r, u32 logical_ctrl_id);
+
+int resctrl_arch_update_io_alloc(struct rdt_resource *r, u32 physical_ctrl_id);
 
 bool resctrl_enable_mon_event(enum resctrl_event_id eventid, bool any_cpu,
 			      unsigned int binary_bits, void *arch_priv);
-- 
2.39.2 (Apple Git-143)


  reply	other threads:[~2026-11-30  2:30 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-30  2:29 [RFC PATCH 00/13] resctrl: Introduce a framework " Yunhui Cui
2026-11-30  2:29 ` Yunhui Cui [this message]
2026-11-30  2:29 ` [RFC PATCH 02/13] resctrl: Add prepare, commit and abort hooks for control updates Yunhui Cui
2026-11-30  2:29 ` [RFC PATCH 03/13] resctrl: Add a release hook before logical control ID reuse Yunhui Cui
2026-11-30  2:29 ` [RFC PATCH 04/13] arm_mpam: Record PARTID narrowing capacity per MSC Yunhui Cui
2026-11-30  2:29 ` [RFC PATCH 05/13] arm_mpam: Select PARTID narrowing per component Yunhui Cui
2026-11-30  2:29 ` [RFC PATCH 06/13] arm_mpam: Add an internal PARTID allocator Yunhui Cui
2026-11-30  2:29 ` [RFC PATCH 07/13] arm_mpam: Add request-to-internal PARTID mapping Yunhui Cui
2026-11-30  2:29 ` [RFC PATCH 08/13] arm_mpam: Apply PARTID narrowing to resctrl control groups Yunhui Cui
2026-11-30  2:29 ` [RFC PATCH 09/13] arm_mpam: Separate request and internal PARTID limits Yunhui Cui
2026-11-30  2:29 ` [RFC PATCH 10/13] arm_mpam: Map CDP data and code defaults separately Yunhui Cui
2026-11-30  2:29 ` [RFC PATCH 11/13] arm_mpam: Add kunit tests for PARTID narrowing Yunhui Cui
2026-11-30  2:29 ` [RFC PATCH 12/13] selftests/resctrl: Add a test for control ID allocation and reuse Yunhui Cui
2026-11-30  2:29 ` [RFC PATCH 13/13] docs/resctrl: Document logical control IDs and hardware entries Yunhui Cui
2026-11-30  6:15 ` [RFC PATCH 00/13] resctrl: Introduce a framework for logical control IDs Jinjie Ruan
2026-11-30  6:56   ` [External] " yunhui cui
2026-11-30  7:29     ` Jinjie Ruan
2026-11-30 11:22   ` Ben Horgan
2026-11-30 12:09     ` Jinjie Ruan

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=20261130022929.71748-2-cuiyunhui@bytedance.com \
    --to=cuiyunhui@bytedance.com \
    --cc=Dave.Martin@arm.com \
    --cc=babu.moger@amd.com \
    --cc=ben.horgan@arm.com \
    --cc=bp@alien8.de \
    --cc=corbet@lwn.net \
    --cc=dave.hansen@linux.intel.com \
    --cc=fenghuay@nvidia.com \
    --cc=fustini@kernel.org \
    --cc=hpa@zytor.com \
    --cc=james.morse@arm.com \
    --cc=kunit-dev@googlegroups.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=mingo@redhat.com \
    --cc=rdunlap@infradead.org \
    --cc=reinette.chatre@intel.com \
    --cc=shuah@kernel.org \
    --cc=skhan@linuxfoundation.org \
    --cc=tglx@kernel.org \
    --cc=tony.luck@intel.com \
    --cc=x86@kernel.org \
    /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®