[v3,6/7] x86/resctrl: Introduce -o debug mount option
Commit Message
Add -o debug option to mount resctrl filesystem in debug mode. Debug
option adds the files for debug purposes.
Signed-off-by: Babu Moger <babu.moger@amd.com>
---
Documentation/x86/resctrl.rst | 2 ++
arch/x86/kernel/cpu/resctrl/internal.h | 1 +
arch/x86/kernel/cpu/resctrl/rdtgroup.c | 13 +++++++++++++
3 files changed, 16 insertions(+)
Comments
Hi Babu,
On 3/2/2023 12:25 PM, Babu Moger wrote:
> Add -o debug option to mount resctrl filesystem in debug mode. Debug
> option adds the files for debug purposes.
>
> Signed-off-by: Babu Moger <babu.moger@amd.com>
> ---
> Documentation/x86/resctrl.rst | 2 ++
> arch/x86/kernel/cpu/resctrl/internal.h | 1 +
> arch/x86/kernel/cpu/resctrl/rdtgroup.c | 13 +++++++++++++
> 3 files changed, 16 insertions(+)
>
> diff --git a/Documentation/x86/resctrl.rst b/Documentation/x86/resctrl.rst
> index 67eae74fe40c..1ada4e0650dc 100644
> --- a/Documentation/x86/resctrl.rst
> +++ b/Documentation/x86/resctrl.rst
> @@ -46,6 +46,8 @@ mount options are:
> "mba_MBps":
> Enable the MBA Software Controller(mba_sc) to specify MBA
> bandwidth in MBps
> +"debug":
> + Lists the debug files in resctrl interface
>
This seems to imply that a listing of available debug flags
will be displayed. How about something like "Make debug files
accessible. Available debug files are annotated with "Available
only with debug option"." (please feel free to improve).
> 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 6767c85b9699..35a9ee343fe0 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 debug;
Why not follow the prefix of existing flags?
> };
>
> static inline struct rdt_fs_context *rdt_fc2context(struct fs_context *fc)
Reinette
On 3/15/23 13:43, Reinette Chatre wrote:
> Hi Babu,
>
> On 3/2/2023 12:25 PM, Babu Moger wrote:
>> Add -o debug option to mount resctrl filesystem in debug mode. Debug
>> option adds the files for debug purposes.
>>
>> Signed-off-by: Babu Moger <babu.moger@amd.com>
>> ---
>> Documentation/x86/resctrl.rst | 2 ++
>> arch/x86/kernel/cpu/resctrl/internal.h | 1 +
>> arch/x86/kernel/cpu/resctrl/rdtgroup.c | 13 +++++++++++++
>> 3 files changed, 16 insertions(+)
>>
>> diff --git a/Documentation/x86/resctrl.rst b/Documentation/x86/resctrl.rst
>> index 67eae74fe40c..1ada4e0650dc 100644
>> --- a/Documentation/x86/resctrl.rst
>> +++ b/Documentation/x86/resctrl.rst
>> @@ -46,6 +46,8 @@ mount options are:
>> "mba_MBps":
>> Enable the MBA Software Controller(mba_sc) to specify MBA
>> bandwidth in MBps
>> +"debug":
>> + Lists the debug files in resctrl interface
>>
>
> This seems to imply that a listing of available debug flags
> will be displayed. How about something like "Make debug files
> accessible. Available debug files are annotated with "Available
> only with debug option"." (please feel free to improve).
Sure.
>
>> 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 6767c85b9699..35a9ee343fe0 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 debug;
>
> Why not follow the prefix of existing flags?
Ok. Sure. Will change it.
@@ -46,6 +46,8 @@ mount options are:
"mba_MBps":
Enable the MBA Software Controller(mba_sc) to specify MBA
bandwidth in MBps
+"debug":
+ Lists the debug files in resctrl interface
L2 and L3 CDP are controlled separately.
@@ -59,6 +59,7 @@ struct rdt_fs_context {
bool enable_cdpl2;
bool enable_cdpl3;
bool enable_mba_mbps;
+ bool debug;
};
static inline struct rdt_fs_context *rdt_fc2context(struct fs_context *fc)
@@ -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);
@@ -2411,6 +2413,9 @@ static int rdt_enable_ctx(struct rdt_fs_context *ctx)
if (!ret && ctx->enable_mba_mbps)
ret = set_mba_sc(true);
+ if (!ret && ctx->debug)
+ resctrl_debug = true;
+
return ret;
}
@@ -2599,6 +2604,7 @@ enum rdt_param {
Opt_cdp,
Opt_cdpl2,
Opt_mba_mbps,
+ Opt_debug,
nr__rdt_params
};
@@ -2606,6 +2612,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),
{}
};
@@ -2631,6 +2638,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->debug = true;
+ return 0;
}
return -EINVAL;
@@ -3569,6 +3579,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;
}