All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Yu, Fenghua" <fenghua.yu@intel.com>
To: Babu Moger <babu.moger@amd.com>,
	"Chatre, Reinette" <reinette.chatre@intel.com>
Cc: "tglx@linutronix.de" <tglx@linutronix.de>,
	"mingo@redhat.com" <mingo@redhat.com>,
	"bp@alien8.de" <bp@alien8.de>,
	"dave.hansen@linux.intel.com" <dave.hansen@linux.intel.com>,
	"x86@kernel.org" <x86@kernel.org>,
	"hpa@zytor.com" <hpa@zytor.com>,
	"corbet@lwn.net" <corbet@lwn.net>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-doc@vger.kernel.org" <linux-doc@vger.kernel.org>,
	"Eranian, Stephane" <eranian@google.com>,
	"peternewman@google.com" <peternewman@google.com>,
	"Shankar, Ravi V" <ravi.v.shankar@intel.com>
Subject: RE: [RFC PATCH 3/3] x86/resctrl: Display the RMID and COSID for resctrl groups
Date: Wed, 4 Jan 2023 06:06:31 +0000	[thread overview]
Message-ID: <IA1PR11MB609764AC3E09E0A1F8A8FF7E9BF59@IA1PR11MB6097.namprd11.prod.outlook.com> (raw)
In-Reply-To: <167278361325.34228.16916982678071203069.stgit@bmoger-ubuntu>

Hi, Babu,

> When a user creates a control or monitor group, the CLOSID or RMID are not
> visible to the user. These are architecturally defined entities.
> There is no harm in displaying these in resctrl groups. Sometimes it can help to
> debug the issues.
Although "no harm" to show them, it's not useful for generic user either and may
cause confusion sometimes. CLOSID and RMID are supposed to be invisible to
generic users.

Maybe introduce a new resctrl mount option called "debug" and show the files
and maybe other future debug info only in debug mode?

