From: Babu Moger <babu.moger@amd.com>
To: <corbet@lwn.net>, <reinette.chatre@intel.com>,
<tglx@linutronix.de>, <mingo@redhat.com>, <bp@alien8.de>
Cc: <fenghua.yu@intel.com>, <dave.hansen@linux.intel.com>,
<x86@kernel.org>, <hpa@zytor.com>, <paulmck@kernel.org>,
<akpm@linux-foundation.org>, <quic_neeraju@quicinc.com>,
<rdunlap@infradead.org>, <damien.lemoal@opensource.wdc.com>,
<songmuchun@bytedance.com>, <peterz@infradead.org>,
<jpoimboe@kernel.org>, <pbonzini@redhat.com>,
<babu.moger@amd.com>, <chang.seok.bae@intel.com>,
<pawan.kumar.gupta@linux.intel.com>, <jmattson@google.com>,
<daniel.sneddon@linux.intel.com>, <sandipan.das@amd.com>,
<tony.luck@intel.com>, <james.morse@arm.com>,
<linux-doc@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
<bagasdotme@gmail.com>, <eranian@google.com>,
<christophe.leroy@csgroup.eu>,
<pawan.kumar.gupta@linux.intel.com>, <jarkko@kernel.org>,
<adrian.hunter@intel.com>, <quic_jiles@quicinc.com>,
<peternewman@google.com>, <babu.moger@amd.com>
Subject: [PATCH v7 7/8] x86/resctrl: Introduce "-o debug" mount option
Date: Fri, 11 Aug 2023 15:10:49 -0500 [thread overview]
Message-ID: <169178464934.1147205.6915303244307989200.stgit@bmoger-ubuntu> (raw)
In-Reply-To: <169178429591.1147205.4030367096506551808.stgit@bmoger-ubuntu>
Add "-o debug" option to mount resctrl filesystem in debug mode. This
option is used for adding extra files to help resctrl debugging.
Signed-off-by: Babu Moger <babu.moger@amd.com>
---
Documentation/arch/x86/resctrl.rst | 5 ++++-
arch/x86/kernel/cpu/resctrl/internal.h | 2 ++
arch/x86/kernel/cpu/resctrl/rdtgroup.c | 21 +++++++++++++++++++++
3 files changed, 27 insertions(+), 1 deletion(-)
diff --git a/Documentation/arch/x86/resctrl.rst b/Documentation/arch/x86/resctrl.rst
index af234681756e..5a2346d2c561 100644
--- a/Documentation/arch/x86/resctrl.rst
+++ b/Documentation/arch/x86/resctrl.rst
@@ -35,7 +35,7 @@ about the feature from resctrl's info directory.
To use the feature mount the file system::
- # mount -t resctrl resctrl [-o cdp[,cdpl2][,mba_MBps]] /sys/fs/resctrl
+ # mount -t resctrl resctrl [-o cdp[,cdpl2][,mba_MBps][,debug]] /sys/fs/resctrl
mount options are:
@@ -46,6 +46,9 @@ mount options are:
"mba_MBps":
Enable the MBA Software Controller(mba_sc) to specify MBA
bandwidth in MBps
+"debug":
+ Make debug files accessible. Available debug files are annotated with
+ "Available only with debug option".
L2 and L3 CDP are controlled separately.
diff --git a/arch/x86/kernel/cpu/resctrl/internal.h b/arch/x86/kernel/cpu/resctrl/internal.h
index 2bd92c0c3b0c..4689e87ec638 100644
--- a/arch/x86/kernel/cpu/resctrl/internal.h
+++ b/arch/x86/kernel/cpu/resctrl/internal.h
@@ -59,6 +59,7 @@ struct rdt_fs_context {
bool enable_cdpl2;
bool enable_cdpl3;
bool enable_mba_mbps;
+ bool enable_debug;
};
static inline struct rdt_fs_context *rdt_fc2context(struct fs_context *fc)
@@ -297,6 +298,7 @@ struct rdtgroup {
#define RFTYPE_TOP BIT(6)
#define RFTYPE_RES_CACHE BIT(8)
#define RFTYPE_RES_MB BIT(9)
+#define RFTYPE_DEBUG BIT(10)
#define RFTYPE_CTRL_INFO (RFTYPE_INFO | RFTYPE_CTRL)
#define RFTYPE_MON_INFO (RFTYPE_INFO | RFTYPE_MON)
#define RFTYPE_TOP_INFO (RFTYPE_INFO | RFTYPE_TOP)
diff --git a/arch/x86/kernel/cpu/resctrl/rdtgroup.c b/arch/x86/kernel/cpu/resctrl/rdtgroup.c
index a7453c93bad4..6b7e914657fa 100644
--- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c
+++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c
@@ -56,6 +56,8 @@ static char last_cmd_status_buf[512];
struct dentry *debugfs_resctrl;
+static bool resctrl_debug;
+
void rdt_last_cmd_clear(void)
{
lockdep_assert_held(&rdtgroup_mutex);
@@ -1871,6 +1873,9 @@ static int rdtgroup_add_files(struct kernfs_node *kn, unsigned long fflags)
lockdep_assert_held(&rdtgroup_mutex);
+ if (resctrl_debug)
+ fflags |= RFTYPE_DEBUG;
+
for (rft = rfts; rft < rfts + len; rft++) {
if (rft->fflags && ((fflags & rft->fflags) == rft->fflags)) {
ret = rdtgroup_add_file(kn, rft);
@@ -2387,6 +2392,9 @@ static void rdt_disable_ctx(struct rdt_fs_context *ctx)
if (ctx->enable_mba_mbps)
set_mba_sc(false);
+
+ if (ctx->enable_debug)
+ resctrl_debug = false;
}
static int rdt_enable_ctx(struct rdt_fs_context *ctx)
@@ -2411,6 +2419,9 @@ static int rdt_enable_ctx(struct rdt_fs_context *ctx)
goto out_disable;
}
+ if (ctx->enable_debug)
+ resctrl_debug = true;
+
return 0;
out_disable:
@@ -2612,6 +2623,7 @@ enum rdt_param {
Opt_cdp,
Opt_cdpl2,
Opt_mba_mbps,
+ Opt_debug,
nr__rdt_params
};
@@ -2619,6 +2631,7 @@ static const struct fs_parameter_spec rdt_fs_parameters[] = {
fsparam_flag("cdp", Opt_cdp),
fsparam_flag("cdpl2", Opt_cdpl2),
fsparam_flag("mba_MBps", Opt_mba_mbps),
+ fsparam_flag("debug", Opt_debug),
{}
};
@@ -2644,6 +2657,9 @@ static int rdt_parse_param(struct fs_context *fc, struct fs_parameter *param)
return -EINVAL;
ctx->enable_mba_mbps = true;
return 0;
+ case Opt_debug:
+ ctx->enable_debug = true;
+ return 0;
}
return -EINVAL;
@@ -2833,6 +2849,8 @@ static void rdt_kill_sb(struct super_block *sb)
set_mba_sc(false);
+ resctrl_debug = false;
+
/*Put everything back to default values. */
for_each_alloc_capable_rdt_resource(r)
reset_all_ctrls(r);
@@ -3713,6 +3731,9 @@ static int rdtgroup_show_options(struct seq_file *seq, struct kernfs_root *kf)
if (is_mba_sc(&rdt_resources_all[RDT_RESOURCE_MBA].r_resctrl))
seq_puts(seq, ",mba_MBps");
+ if (resctrl_debug)
+ seq_puts(seq, ",debug");
+
return 0;
}
next prev parent reply other threads:[~2023-08-11 20:11 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-11 20:08 [PATCH v7 0/8] x86/resctrl: Miscellaneous resctrl features Babu Moger
2023-08-11 20:08 ` [PATCH v7 1/8] x86/resctrl: Add multiple tasks to the resctrl group at once Babu Moger
2023-08-15 22:43 ` Reinette Chatre
2023-08-11 20:08 ` [PATCH v7 2/8] x86/resctrl: Simplify rftype flag definitions Babu Moger
2023-08-11 20:09 ` [PATCH v7 3/8] x86/resctrl: Rename rftype flags for consistency Babu Moger
2023-08-11 20:09 ` [PATCH v7 4/8] x86/resctrl: Add comments on RFTYPE flags hierarchy Babu Moger
2023-08-15 22:45 ` Reinette Chatre
2023-08-16 15:34 ` Moger, Babu
2023-08-16 18:36 ` Reinette Chatre
2023-08-17 14:20 ` Moger, Babu
2023-08-17 15:37 ` Reinette Chatre
2023-08-17 17:07 ` Moger, Babu
2023-08-17 17:42 ` Reinette Chatre
2023-08-17 19:21 ` Moger, Babu
2023-08-11 20:09 ` [PATCH v7 5/8] x86/resctrl: Unwind the errors inside rdt_enable_ctx() Babu Moger
2023-08-15 22:47 ` Reinette Chatre
2023-08-16 18:17 ` Moger, Babu
2023-08-16 19:07 ` Reinette Chatre
2023-08-17 14:22 ` Moger, Babu
2023-08-11 20:10 ` [PATCH v7 6/8] x86/resctrl: Move default control group creation during mount Babu Moger
2023-08-15 22:50 ` Reinette Chatre
2023-08-16 19:14 ` Moger, Babu
2023-08-16 23:02 ` Reinette Chatre
2023-08-17 14:23 ` Moger, Babu
2023-08-11 20:10 ` Babu Moger [this message]
2023-08-15 22:51 ` [PATCH v7 7/8] x86/resctrl: Introduce "-o debug" mount option Reinette Chatre
2023-08-16 19:15 ` Moger, Babu
2023-08-11 20:10 ` [PATCH v7 8/8] x86/resctrl: Display hardware ids of resource groups Babu Moger
2023-08-15 22:52 ` Reinette Chatre
2023-08-17 19:24 ` Moger, Babu
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=169178464934.1147205.6915303244307989200.stgit@bmoger-ubuntu \
--to=babu.moger@amd.com \
--cc=adrian.hunter@intel.com \
--cc=akpm@linux-foundation.org \
--cc=bagasdotme@gmail.com \
--cc=bp@alien8.de \
--cc=chang.seok.bae@intel.com \
--cc=christophe.leroy@csgroup.eu \
--cc=corbet@lwn.net \
--cc=damien.lemoal@opensource.wdc.com \
--cc=daniel.sneddon@linux.intel.com \
--cc=dave.hansen@linux.intel.com \
--cc=eranian@google.com \
--cc=fenghua.yu@intel.com \
--cc=hpa@zytor.com \
--cc=james.morse@arm.com \
--cc=jarkko@kernel.org \
--cc=jmattson@google.com \
--cc=jpoimboe@kernel.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=paulmck@kernel.org \
--cc=pawan.kumar.gupta@linux.intel.com \
--cc=pbonzini@redhat.com \
--cc=peternewman@google.com \
--cc=peterz@infradead.org \
--cc=quic_jiles@quicinc.com \
--cc=quic_neeraju@quicinc.com \
--cc=rdunlap@infradead.org \
--cc=reinette.chatre@intel.com \
--cc=sandipan.das@amd.com \
--cc=songmuchun@bytedance.com \
--cc=tglx@linutronix.de \
--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;
as well as URLs for NNTP newsgroup(s).