lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <7c9bcb5c-0626-495d-b581-2bcbdf8d8699@amd.com>
Date: Tue, 1 Jul 2025 14:48:30 -0500
From: "Moger, Babu" <babu.moger@....com>
To: Reinette Chatre <reinette.chatre@...el.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 28/32] fs/resctrl: Introduce mbm_L3_assignments to
 list assignments in a group

Hi Reinette,

On 6/25/25 18:27, Reinette Chatre wrote:
> Hi Babu,
> 
> On 6/13/25 2:05 PM, Babu Moger wrote:
>> Introduce the interface to display the assignment states for resctrl group
> 
> "Introduce the mbm_L3_assignments resctrl file associated with
> CTRL_MON an MON resource groups to display the counter assignment
> states of the resource group when "mbm_event" counter assignment
> mode is enabled."

Sure.

> 
>> when "mbm_event" mdoe is enabled.
> 
> "mdoe" -> "counter assignment mode"
>

Sure.


>>
>> The list is displayed in the following format:
>> <Event>:<Domain id>=<Assignment state>
> 
> Similar to previous note, please add syntax for multiple domains to avoid
> it appearing that each domain is on one line.

The list is displayed in the following format:
    <Event>:<Domain id>=<Assignment state>;<Domain id>=<Assignment state>


> 
>>
>> Event: A valid MBM event listed in
>>        /sys/fs/resctrl/info/L3_MON/event_configs directory.
>>
>> Domain ID: A valid domain ID.
>>
>> The assignment state can be one of the following:
>>
>> _ : No counter assigned.
>>
>> e : Counter assigned exclusively.
>>
>> Example:
>> To list the assignment states for the default group
>> $ cd /sys/fs/resctrl
>> $ cat /sys/fs/resctrl/mbm_L3_assignments
>> mbm_total_bytes:0=e;1=e
>> mbm_local_bytes:0=e;1=e
>>
>> Signed-off-by: Babu Moger <babu.moger@....com>
>> ---
>> v14: Added missed rdtgroup_kn_lock_live on failure case.
>>      Updated the user doc resctrl.rst to clarify counter assignments.
>>      Updated the changelog.
>>
>> v13: Changelog update.
>>      Few changes in mbm_L3_assignments_show() after moving the event config to evt_list.
>>      Resolved conflicts caused by the recent FS/ARCH code restructure.
>>      The rdtgroup.c/monitor.c files have been split between the FS and ARCH directories.
>>
>> v12: New patch:
>>      Assignment interface moved inside the group based the discussion
>>      https://lore.kernel.org/lkml/CALPaoCiii0vXOF06mfV=kVLBzhfNo0SFqt4kQGwGSGVUqvr2Dg@mail.gmail.com/#t
>> ---
>>  Documentation/filesystems/resctrl.rst | 28 ++++++++++++++
>>  fs/resctrl/monitor.c                  |  1 +
>>  fs/resctrl/rdtgroup.c                 | 54 +++++++++++++++++++++++++++
>>  3 files changed, 83 insertions(+)
>>
>> diff --git a/Documentation/filesystems/resctrl.rst b/Documentation/filesystems/resctrl.rst
>> index f94c7c387416..a232a0b1356c 100644
>> --- a/Documentation/filesystems/resctrl.rst
>> +++ b/Documentation/filesystems/resctrl.rst
>> @@ -516,6 +516,34 @@ When the "mba_MBps" mount option is used all CTRL_MON groups will also contain:
>>  	/sys/fs/resctrl/info/L3_MON/mon_features changes the input
>>  	event.
>>  
>> +"mbm_L3_assignments":
>> +	Exists when "mbm_event" mode is supported and lists the counter
> 
> ""mbm_event" mode" -> "mbm_event" counter assignment mode"
> 
>> +	assignment states for the group.
> 
> "for the group" -> "of the group"?
> 

Sure.

>> +
>> +	The assignment list is displayed in the following format:
>> +
>> +	<Event>:<Domain ID>=<Assignment state>
> 
> Same comment about syntax example.
> 

Sure.