> 
> Add CLOSID and RMID to the control/monitor groups display in resctrl interface.
> 
>   $cat /sys/fs/resctrl/clos1/closid
>   1
>   $cat /sys/fs/resctrl/mon_groups/mon1/rmid
>   3
> 
> Signed-off-by: Babu Moger <babu.moger@amd.com>
> ---
>  Documentation/x86/resctrl.rst          |   15 ++++++++++
>  arch/x86/kernel/cpu/resctrl/rdtgroup.c |   46
> ++++++++++++++++++++++++++++++++
>  2 files changed, 61 insertions(+)
> 
> diff --git a/Documentation/x86/resctrl.rst b/Documentation/x86/resctrl.rst
> index f26e16412bcb..8520514bc8b5 100644
> --- a/Documentation/x86/resctrl.rst
> +++ b/Documentation/x86/resctrl.rst
> @@ -231,6 +231,14 @@ All groups contain the following files:
>  	Just like "cpus", only using ranges of CPUs instead of bitmasks.
> 
> 
> +"rmid":
> +	Reading this file shows the resource monitoring id (RMID) for
> +	monitoring the resource utilization. Monitoring is performed by
> +	tagging each core(or thread) or process via a Resource Monitoring
> +	ID (RMID). Kernel assigns a new RMID when a group is created
> +	depending on the available RMIDs. Multiple cores(or threads) or
> +	processes can share a same RMID in a resctrl domain.
> +
>  When control is enabled all CTRL_MON groups will also contain:
> 
>  "schemata":
> @@ -252,6 +260,13 @@ When control is enabled all CTRL_MON groups will
> also contain:
>  	file. On successful pseudo-locked region creation the mode will
>  	automatically change to "pseudo-locked".
> 
> +"closid":
> +	Reading this file shows the Class of Service (CLOS) id which acts
> +	as a resource control tag on which the resources can be throttled.
> +	Kernel assigns a new CLOSID a control group is created depending
> +	on the available CLOSIDs. Multiple cores(or threads) or processes
> +	can share a same CLOSID in a resctrl domain.
> +
>  When monitoring is enabled all MON groups will also contain:
> 
>  "mon_data":
> diff --git a/arch/x86/kernel/cpu/resctrl/rdtgroup.c
> b/arch/x86/kernel/cpu/resctrl/rdtgroup.c
> index 0d71ed22cfa9..98b4798e5cae 100644
> --- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c
> +++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c
> @@ -769,6 +769,38 @@ static int rdtgroup_tasks_show(struct kernfs_open_file
> *of,
>  	return ret;
>  }
> 
> +static int rdtgroup_closid_show(struct kernfs_open_file *of,
> +				struct seq_file *s, void *v)
> +{
> +	struct rdtgroup *rdtgrp;
> +	int ret = 0;
> +
> +	rdtgrp = rdtgroup_kn_lock_live(of->kn);
> +	if (rdtgrp)
> +		seq_printf(s, "%u\n", rdtgrp->closid);
> +	else
> +		ret = -ENOENT;
> +	rdtgroup_kn_unlock(of->kn);
> +
> +	return ret;
> +}
> +
> +static int rdtgroup_rmid_show(struct kernfs_open_file *of,
> +			      struct seq_file *s, void *v)
> +{
> +	struct rdtgroup *rdtgrp;
> +	int ret = 0;
> +
> +	rdtgrp = rdtgroup_kn_lock_live(of->kn);
> +	if (rdtgrp)
> +		seq_printf(s, "%u\n", rdtgrp->mon.rmid);
> +	else
> +		ret = -ENOENT;
> +	rdtgroup_kn_unlock(of->kn);
> +
> +	return ret;
> +}
> +
>  #ifdef CONFIG_PROC_CPU_RESCTRL
> 
>  /*
> @@ -1593,6 +1625,20 @@ static struct rftype res_common_files[] = {
>  		.seq_show	= rdtgroup_size_show,
>  		.fflags		= RF_CTRL_BASE,
>  	},
> +	{
> +		.name		= "closid",
> +		.mode		= 0444,
> +		.kf_ops		= &rdtgroup_kf_single_ops,
> +		.seq_show	= rdtgroup_closid_show,
> +		.fflags		= RF_CTRL_BASE,
> +	},
> +	{
> +		.name		= "rmid",
> +		.mode		= 0444,
> +		.kf_ops		= &rdtgroup_kf_single_ops,
> +		.seq_show	= rdtgroup_rmid_show,
> +		.fflags		= RFTYPE_BASE,
> +	},
> 
>  };
> 
> 
Thanks.

-Fenghua

  reply	other threads:[~2023-01-04  6:06 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-03 22:06 [RFC PATCH 0/3] x86/resctrl: Miscellaneous resctrl features Babu Moger
2023-01-03 22:06 ` [RFC PATCH 1/3] x86/resctrl: Add multiple tasks to the resctrl group at once Babu Moger
2023-01-04  5:46   ` Yu, Fenghua
2023-01-04 17:20     ` Moger, Babu
2023-01-03 22:06 ` [RFC PATCH 2/3] x86/resctrl: Move the task's threads to the group automatically Babu Moger
2023-01-04  5:55   ` Yu, Fenghua
2023-01-04 17:49     ` Moger, Babu
2023-01-04 16:43   ` Reinette Chatre
2023-01-04 18:06     ` Moger, Babu
2023-01-03 22:06 ` [RFC PATCH 3/3] x86/resctrl: Display the RMID and COSID for resctrl groups Babu Moger
2023-01-04  6:06   ` Yu, Fenghua [this message]
2023-01-04  6:45     ` Stephane Eranian
2023-01-04 18:01       ` Moger, Babu
2023-01-04 17:58     ` Moger, Babu
2023-01-04 23:54       ` Yu, Fenghua
2023-01-05 15:48         ` 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=IA1PR11MB609764AC3E09E0A1F8A8FF7E9BF59@IA1PR11MB6097.namprd11.prod.outlook.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=ravi.v.shankar@intel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.