Archive-only list for patches
 help / color / mirror / Atom feed
From: Tony Luck <tony.luck@intel.com>
To: Fenghua Yu <fenghua.yu@intel.com>,
	Reinette Chatre <reinette.chatre@intel.com>,
	Maciej Wieczor-Retman <maciej.wieczor-retman@intel.com>,
	Peter Newman <peternewman@google.com>,
	James Morse <james.morse@arm.com>,
	Babu Moger <babu.moger@amd.com>,
	Drew Fustini <dfustini@baylibre.com>
Cc: x86@kernel.org, linux-kernel@vger.kernel.org,
	patches@lists.linux.dev, Tony Luck <tony.luck@intel.com>
Subject: [PATCH 08/10] x86/resctrl: Mark L3 monitor files with summation flag.
Date: Wed, 27 Mar 2024 13:03:50 -0700	[thread overview]
Message-ID: <20240327200352.236835-9-tony.luck@intel.com> (raw)
In-Reply-To: <20240327200352.236835-1-tony.luck@intel.com>

When Sub-NUMA cluster mode is enabled, the parent monitor
files in the mon_L3_XX directories need to sum all child
siblings from the SUBL3 domains.

Add a flag to the parent files and pass that down to the routines
that will read values from hardware RMID counters.

Signed-off-by: Tony Luck <tony.luck@intel.com>
---
 arch/x86/kernel/cpu/resctrl/internal.h    | 5 ++++-
 arch/x86/kernel/cpu/resctrl/ctrlmondata.c | 1 +
 arch/x86/kernel/cpu/resctrl/rdtgroup.c    | 8 +++++---
 3 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/arch/x86/kernel/cpu/resctrl/internal.h b/arch/x86/kernel/cpu/resctrl/internal.h
