[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <dee2c51a-5fb3-4aac-b8e4-a1ec87d76545@intel.com>
Date: Tue, 24 Jun 2025 16:39:52 -0700
From: Reinette Chatre <reinette.chatre@...el.com>
To: Babu Moger <babu.moger@....com>, <corbet@....net>, <tony.luck@...el.com>,
<Dave.Martin@....com>, <james.morse@....com>, <tglx@...utronix.de>,
<mingo@...hat.com>, <bp@...en8.de>, <dave.hansen@...ux.intel.com>
CC: <x86@...nel.org>, <hpa@...or.com>, <akpm@...ux-foundation.org>,
<rostedt@...dmis.org>, <paulmck@...nel.org>, <thuth@...hat.com>,
<ardb@...nel.org>, <gregkh@...uxfoundation.org>, <seanjc@...gle.com>,
<thomas.lendacky@....com>, <pawan.kumar.gupta@...ux.intel.com>,
<manali.shukla@....com>, <perry.yuan@....com>, <kai.huang@...el.com>,
<peterz@...radead.org>, <xiaoyao.li@...el.com>, <kan.liang@...ux.intel.com>,
<mario.limonciello@....com>, <xin3.li@...el.com>, <gautham.shenoy@....com>,
<xin@...or.com>, <chang.seok.bae@...el.com>, <fenghuay@...dia.com>,
<peternewman@...gle.com>, <maciej.wieczor-retman@...el.com>,
<eranian@...gle.com>, <linux-doc@...r.kernel.org>,
<linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v14 14/32] fs/resctrl: Introduce interface to display
number of free MBM counters
Hi Babu,
On 6/13/25 2:04 PM, Babu Moger wrote:
> Provide the interface to display the number of counters IDs available for
"Introduce the "available_mbm_cntrs" resctrl file to display the number of
counters available ..."
> assignment in each domain when "mbm_event" mode is enabled.
>
> Signed-off-by: Babu Moger <babu.moger@....com>
> ---
...
> ---
> Documentation/filesystems/resctrl.rst | 11 ++++++
> fs/resctrl/monitor.c | 5 ++-
> fs/resctrl/rdtgroup.c | 48 +++++++++++++++++++++++++++
> 3 files changed, 63 insertions(+), 1 deletion(-)
>
> diff --git a/Documentation/filesystems/resctrl.rst b/Documentation/filesystems/resctrl.rst
> index 801914de0c81..8a2050098091 100644
> --- a/Documentation/filesystems/resctrl.rst
> +++ b/Documentation/filesystems/resctrl.rst
> @@ -299,6 +299,17 @@ with the following files:
> # cat /sys/fs/resctrl/info/L3_MON/num_mbm_cntrs
> 0=32;1=32
>
> +"available_mbm_cntrs":
> + The number of assignable counters available in each domain when
"The number of counters available for assignment in each domain ..."
> + mbm_event mode is enabled on the system.
> +
> + For example, on a system with 30 available [hardware] assignable counters
> + in each of its L3 domains:
> + ::
> +
> + # cat /sys/fs/resctrl/info/L3_MON/available_mbm_cntrs
> + 0=30;1=30
> +
> "max_threshold_occupancy":
> Read/write file provides the largest value (in
> bytes) at which a previously used LLC_occupancy
> diff --git a/fs/resctrl/monitor.c b/fs/resctrl/monitor.c
> index 92a87aa97b0f..2893da994f3c 100644
> --- a/fs/resctrl/monitor.c
> +++ b/fs/resctrl/monitor.c
> @@ -924,9 +924,12 @@ int resctrl_mon_resource_init(void)
> else if (resctrl_is_mon_event_enabled(QOS_L3_MBM_TOTAL_EVENT_ID))
> mba_mbps_default_event = QOS_L3_MBM_TOTAL_EVENT_ID;
>
> - if (r->mon.mbm_cntr_assignable)
> + if (r->mon.mbm_cntr_assignable) {
> resctrl_file_fflags_init("num_mbm_cntrs",
> RFTYPE_MON_INFO | RFTYPE_RES_CACHE);
> + resctrl_file_fflags_init("available_mbm_cntrs",
> + RFTYPE_MON_INFO | RFTYPE_RES_CACHE);
> + }
>
> return 0;
> }
> diff --git a/fs/resctrl/rdtgroup.c b/fs/resctrl/rdtgroup.c
> index 90b52593ef29..08bcca9bd8b6 100644
> --- a/fs/resctrl/rdtgroup.c
> +++ b/fs/resctrl/rdtgroup.c
> @@ -1853,6 +1853,48 @@ static int resctrl_num_mbm_cntrs_show(struct kernfs_open_file *of,
> return 0;
> }
>
> +static int resctrl_available_mbm_cntrs_show(struct kernfs_open_file *of,
> + struct seq_file *s, void *v)
> +{
> + struct rdt_resource *r = rdt_kn_parent_priv(of->kn);
> + struct rdt_mon_domain *dom;
> + bool sep = false;
> + u32 cntrs, i;
> + int ret = 0;
> +
> + cpus_read_lock();
> + mutex_lock(&rdtgroup_mutex);
> +
> + rdt_last_cmd_clear();
> +
> + if (!resctrl_arch_mbm_cntr_assign_enabled(r)) {
> + rdt_last_cmd_puts("mbm_cntr_assign mode is not enabled\n");
> + ret = -EINVAL;
> + goto unlock_cntrs_show;
unlock_cntrs_show -> out_unlock (to be consistent with rest of resctrl)
Reinette
Powered by blists - more mailing lists