>> +
>> +	Event: A valid MBM event in the
>> +	       /sys/fs/resctrl/info/L3_MON/event_configs directory.
>> +
>> +	Domain ID: A valid domain ID.
>> +
>> +	Assignment states:
>> +
>> +	_ : No counter assigned.
>> +
>> +	e : Counter assigned exclusively.
>> +
>> +	Example:
>> +	To display the counter assignment states for the default group.
>> +	::
>> +
>> +	 # cd /sys/fs/resctrl
>> +	 # cat /sys/fs/resctrl/mbm_L3_assignments
>> +	   mbm_total_bytes:0=e;1=e
>> +	   mbm_local_bytes:0=e;1=e
>> +
>>  Resource allocation rules
>>  -------------------------
>>  
>> diff --git a/fs/resctrl/monitor.c b/fs/resctrl/monitor.c
>> index 1ec2efd50273..618c94cd1ad8 100644
>> --- a/fs/resctrl/monitor.c
>> +++ b/fs/resctrl/monitor.c
>> @@ -959,6 +959,7 @@ int resctrl_mon_resource_init(void)
>>  		resctrl_file_fflags_init("event_filter", RFTYPE_ASSIGN_CONFIG);
>>  		resctrl_file_fflags_init("mbm_assign_on_mkdir", RFTYPE_MON_INFO |
>>  					 RFTYPE_RES_CACHE);
>> +		resctrl_file_fflags_init("mbm_L3_assignments", RFTYPE_MON_BASE);
>>  	}
>>  
>>  	return 0;
>> diff --git a/fs/resctrl/rdtgroup.c b/fs/resctrl/rdtgroup.c
>> index 128a9db339f3..18ec65801dbb 100644
>> --- a/fs/resctrl/rdtgroup.c
>> +++ b/fs/resctrl/rdtgroup.c
>> @@ -2081,6 +2081,54 @@ static ssize_t resctrl_mbm_assign_on_mkdir_write(struct kernfs_open_file *of,
>>  	return ret ?: nbytes;
>>  }
>>  
>> +static int mbm_L3_assignments_show(struct kernfs_open_file *of, struct seq_file *s, void *v)
>> +{
>> +	struct rdt_resource *r = resctrl_arch_get_resource(RDT_RESOURCE_L3);
>> +	struct rdt_mon_domain *d;
>> +	struct rdtgroup *rdtgrp;
>> +	struct mon_evt *mevt;
>> +	int ret = 0;
>> +	bool sep;
>> +
>> +	rdtgrp = rdtgroup_kn_lock_live(of->kn);
>> +	if (!rdtgrp) {
>> +		ret = -ENOENT;
>> +		goto out_assign;
> 
> out_assign -> out_unlock
> 

Sure.

>> +	}
>> +
>> +	rdt_last_cmd_clear();
>> +	if (!resctrl_arch_mbm_cntr_assign_enabled(r)) {
>> +		rdt_last_cmd_puts("mbm_event mode is not enabled\n");
>> +		ret = -ENOENT;
>> +		goto out_assign;
>> +	}
>> +
>> +	for (mevt = &mon_event_all[0]; mevt < &mon_event_all[QOS_NUM_EVENTS]; mevt++) {
>> +		if (!mevt->enabled || !resctrl_is_mbm_event(mevt->evtid))
>> +			continue;
> 
> (use macro and mon_evt::rid)
> 

Sure.

>> +
>> +		sep = false;
>> +		seq_printf(s, "%s:", mevt->name);
>> +		list_for_each_entry(d, &r->mon_domains, hdr.list) {
>> +			if (sep)
>> +				seq_putc(s, ';');
>> +
>> +			if (mbm_cntr_get(r, d, rdtgrp, mevt->evtid) >= 0)
>> +				seq_printf(s, "%d=e", d->hdr.id);
>> +			else
>> +				seq_printf(s, "%d=_", d->hdr.id);
>> +
>> +			sep = true;
>> +		}
>> +		seq_putc(s, '\n');
>> +	}
>> +
>> +out_assign:
>> +	rdtgroup_kn_unlock(of->kn);
>> +
>> +	return ret;
>> +}
>> +
>>  /* rdtgroup information files for one cache resource. */
>>  static struct rftype res_common_files[] = {
>>  	{
>> @@ -2219,6 +2267,12 @@ static struct rftype res_common_files[] = {
>>  		.seq_show	= event_filter_show,
>>  		.write		= event_filter_write,
>>  	},
>> +	{
>> +		.name		= "mbm_L3_assignments",
>> +		.mode		= 0444,
>> +		.kf_ops		= &rdtgroup_kf_single_ops,
>> +		.seq_show	= mbm_L3_assignments_show,
>> +	},
>>  	{
>>  		.name		= "mbm_assign_mode",
>>  		.mode		= 0444,
> 
> Reinette
> 

-- 
Thanks
Babu Moger

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