[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aa0a87c-e00-9cf2-b76f-bd3bbde84519@linux.intel.com>
Date: Fri, 29 Sep 2023 18:25:40 +0300 (EEST)
From: Ilpo Järvinen <ilpo.jarvinen@...ux.intel.com>
To: Babu Moger <babu.moger@....com>
cc: corbet@....net, Reinette Chatre <reinette.chatre@...el.com>,
tglx@...utronix.de, mingo@...hat.com, bp@...en8.de,
fenghua.yu@...el.com, dave.hansen@...ux.intel.com, x86@...nel.org,
hpa@...or.com, paulmck@...nel.org, akpm@...ux-foundation.org,
quic_neeraju@...cinc.com, rdunlap@...radead.org,
damien.lemoal@...nsource.wdc.com, songmuchun@...edance.com,
peterz@...radead.org, jpoimboe@...nel.org, pbonzini@...hat.com,
chang.seok.bae@...el.com, pawan.kumar.gupta@...ux.intel.com,
jmattson@...gle.com, daniel.sneddon@...ux.intel.com,
sandipan.das@....com, tony.luck@...el.com, james.morse@....com,
linux-doc@...r.kernel.org, LKML <linux-kernel@...r.kernel.org>,
bagasdotme@...il.com, eranian@...gle.com,
christophe.leroy@...roup.eu, jarkko@...nel.org,
adrian.hunter@...el.com, quic_jiles@...cinc.com,
peternewman@...gle.com
Subject: Re: [PATCH v10 07/10] x86/resctrl: Introduce "-o debug" mount
option
On Fri, 15 Sep 2023, Babu Moger wrote:
> Add "-o debug" option to mount resctrl filesystem in debug mode.
> When in debug mode resctrl displays files that have the new
> RFTYPE_DEBUG flag to help resctrl debugging.
>
> Reviewed-by: Reinette Chatre <reinette.chatre@...el.com>
> Reviewed-by: Fenghua Yu <fenghua.yu@...el.com>
> Signed-off-by: Babu Moger <babu.moger@....com>
> ---
> Documentation/arch/x86/resctrl.rst | 5 ++++-
> arch/x86/kernel/cpu/resctrl/internal.h | 2 ++
> arch/x86/kernel/cpu/resctrl/rdtgroup.c | 18 ++++++++++++++++++
> 3 files changed, 24 insertions(+), 1 deletion(-)
>
> diff --git a/Documentation/arch/x86/resctrl.rst b/Documentation/arch/x86/resctrl.rst
> index 8154e9975d1e..28d35aaa74b4 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 14988c9f402c..68d1b7147291 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)
> @@ -306,6 +307,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 a34657f0bd0c..150105c21fee 100644
> --- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c
> +++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c
> @@ -59,6 +59,8 @@ static void rdtgroup_destroy_root(void);
>
> struct dentry *debugfs_resctrl;
>
> +static bool resctrl_debug;
> +
> void rdt_last_cmd_clear(void)
> {
> lockdep_assert_held(&rdtgroup_mutex);
> @@ -1874,6 +1876,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);
> @@ -2377,6 +2382,8 @@ static void rdt_disable_ctx(void)
> resctrl_arch_set_cdp_enabled(RDT_RESOURCE_L3, false);
> resctrl_arch_set_cdp_enabled(RDT_RESOURCE_L2, false);
> set_mba_sc(false);
> +
> + resctrl_debug = false;
> }
>
> static int rdt_enable_ctx(struct rdt_fs_context *ctx)
> @@ -2401,6 +2408,9 @@ static int rdt_enable_ctx(struct rdt_fs_context *ctx)
> goto out_cdpl3;
> }
>
> + if (ctx->enable_debug)
> + resctrl_debug = true;
> +
> return 0;
>
> out_cdpl3:
> @@ -2605,6 +2615,7 @@ enum rdt_param {
> Opt_cdp,
> Opt_cdpl2,
> Opt_mba_mbps,
> + Opt_debug,
> nr__rdt_params
> };
>
> @@ -2612,6 +2623,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),
> {}
> };
>
> @@ -2637,6 +2649,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;
> @@ -3705,6 +3720,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;
> }
>
>
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@...ux.intel.com>
--
i.
Powered by blists - more mailing lists