index 7f05502454c5..4263fbdf7ee7 100644
--- a/arch/x86/kernel/cpu/resctrl/internal.h
+++ b/arch/x86/kernel/cpu/resctrl/internal.h
@@ -130,6 +130,7 @@ struct mon_evt {
  * @priv:              Used to store monitoring event data in @u
  *                     as kernfs private data
  * @rid:               Resource id associated with the event file
+ * @sumdomains:        Report total of all SNC domains sharing an L3 cache
  * @evtid:             Event id associated with the event file
  * @domid:             The domain to which the event file belongs
  * @u:                 Name of the bit fields struct
@@ -137,7 +138,8 @@ struct mon_evt {
 union mon_data_bits {
 	void *priv;
 	struct {
-		unsigned int rid		: 10;
+		unsigned int rid		: 9;
+		unsigned int sumdomains		: 1;
 		enum resctrl_event_id evtid	: 8;
 		unsigned int domid		: 14;
 	} u;
@@ -149,6 +151,7 @@ struct rmid_read {
 	struct rdt_domain	*d;
 	enum resctrl_event_id	evtid;
 	bool			first;
+	bool			sumdomains;
 	int			err;
 	u64			val;
 	void			*arch_mon_ctx;
diff --git a/arch/x86/kernel/cpu/resctrl/ctrlmondata.c b/arch/x86/kernel/cpu/resctrl/ctrlmondata.c
index 2bf021d42500..fedcf50df6e5 100644
--- a/arch/x86/kernel/cpu/resctrl/ctrlmondata.c
+++ b/arch/x86/kernel/cpu/resctrl/ctrlmondata.c
@@ -574,6 +574,7 @@ int rdtgroup_mondata_show(struct seq_file *m, void *arg)
 	resid = md.u.rid;
 	domid = md.u.domid;
 	evtid = md.u.evtid;
+	rr.sumdomains = md.u.sumdomains;
 
 	r = &rdt_resources_all[resid].r_resctrl;
 	d = rdt_find_domain(r, domid, NULL);
diff --git a/arch/x86/kernel/cpu/resctrl/rdtgroup.c b/arch/x86/kernel/cpu/resctrl/rdtgroup.c
index 399dc3175292..3e7f2e36b71e 100644
--- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c
+++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c
@@ -3059,7 +3059,8 @@ static void rmdir_mondata_subdir_allrdtgrp(struct rdt_resource *r,
 }
 
 static int mon_add_all_files(struct kernfs_node *kn, struct rdt_domain *d,
-			     struct rdt_resource *r, struct rdtgroup *prgrp)
+			     struct rdt_resource *r, struct rdtgroup *prgrp,
+			     bool sumdomains)
 {
 	union mon_data_bits priv;
 	struct mon_evt *mevt;
@@ -3071,6 +3072,7 @@ static int mon_add_all_files(struct kernfs_node *kn, struct rdt_domain *d,
 
 	priv.u.rid = r->rid;
 	priv.u.domid = d->id;
+	priv.u.sumdomains = sumdomains;
 	list_for_each_entry(mevt, &r->evt_list, list) {
 		priv.u.evtid = mevt->evtid;
 		ret = mon_addfile(kn, mevt->name, priv.priv);
@@ -3109,7 +3111,7 @@ static int mkdir_mondata_subdir(struct kernfs_node *parent_kn,
 		ret = rdtgroup_kn_set_ugid(kn);
 		if (ret)
 			goto out_destroy;
-		ret = mon_add_all_files(kn, d, r, prgrp);
+		ret = mon_add_all_files(kn, d, r, prgrp, true);
 		if (ret)
 			goto out_destroy;
 	}
@@ -3124,7 +3126,7 @@ static int mkdir_mondata_subdir(struct kernfs_node *parent_kn,
 	if (ret)
 		goto out_destroy;
 
-	ret = mon_add_all_files(ckn, d, r, prgrp);
+	ret = mon_add_all_files(ckn, d, r, prgrp, false);
 	if (ret)
 		goto out_destroy;
 	kernfs_activate(kn);
-- 
2.44.0


  parent reply	other threads:[~2024-03-27 20:04 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-27 20:03 [PATCH 00/10] Add support for Sub-NUMA cluster (SNC) systems Tony Luck
2024-03-27 20:03 ` [PATCH 01/10] x86/resctrl: Prepare for new domain scope Tony Luck
2024-03-27 20:03 ` [PATCH 02/10] x86/resctrl: Add new rdt_resource for sub-node monitoring Tony Luck
2024-03-27 20:03 ` [PATCH 03/10] x86/resctrl: Add new "enabled" state for monitor resources Tony Luck
2024-03-27 20:03 ` [PATCH 04/10] x86/resctrl: Add pointer to enabled monitor resource Tony Luck
2024-03-27 20:03 ` [PATCH 05/10] x86/resctrl: Add parent/child information to rdt_resource and rdt_domain Tony Luck
2024-03-27 20:03 ` [PATCH 06/10] x86/resctrl: Update mkdir_mondata_subdir() for Sub-NUMA domains Tony Luck
2024-03-27 20:03 ` [PATCH 07/10] x86/resctrl: Update rmdir_mondata_subdir_allrdtgrp() " Tony Luck
2024-03-27 20:03 ` Tony Luck [this message]
2024-03-27 20:03 ` [PATCH 09/10] x86/resctrl: Update __mon_event_count() " Tony Luck
2024-03-27 20:03 ` [PATCH 10/10] x86/resctrl: Determine Sub-NUMA configuration Tony Luck
2024-05-02 17:00 ` [PATCH 00/10] Add support for Sub-NUMA cluster (SNC) systems Reinette Chatre
2024-05-03 15:38   ` Luck, Tony

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=20240327200352.236835-9-tony.luck@intel.com \
    --to=tony.luck@intel.com \
    --cc=babu.moger@amd.com \
    --cc=dfustini@baylibre.com \
    --cc=fenghua.yu@intel.com \
    --cc=james.morse@arm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maciej.wieczor-retman@intel.com \
    --cc=patches@lists.linux.dev \
    --cc=peternewman@google.com \
    --cc=reinette.chatre@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