From: "tip-bot2 for Tony Luck" <tip-bot2@linutronix.de>
To: linux-tip-commits@vger.kernel.org
Cc: Tony Luck <tony.luck@intel.com>,
"Borislav Petkov (AMD)" <bp@alien8.de>,
Reinette Chatre <reinette.chatre@intel.com>,
Babu Moger <babu.moger@amd.com>,
x86@kernel.org, linux-kernel@vger.kernel.org
Subject: [tip: x86/cache] x86/resctrl: Refactor mkdir_mondata_subdir() with a helper function
Date: Tue, 02 Jul 2024 19:24:13 -0000 [thread overview]
Message-ID: <171994825382.2215.16970529684204186008.tip-bot2@tip-bot2> (raw)
In-Reply-To: <20240628215619.76401-12-tony.luck@intel.com>
The following commit has been merged into the x86/cache branch of tip:
Commit-ID: 603cf1e28838a01e4f140c3054ce147f8b087d08
Gitweb: https://git.kernel.org/tip/603cf1e28838a01e4f140c3054ce147f8b087d08
Author: Tony Luck <tony.luck@intel.com>
AuthorDate: Fri, 28 Jun 2024 14:56:11 -07:00
Committer: Borislav Petkov (AMD) <bp@alien8.de>
CommitterDate: Tue, 02 Jul 2024 19:49:54 +02:00
x86/resctrl: Refactor mkdir_mondata_subdir() with a helper function
In Sub-NUMA Cluster (SNC) mode Linux must create the monitor
files in the original "mon_L3_XX" directories and also in each
of the "mon_sub_L3_YY" directories.
Refactor mkdir_mondata_subdir() to move the creation of monitoring files
into a helper function to avoid the need to duplicate code later.
No functional change.
Signed-off-by: Tony Luck <tony.luck@intel.com>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Reviewed-by: Reinette Chatre <reinette.chatre@intel.com>
Tested-by: Babu Moger <babu.moger@amd.com>
Link: https://lore.kernel.org/r/20240628215619.76401-12-tony.luck@intel.com
---
arch/x86/kernel/cpu/resctrl/rdtgroup.c | 45 +++++++++++++++----------
1 file changed, 28 insertions(+), 17 deletions(-)
diff --git a/arch/x86/kernel/cpu/resctrl/rdtgroup.c b/arch/x86/kernel/cpu/resctrl/rdtgroup.c
index d044358..9c38ddc 100644
--- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c
+++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c
@@ -3025,14 +3025,37 @@ static void rmdir_mondata_subdir_allrdtgrp(struct rdt_resource *r,
}
}
+static int mon_add_all_files(struct kernfs_node *kn, struct rdt_mon_domain *d,
+ struct rdt_resource *r, struct rdtgroup *prgrp)
+{
+ struct rmid_read rr = {0};
+ union mon_data_bits priv;
+ struct mon_evt *mevt;
+ int ret;
+
+ if (WARN_ON(list_empty(&r->evt_list)))
+ return -EPERM;
+
+ priv.u.rid = r->rid;
+ priv.u.domid = d->hdr.id;
+ list_for_each_entry(mevt, &r->evt_list, list) {
+ priv.u.evtid = mevt->evtid;
+ ret = mon_addfile(kn, mevt->name, priv.priv);
+ if (ret)
+ return ret;
+
+ if (is_mbm_event(mevt->evtid))
+ mon_event_read(&rr, r, d, prgrp, mevt->evtid, true);
+ }
+
+ return 0;
+}
+
static int mkdir_mondata_subdir(struct kernfs_node *parent_kn,
struct rdt_mon_domain *d,
struct rdt_resource *r, struct rdtgroup *prgrp)
{
- struct rmid_read rr = {0};
- union mon_data_bits priv;
struct kernfs_node *kn;
- struct mon_evt *mevt;
char name[32];
int ret;
@@ -3046,22 +3069,10 @@ static int mkdir_mondata_subdir(struct kernfs_node *parent_kn,
if (ret)
goto out_destroy;
- if (WARN_ON(list_empty(&r->evt_list))) {
- ret = -EPERM;
+ ret = mon_add_all_files(kn, d, r, prgrp);
+ if (ret)
goto out_destroy;
- }
- priv.u.rid = r->rid;
- priv.u.domid = d->hdr.id;
- list_for_each_entry(mevt, &r->evt_list, list) {
- priv.u.evtid = mevt->evtid;
- ret = mon_addfile(kn, mevt->name, priv.priv);
- if (ret)
- goto out_destroy;
-
- if (is_mbm_event(mevt->evtid))
- mon_event_read(&rr, r, d, prgrp, mevt->evtid, true);
- }
kernfs_activate(kn);
return 0;
next prev parent reply other threads:[~2024-07-02 19:24 UTC|newest]
Thread overview: 44+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-28 21:56 [PATCH v23 00/19] Add support for Sub-NUMA cluster (SNC) systems Tony Luck
2024-06-28 21:56 ` [PATCH v23 01/19] x86/resctrl: Prepare for new domain scope Tony Luck
2024-07-02 19:24 ` [tip: x86/cache] " tip-bot2 for Tony Luck
2024-06-28 21:56 ` [PATCH v23 02/19] x86/resctrl: Prepare to split rdt_domain structure Tony Luck
2024-07-02 19:24 ` [tip: x86/cache] " tip-bot2 for Tony Luck
2024-06-28 21:56 ` [PATCH v23 03/19] x86/resctrl: Prepare for different scope for control/monitor operations Tony Luck
2024-07-02 19:24 ` [tip: x86/cache] " tip-bot2 for Tony Luck
2024-06-28 21:56 ` [PATCH v23 04/19] x86/resctrl: Split the rdt_domain and rdt_hw_domain structures Tony Luck
2024-07-02 19:24 ` [tip: x86/cache] " tip-bot2 for Tony Luck
2024-06-28 21:56 ` [PATCH v23 05/19] x86/resctrl: Add node-scope to the options for feature scope Tony Luck
2024-07-02 19:24 ` [tip: x86/cache] " tip-bot2 for Tony Luck
2024-06-28 21:56 ` [PATCH v23 06/19] x86/resctrl: Introduce snc_nodes_per_l3_cache Tony Luck
2024-07-02 19:24 ` [tip: x86/cache] " tip-bot2 for Tony Luck
2024-07-26 19:13 ` [PATCH v23 06/19] " Peter Newman
2024-06-28 21:56 ` [PATCH v23 07/19] x86/resctrl: Block use of mba_MBps mount option on Sub-NUMA Cluster (SNC) systems Tony Luck
2024-07-02 19:24 ` [tip: x86/cache] " tip-bot2 for Tony Luck
2024-06-28 21:56 ` [PATCH v23 08/19] x86/resctrl: Prepare for new Sub-NUMA Cluster (SNC) monitor files Tony Luck
2024-07-02 19:24 ` [tip: x86/cache] " tip-bot2 for Tony Luck
2024-06-28 21:56 ` [PATCH v23 09/19] x86/resctrl: Add a new field to struct rmid_read for summation of domains Tony Luck
2024-07-02 19:24 ` [tip: x86/cache] " tip-bot2 for Tony Luck
2024-06-28 21:56 ` [PATCH v23 10/19] x86/resctrl: Initialize on-stack struct rmid_read instances Tony Luck
2024-07-02 19:24 ` [tip: x86/cache] " tip-bot2 for Tony Luck
2024-06-28 21:56 ` [PATCH v23 11/19] x86/resctrl: Refactor mkdir_mondata_subdir() with a helper function Tony Luck
2024-07-02 19:24 ` tip-bot2 for Tony Luck [this message]
2024-06-28 21:56 ` [PATCH v23 12/19] x86/resctrl: Allocate a new field in union mon_data_bits Tony Luck
2024-07-02 19:24 ` [tip: x86/cache] " tip-bot2 for Tony Luck
2024-06-28 21:56 ` [PATCH v23 13/19] x86/resctrl: Create Sub-NUMA Cluster (SNC) monitor files Tony Luck
2024-07-02 19:24 ` [tip: x86/cache] " tip-bot2 for Tony Luck
2024-06-28 21:56 ` [PATCH v23 14/19] x86/resctrl: Handle removing directories in Sub-NUMA Cluster (SNC) mode Tony Luck
2024-07-02 8:53 ` Borislav Petkov
2024-07-02 17:16 ` Tony Luck
2024-07-02 17:28 ` Borislav Petkov
2024-06-28 21:56 ` [PATCH v23 15/19] x86/resctrl: Fill out rmid_read structure for smp_call*() to read a counter Tony Luck
2024-07-02 19:24 ` [tip: x86/cache] " tip-bot2 for Tony Luck
2024-06-28 21:56 ` [PATCH v23 16/19] x86/resctrl: Make __mon_event_count() handle sum domains Tony Luck
2024-07-02 19:24 ` [tip: x86/cache] " tip-bot2 for Tony Luck
2024-06-28 21:56 ` [PATCH v23 17/19] x86/resctrl: Enable shared RMID mode on Sub-NUMA Cluster (SNC) systems Tony Luck
2024-07-02 8:59 ` Borislav Petkov
2024-06-28 21:56 ` [PATCH v23 18/19] x86/resctrl: Sub-NUMA Cluster (SNC) detection Tony Luck
2024-07-02 19:24 ` [tip: x86/cache] x86/resctrl: Detect Sub-NUMA Cluster (SNC) mode tip-bot2 for Tony Luck
2024-06-28 21:56 ` [PATCH v23 19/19] x86/resctrl: Update documentation with Sub-NUMA cluster changes Tony Luck
2024-07-02 19:24 ` [tip: x86/cache] " tip-bot2 for Tony Luck
2024-07-01 14:24 ` [PATCH v23 00/19] Add support for Sub-NUMA cluster (SNC) systems Moger, Babu
2024-07-01 16:08 ` 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=171994825382.2215.16970529684204186008.tip-bot2@tip-bot2 \
--to=tip-bot2@linutronix.de \
--cc=babu.moger@amd.com \
--cc=bp@alien8.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=reinette.chatre@intel.com \
--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®