mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Fenghua Yu <fenghua.yu@intel.com>
To: Babu Moger <babu.moger@amd.com>, <reinette.chatre@intel.com>
Cc: <tglx@linutronix.de>, <mingo@redhat.com>, <bp@alien8.de>,
	<dave.hansen@linux.intel.com>, <x86@kernel.org>, <hpa@zytor.com>,
	<corbet@lwn.net>, <linux-kernel@vger.kernel.org>,
	<linux-doc@vger.kernel.org>, <eranian@google.com>,
	<peternewman@google.com>
Subject: Re: [RFC v2 PATCH 7/7] x86/resctrl: Add debug files when mounted with debug option
Date: Thu, 16 Feb 2023 17:50:17 -0800	[thread overview]
Message-ID: <6713e2e9-827d-8f3d-0923-a03b6b072383@intel.com> (raw)
In-Reply-To: <167537445777.647488.12333202522131465679.stgit@bmoger-ubuntu>

Hi, Babu,

On 2/2/23 13:47, Babu Moger wrote:
> Add the debug files to the resctrl hierarchy.
> 
> Signed-off-by: Babu Moger <babu.moger@amd.com>
> ---
>   arch/x86/kernel/cpu/resctrl/rdtgroup.c |   27 +++++++++++++++++++++++++++
>   1 file changed, 27 insertions(+)
> 
> diff --git a/arch/x86/kernel/cpu/resctrl/rdtgroup.c b/arch/x86/kernel/cpu/resctrl/rdtgroup.c
> index c35d91b04de6..b7c72b011264 100644
> --- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c
> +++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c
> @@ -2398,6 +2398,31 @@ static int mkdir_mondata_all(struct kernfs_node *parent_kn,
>   			     struct rdtgroup *prgrp,
>   			     struct kernfs_node **mon_data_kn);
>   
> +void resctrl_add_debug_file(struct kernfs_node *parent_kn,
> +			    const char *config, unsigned long fflags,
> +			    bool debug)
> +{
> +	struct rftype *rft;
> +
> +	rft = rdtgroup_get_rftype_by_name(config);
> +	if (debug && rft) {
> +		rft->fflags |= fflags;
> +		rdtgroup_add_file(parent_kn, rft);
> +	} else if (rft) {
> +		rft->fflags &= ~fflags;
> +		kernfs_remove_by_name(parent_kn, config);
> +	}
> +}
> +
> +static void resctrl_add_debug_files(bool debug)
> +{
> +	resctrl_add_debug_file(rdtgroup_default.kn, "rmid",
> +			       RFTYPE_BASE, debug);
> +	resctrl_add_debug_file(rdtgroup_default.kn, "closid",
> +			       RFTYPE_BASE_CTRL, debug);
> +	kernfs_activate(rdtgroup_default.kn);
> +}
> +
>   static int rdt_enable_ctx(struct rdt_fs_context *ctx)
>   {
>   	int ret = 0;
> @@ -2411,6 +2436,8 @@ static int rdt_enable_ctx(struct rdt_fs_context *ctx)
>   	if (!ret && ctx->enable_mba_mbps)
>   		ret = set_mba_sc(true);
>    > +	resctrl_add_debug_files(ctx->debug);

It's better to change to:
+	if (ctx->debug)
+		resctrl_add_debug_files();

Then the functions in the call chain can remove 'debug' parameter and 
can be simpler.
> +
>   	return ret;
>   }
>   
> 
> 
Thanks.

-Fenghua

  reply	other threads:[~2023-02-17  1:50 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-02 21:46 [RFC v2 PATCH 0/7] x86/resctrl: Miscellaneous resctrl features Babu Moger
2023-02-02 21:46 ` [RFC v2 PATCH 1/7] x86/resctrl: Add multiple tasks to the resctrl group at once Babu Moger
2023-02-16 22:27   ` Fenghua Yu
2023-02-17 15:05     ` Moger, Babu
2023-02-02 21:47 ` [RFC v2 PATCH 2/7] x86/resctrl: Remove few unnecessary rftype flags Babu Moger
2023-02-02 21:47 ` [RFC v2 PATCH 3/7] x86/resctrl: Rename rftype flags for consistency Babu Moger
2023-02-02 21:47 ` [RFC v2 PATCH 4/7] x86/resctrl: Re-arrange RFTYPE flags based on hierarchy Babu Moger
2023-02-02 21:47 ` [RFC v2 PATCH 5/7] x86/resctrl: Introduce -o debug mount option Babu Moger
2023-02-17  1:42   ` Fenghua Yu
2023-02-17 17:29     ` Moger, Babu
2023-02-02 21:47 ` [RFC v2 PATCH 6/7] x86/resctrl: Display the RMID and COSID for resctrl groups Babu Moger
2023-02-17  1:46   ` Fenghua Yu
2023-02-17 17:39     ` Moger, Babu
2023-02-02 21:47 ` [RFC v2 PATCH 7/7] x86/resctrl: Add debug files when mounted with debug option Babu Moger
2023-02-17  1:50   ` Fenghua Yu [this message]
2023-02-17 17:49     ` Moger, Babu
2023-02-16 18:05 ` [RFC v2 PATCH 0/7] x86/resctrl: Miscellaneous resctrl features Moger, Babu
2023-02-16 22:13   ` Reinette Chatre

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=6713e2e9-827d-8f3d-0923-a03b6b072383@intel.com \
    --to=fenghua.yu@intel.com \
    --cc=babu.moger@amd.com \
    --cc=bp@alien8.de \
    --cc=corbet@lwn.net \
    --cc=dave.hansen@linux.intel.com \
    --cc=eranian@google.com \
    --cc=hpa@zytor.com \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=peternewman@google.com \
    --cc=reinette.chatre@intel.com \
    --cc=tglx@linutronix.de \
    --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®