From: Reinette Chatre <reinette.chatre@intel.com>
To: Babu Moger <babu.moger@amd.com>, <corbet@lwn.net>,
<tglx@linutronix.de>, <mingo@redhat.com>, <bp@alien8.de>,
<dave.hansen@linux.intel.com>, <tony.luck@intel.com>,
<peternewman@google.com>
Cc: <fenghua.yu@intel.com>, <x86@kernel.org>, <hpa@zytor.com>,
<paulmck@kernel.org>, <akpm@linux-foundation.org>,
<thuth@redhat.com>, <rostedt@goodmis.org>,
<xiongwei.song@windriver.com>,
<pawan.kumar.gupta@linux.intel.com>,
<daniel.sneddon@linux.intel.com>, <jpoimboe@kernel.org>,
<perry.yuan@amd.com>, <andipan.das@amd.com>,
<kai.huang@intel.com>, <xiaoyao.li@intel.com>,
<seanjc@google.com>, <xin3.li@intel.com>,
<andrew.cooper3@citrix.com>, <ebiggers@google.com>,
<mario.limonciello@amd.com>, <james.morse@arm.com>,
<tan.shaopeng@fujitsu.com>, <linux-doc@vger.kernel.org>,
<linux-kernel@vger.kernel.org>, <maciej.wieczor-retman@intel.com>,
<eranian@google.com>
Subject: Re: [PATCH v10 08/24] x86/resctrl: Introduce the interface to display monitor mode
Date: Thu, 19 Dec 2024 13:59:52 -0800 [thread overview]
Message-ID: <609f0d7c-55bf-4cde-a1ec-2314e353a0f6@intel.com> (raw)
In-Reply-To: <28399c9a82b771695181e8cb69d9c21847ff4c9c.1734034524.git.babu.moger@amd.com>
Hi Babu,
On 12/12/24 12:15 PM, Babu Moger wrote:
> Introduce the interface file "mbm_assign_mode" to list monitor modes
> supported.
>
> The "mbm_cntr_assign" mode provides the option to assign a counter to
> an RMID, event pair and monitor the bandwidth as long as it is assigned.
>
> On AMD systems "mbm_cntr_assign" is backed by the ABMC (Assignable
> Bandwidth Monitoring Counters) hardware feature and is enabled by default.
>
> The "default" mode is the existing monitoring mode that works without the
> explicit counter assignment, instead relying on dynamic counter assignment
> by hardware that may result in hardware not dedicating a counter resulting
> in monitoring data reads returning "Unavailable".
>
> Provide an interface to display the monitor mode on the system.
> $ cat /sys/fs/resctrl/info/L3_MON/mbm_assign_mode
> [mbm_cntr_assign]
> default
>
> Signed-off-by: Babu Moger <babu.moger@amd.com>
> ---
> v10: Added few more text to user documentation clarify on the default mode.
>
> v9: Updated user documentation based on comments.
>
> v8: Commit message update.
>
> v7: Updated the descriptions/commit log in resctrl.rst to generic text.
> Thanks to James and Reinette.
> Rename mbm_mode to mbm_assign_mode.
> Introduced mutex lock in rdtgroup_mbm_mode_show().
>
> v6: Added documentation for mbm_cntr_assign and legacy mode.
> Moved mbm_mode fflags initialization to static initialization.
>
> v5: Changed interface name to mbm_mode.
> It will be always available even if ABMC feature is not supported.
> Added description in resctrl.rst about ABMC mode.
> Fixed display abmc and legacy consistantly.
>
> v4: Fixed the checks for legacy and abmc mode. Default it ABMC.
>
> v3: New patch to display ABMC capability.
> ---
> Documentation/arch/x86/resctrl.rst | 33 ++++++++++++++++++++++++++
> arch/x86/kernel/cpu/resctrl/rdtgroup.c | 31 ++++++++++++++++++++++++
> 2 files changed, 64 insertions(+)
>
> diff --git a/Documentation/arch/x86/resctrl.rst b/Documentation/arch/x86/resctrl.rst
> index 30586728a4cd..1e4a1f615496 100644
> --- a/Documentation/arch/x86/resctrl.rst
> +++ b/Documentation/arch/x86/resctrl.rst
> @@ -257,6 +257,39 @@ with the following files:
> # cat /sys/fs/resctrl/info/L3_MON/mbm_local_bytes_config
> 0=0x30;1=0x30;3=0x15;4=0x15
>
> +"mbm_assign_mode":
> + Reports the list of monitoring modes supported. The enclosed brackets
> + indicate which mode is enabled.
> + ::
> +
> + # cat /sys/fs/resctrl/info/L3_MON/mbm_assign_mode
> + [mbm_cntr_assign]
> + default
> +
> + "mbm_cntr_assign":
> +
The text below jumps into usage with assumption that user space already
understands the feature. How about starting with some context? Something like
"A monitoring event can only accumulate data while it is backed by a hardware
counter."
> + In mbm_cntr_assign mode user-space is able to specify which of the
> + events in CTRL_MON or MON groups should have a counter assigned using the
> + "mbm_assign_control" file. The number of counters available is described
> + in the "num_mbm_cntrs" file. Changing the mode may cause all counters on
> + a resource to reset.
> +
> + The mode is useful on AMD platforms which support more CTRL_MON and MON
> + groups than hardware counters, meaning 'unassigned' events on CTRL_MON or
> + MON groups will report 'Unavailable'.
The "meaning 'unassigned'" is not clear to me since in "mbm_cntr_assign" mode
these events will (at end of this series) actually return "Unassigned", no? Perhaps
this portion can be dropped for now and the text found in patch #20 about returning
"Unassigned" can be placed here instead ... but this should probably be done in
patch #19 that adds that capability.
> +
> + AMD Platforms with ABMC (Assignable Bandwidth Monitoring Counters) feature
> + enable this mode by default so that counters remain assigned even when the
> + corresponding RMID is not in use by any processor.
> +
> + "default":
> +
> + In default mode, resctrl assumes there is a hardware counter for each
> + event within every CTRL_MON and MON group. On AMD platforms, it is
> + recommended to use mbm_cntr_assign mode if supported, because reading
> + "mbm_total_bytes" or "mbm_local_bytes" will report 'Unavailable' if
> + there is no counter associated with that event.
> +
> "max_threshold_occupancy":
> Read/write file provides the largest value (in
> bytes) at which a previously used LLC_occupancy
> diff --git a/arch/x86/kernel/cpu/resctrl/rdtgroup.c b/arch/x86/kernel/cpu/resctrl/rdtgroup.c
> index d54c2701c09c..f25ff1430014 100644
> --- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c
> +++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c
> @@ -845,6 +845,30 @@ static int rdtgroup_rmid_show(struct kernfs_open_file *of,
> return ret;
> }
>
> +static int rdtgroup_mbm_assign_mode_show(struct kernfs_open_file *of,
> + struct seq_file *s, void *v)
I remember this topic from earlier version yet I still see many instances
of the "rdtgroup_" namespace used for functions that do not interact with
resource groups. Could you please check this series and fix this?
> +{
> + struct rdt_resource *r = of->kn->parent->priv;
> +
> + mutex_lock(&rdtgroup_mutex);
> +
> + if (r->mon.mbm_cntr_assignable) {
> + if (resctrl_arch_mbm_cntr_assign_enabled(r)) {
> + seq_puts(s, "[mbm_cntr_assign]\n");
> + seq_puts(s, "default\n");
> + } else {
> + seq_puts(s, "mbm_cntr_assign\n");
> + seq_puts(s, "[default]\n");
> + }
> + } else {
> + seq_puts(s, "[default]\n");
> + }
> +
> + mutex_unlock(&rdtgroup_mutex);
> +
> + return 0;
> +}
> +
> #ifdef CONFIG_PROC_CPU_RESCTRL
>
> /*
> @@ -1901,6 +1925,13 @@ static struct rftype res_common_files[] = {
> .seq_show = mbm_local_bytes_config_show,
> .write = mbm_local_bytes_config_write,
> },
> + {
> + .name = "mbm_assign_mode",
> + .mode = 0444,
> + .kf_ops = &rdtgroup_kf_single_ops,
> + .seq_show = rdtgroup_mbm_assign_mode_show,
> + .fflags = RFTYPE_MON_INFO,
> + },
> {
> .name = "cpus",
> .mode = 0644,
Reinette
next prev parent reply other threads:[~2024-12-19 22:00 UTC|newest]
Thread overview: 76+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-12 20:15 [PATCH v10 00/24] x86/resctrl : Support AMD Assignable Bandwidth Monitoring Counters (ABMC) Babu Moger
2024-12-12 20:15 ` [PATCH v10 01/24] x86/resctrl: Add __init attribute to functions called from resctrl_late_init() Babu Moger
2024-12-12 20:15 ` [PATCH v10 02/24] x86/cpufeatures: Add support for Assignable Bandwidth Monitoring Counters (ABMC) Babu Moger
2024-12-12 20:15 ` [PATCH v10 03/24] x86/resctrl: Add ABMC feature in the command line options Babu Moger
2024-12-12 20:15 ` [PATCH v10 04/24] x86/resctrl: Consolidate monitoring related data from rdt_resource Babu Moger
2024-12-12 20:15 ` [PATCH v10 05/24] x86/resctrl: Detect Assignable Bandwidth Monitoring feature details Babu Moger
2024-12-12 20:15 ` [PATCH v10 06/24] x86/resctrl: Introduce resctrl_file_fflags_init() to initialize fflags Babu Moger
2024-12-12 20:15 ` [PATCH v10 07/24] x86/resctrl: Add support to enable/disable AMD ABMC feature Babu Moger
2024-12-19 21:48 ` Reinette Chatre
2024-12-20 15:14 ` Moger, Babu
2024-12-20 17:16 ` Reinette Chatre
2024-12-12 20:15 ` [PATCH v10 08/24] x86/resctrl: Introduce the interface to display monitor mode Babu Moger
2024-12-19 21:59 ` Reinette Chatre [this message]
2024-12-20 15:31 ` Moger, Babu
2024-12-12 20:15 ` [PATCH v10 09/24] x86/resctrl: Introduce interface to display number of monitoring counters Babu Moger
2024-12-19 22:03 ` Reinette Chatre
2024-12-20 15:41 ` Moger, Babu
2024-12-12 20:15 ` [PATCH v10 10/24] x86/resctrl: Introduce mbm_total_cfg and mbm_local_cfg in struct rdt_hw_mon_domain Babu Moger
2024-12-12 20:15 ` [PATCH v10 11/24] x86/resctrl: Remove MSR reading of event configuration value Babu Moger
2024-12-19 22:12 ` Reinette Chatre
2024-12-20 16:09 ` Moger, Babu
2024-12-12 20:15 ` [PATCH v10 12/24] x86/resctrl: Introduce cntr_cfg to track assignable counters at domain Babu Moger
2024-12-19 22:33 ` Reinette Chatre
2024-12-20 17:33 ` Moger, Babu
2024-12-20 20:58 ` Reinette Chatre
2024-12-12 20:15 ` [PATCH v10 13/24] x86/resctrl: Introduce interface to display number of free counters Babu Moger
2024-12-19 22:50 ` Reinette Chatre
2024-12-20 18:05 ` Moger, Babu
2024-12-20 18:32 ` Moger, Babu
2024-12-12 20:15 ` [PATCH v10 14/24] x86/resctrl: Add data structures and definitions for ABMC assignment Babu Moger
2024-12-12 20:15 ` [PATCH v10 15/24] x86/resctrl: Implement resctrl_arch_config_cntr() to assign a counter with ABMC Babu Moger
2024-12-19 23:04 ` Reinette Chatre
2024-12-20 19:22 ` Moger, Babu
2024-12-20 21:41 ` Reinette Chatre
2024-12-20 22:28 ` Moger, Babu
2024-12-20 23:47 ` Reinette Chatre
2024-12-21 13:40 ` Moger, Babu
2024-12-12 20:15 ` [PATCH v10 16/24] x86/resctrl: Add interface to the assign counter Babu Moger
2024-12-12 23:37 ` Luck, Tony
2024-12-13 15:57 ` Moger, Babu
2024-12-13 16:24 ` Luck, Tony
2024-12-13 16:54 ` Moger, Babu
2024-12-18 22:01 ` Reinette Chatre
2024-12-19 19:45 ` Moger, Babu
2024-12-19 21:12 ` Reinette Chatre
2024-12-19 21:38 ` Moger, Babu
2024-12-19 21:45 ` Luck, Tony
2024-12-19 22:33 ` Moger, Babu
2024-12-19 23:22 ` Reinette Chatre
2024-12-20 20:34 ` Moger, Babu
2024-12-12 20:15 ` [PATCH v10 17/24] x86/resctrl: Add the interface to unassign a counter Babu Moger
2024-12-19 23:32 ` Reinette Chatre
2024-12-20 21:38 ` Moger, Babu
2024-12-12 20:15 ` [PATCH v10 18/24] x86/resctrl: Auto assign/unassign counters when mbm_cntr_assign is enabled Babu Moger
2024-12-19 23:39 ` Reinette Chatre
2024-12-21 13:45 ` Moger, Babu
2024-12-12 20:15 ` [PATCH v10 19/24] x86/resctrl: Report "Unassigned" for MBM events in mbm_cntr_assign mode Babu Moger
2024-12-19 23:59 ` Reinette Chatre
2024-12-21 14:04 ` Moger, Babu
2024-12-12 20:15 ` [PATCH v10 20/24] x86/resctrl: Introduce the interface to switch between monitor modes Babu Moger
2024-12-20 2:56 ` Reinette Chatre
2024-12-21 14:20 ` Moger, Babu
2024-12-12 20:15 ` [PATCH v10 21/24] x86/resctrl: Configure mbm_cntr_assign mode if supported Babu Moger
2024-12-20 3:03 ` Reinette Chatre
2024-12-21 14:33 ` Moger, Babu
2024-12-12 20:15 ` [PATCH v10 22/24] x86/resctrl: Update assignments on event configuration changes Babu Moger
2024-12-20 3:12 ` Reinette Chatre
2024-12-21 14:59 ` Moger, Babu
2024-12-23 16:20 ` Reinette Chatre
2025-01-13 20:03 ` Moger, Babu
2024-12-12 20:15 ` [PATCH v10 23/24] x86/resctrl: Introduce interface to list assignment states of all the groups Babu Moger
2024-12-12 22:57 ` Luck, Tony
2024-12-13 15:23 ` Moger, Babu
2024-12-12 20:15 ` [PATCH v10 24/24] x86/resctrl: Introduce interface to modify assignment states of " Babu Moger
2024-12-20 3:23 ` Reinette Chatre
2024-12-21 15:28 ` 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=609f0d7c-55bf-4cde-a1ec-2314e353a0f6@intel.com \
--to=reinette.chatre@intel.com \
--cc=akpm@linux-foundation.org \
--cc=andipan.das@amd.com \
--cc=andrew.cooper3@citrix.com \
--cc=babu.moger@amd.com \
--cc=bp@alien8.de \
--cc=corbet@lwn.net \
--cc=daniel.sneddon@linux.intel.com \
--cc=dave.hansen@linux.intel.com \
--cc=ebiggers@google.com \
--cc=eranian@google.com \
--cc=fenghua.yu@intel.com \
--cc=hpa@zytor.com \
--cc=james.morse@arm.com \
--cc=jpoimboe@kernel.org \
--cc=kai.huang@intel.com \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=maciej.wieczor-retman@intel.com \
--cc=mario.limonciello@amd.com \
--cc=mingo@redhat.com \
--cc=paulmck@kernel.org \
--cc=pawan.kumar.gupta@linux.intel.com \
--cc=perry.yuan@amd.com \
--cc=peternewman@google.com \
--cc=rostedt@goodmis.org \
--cc=seanjc@google.com \
--cc=tan.shaopeng@fujitsu.com \
--cc=tglx@linutronix.de \
--cc=thuth@redhat.com \
--cc=tony.luck@intel.com \
--cc=x86@kernel.org \
--cc=xiaoyao.li@intel.com \
--cc=xin3.li@intel.com \
--cc=xiongwei.song@windriver.com \
/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®