From: Tony Luck <tony.luck@intel.com>
To: Fenghua Yu <fenghua.yu@intel.com>,
Reinette Chatre <reinette.chatre@intel.com>,
Peter Newman <peternewman@google.com>,
Jonathan Corbet <corbet@lwn.net>,
Shuah Khan <skhan@linuxfoundation.org>,
x86@kernel.org
Cc: Shaopeng Tan <tan.shaopeng@fujitsu.com>,
James Morse <james.morse@arm.com>,
Jamie Iles <quic_jiles@quicinc.com>,
Babu Moger <babu.moger@amd.com>,
Randy Dunlap <rdunlap@infradead.org>,
Drew Fustini <dfustini@baylibre.com>,
linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org,
patches@lists.linux.dev, Tony Luck <tony.luck@intel.com>
Subject: [PATCH v16 9/9] x86/resctrl: Add info files to show mappings from domains to lists of cpus
Date: Tue, 12 Mar 2024 14:42:47 -0700 [thread overview]
Message-ID: <20240312214247.91772-10-tony.luck@intel.com> (raw)
In-Reply-To: <20240312214247.91772-1-tony.luck@intel.com>
Users who want to find out which CPUs are part of which resctrl domain
need to jump through some hoops in /sys to find the lists of CPUs. This
is extra complicated when Sub-NUMA cluster is enabled on a system since
there is no simple indication that this feature is active, or how many
numa nodes are present per L3 cache.
Add files in each resource info directory to provide this information
in each of "list" and "bitmap" form.
E.g.
$ cat /sys/fs/resctrl/info/domain_cpu_list
0: 0-35,72-107
1: 36-71,108-143
$ cat /sys/fs/resctrl/info/domain_cpu_map
0: 0000,00000fff,ffffff00,0000000f,ffffffff
1: ffff,fffff000,000000ff,fffffff0,00000000
Suggested-by: Reinette Chatre <reinette.chatre@intel.com>
Signed-off-by: Tony Luck <tony.luck@intel.com>
---
Documentation/arch/x86/resctrl.rst | 19 +++++++++
arch/x86/kernel/cpu/resctrl/rdtgroup.c | 57 ++++++++++++++++++++++++++
2 files changed, 76 insertions(+)
diff --git a/Documentation/arch/x86/resctrl.rst b/Documentation/arch/x86/resctrl.rst
index 15f1cff6ee76..8c42ad3369fd 100644
--- a/Documentation/arch/x86/resctrl.rst
+++ b/Documentation/arch/x86/resctrl.rst
@@ -261,6 +261,25 @@ with the following files:
bytes) at which a previously used LLC_occupancy
counter can be considered for re-use.
+Subdirectories of all resource types contain these files:
+
+"domain_cpu_list"
+ Provides a list of CPU numbers associated with each
+ domain for this resource.
+ Example::
+
+ # cat /sys/fs/resctrl/info/L3/domain_cpu_list
+ 0: 0-35,72-107
+ 1: 36-71,108-143
+
+"domain_cpu_map"
+ Same as above but the CPUs are listed in bitmap format.
+ Example::
+
+ # cat /sys/fs/resctrl/info/L3/domain_cpu_map
+ 0: 0000,00000fff,ffffff00,0000000f,ffffffff
+ 1: ffff,fffff000,000000ff,fffffff0,00000000
+
Finally, in the top level of the "info" directory there is a file
named "last_cmd_status". This is reset with every "command" issued
via the file system (making new directories or writing to any of the
diff --git a/arch/x86/kernel/cpu/resctrl/rdtgroup.c b/arch/x86/kernel/cpu/resctrl/rdtgroup.c
index 40e6bb8a8fc8..54673def7e9f 100644
--- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c
+++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c
@@ -957,6 +957,20 @@ static int rdt_num_closids_show(struct kernfs_open_file *of,
return 0;
}
+static int rdt_ctrl_cpus_show(struct kernfs_open_file *of,
+ struct seq_file *seq, void *v)
+{
+ struct resctrl_schema *s = of->kn->parent->priv;
+ struct rdt_resource *r = s->res;
+ struct rdt_ctrl_domain *d;
+
+ list_for_each_entry(d, &r->ctrl_domains, hdr.list)
+ seq_printf(seq, is_cpu_list(of) ? "%d: %*pbl\n" : "%d: %*pb\n",
+ d->hdr.id, cpumask_pr_args(&d->hdr.cpu_mask));
+
+ return 0;
+}
+
static int rdt_default_ctrl_show(struct kernfs_open_file *of,
struct seq_file *seq, void *v)
{
@@ -1103,6 +1117,19 @@ static int rdt_num_rmids_show(struct kernfs_open_file *of,
return 0;
}
+static int rdt_mon_cpus_show(struct kernfs_open_file *of,
+ struct seq_file *seq, void *v)
+{
+ struct rdt_resource *r = of->kn->parent->priv;
+ struct rdt_mon_domain *d;
+
+ list_for_each_entry(d, &r->mon_domains, hdr.list)
+ seq_printf(seq, is_cpu_list(of) ? "%d: %*pbl\n" : "%d: %*pb\n",
+ d->hdr.id, cpumask_pr_args(&d->hdr.cpu_mask));
+
+ return 0;
+}
+
static int rdt_mon_features_show(struct kernfs_open_file *of,
struct seq_file *seq, void *v)
{
@@ -1810,6 +1837,21 @@ static struct rftype res_common_files[] = {
.seq_show = rdt_num_closids_show,
.fflags = RFTYPE_CTRL_INFO,
},
+ {
+ .name = "domain_cpu_list",
+ .mode = 0444,
+ .kf_ops = &rdtgroup_kf_single_ops,
+ .seq_show = rdt_ctrl_cpus_show,
+ .flags = RFTYPE_FLAGS_CPUS_LIST,
+ .fflags = RFTYPE_CTRL_INFO,
+ },
+ {
+ .name = "domain_cpu_map",
+ .mode = 0444,
+ .kf_ops = &rdtgroup_kf_single_ops,
+ .seq_show = rdt_ctrl_cpus_show,
+ .fflags = RFTYPE_CTRL_INFO,
+ },
{
.name = "mon_features",
.mode = 0444,
@@ -1824,6 +1866,21 @@ static struct rftype res_common_files[] = {
.seq_show = rdt_num_rmids_show,
.fflags = RFTYPE_MON_INFO,
},
+ {
+ .name = "domain_cpu_list",
+ .mode = 0444,
+ .kf_ops = &rdtgroup_kf_single_ops,
+ .seq_show = rdt_mon_cpus_show,
+ .flags = RFTYPE_FLAGS_CPUS_LIST,
+ .fflags = RFTYPE_MON_INFO,
+ },
+ {
+ .name = "domain_cpu_map",
+ .mode = 0444,
+ .kf_ops = &rdtgroup_kf_single_ops,
+ .seq_show = rdt_mon_cpus_show,
+ .fflags = RFTYPE_MON_INFO,
+ },
{
.name = "cbm_mask",
.mode = 0444,
--
2.44.0
next prev parent reply other threads:[~2024-03-12 21:43 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-12 21:42 [PATCH v16 0/9] Add support for Sub-NUMA cluster (SNC) systems Tony Luck
2024-03-12 21:42 ` [PATCH v16 1/9] x86/resctrl: Prepare for new domain scope Tony Luck
2024-03-19 17:49 ` Reinette Chatre
2024-03-12 21:42 ` [PATCH v16 2/9] x86/resctrl: Prepare to split rdt_domain structure Tony Luck
2024-03-12 21:42 ` [PATCH v16 3/9] x86/resctrl: Prepare for different scope for control/monitor operations Tony Luck
2024-03-19 17:50 ` Reinette Chatre
2024-03-12 21:42 ` [PATCH v16 4/9] x86/resctrl: Split the rdt_domain and rdt_hw_domain structures Tony Luck
2024-03-12 21:42 ` [PATCH v16 5/9] x86/resctrl: Add node-scope to the options for feature scope Tony Luck
2024-03-12 21:42 ` [PATCH v16 6/9] x86/resctrl: Introduce snc_nodes_per_l3_cache Tony Luck
2024-03-12 21:42 ` [PATCH v16 7/9] x86/resctrl: Sub NUMA Cluster detection and enable Tony Luck
2024-03-12 21:42 ` [PATCH v16 8/9] x86/resctrl: Update documentation with Sub-NUMA cluster changes Tony Luck
2024-03-12 21:42 ` Tony Luck [this message]
2024-03-19 17:51 ` [PATCH v16 0/9] Add support for Sub-NUMA cluster (SNC) systems Reinette Chatre
2024-03-19 20:31 ` Luck, Tony
2024-03-19 21:00 ` Reinette Chatre
2024-03-20 15:21 ` Maciej Wieczor-Retman
2024-03-20 15:50 ` Reinette Chatre
2024-03-20 16:27 ` Maciej Wieczor-Retman
2024-03-21 7:51 ` Maciej Wieczor-Retman
2024-03-21 16:51 ` Luck, Tony
2024-03-22 14:57 ` Maciej Wieczor-Retman
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=20240312214247.91772-10-tony.luck@intel.com \
--to=tony.luck@intel.com \
--cc=babu.moger@amd.com \
--cc=corbet@lwn.net \
--cc=dfustini@baylibre.com \
--cc=fenghua.yu@intel.com \
--cc=james.morse@arm.com \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=patches@lists.linux.dev \
--cc=peternewman@google.com \
--cc=quic_jiles@quicinc.com \
--cc=rdunlap@infradead.org \
--cc=reinette.chatre@intel.com \
--cc=skhan@linuxfoundation.org \
--cc=tan.shaopeng@fujitsu.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