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: <3cf90472-be2d-4800-b3d2-879b5fca2012@intel.com>
Date: Thu, 17 Jul 2025 20:56:48 -0700
From: Reinette Chatre <reinette.chatre@...el.com>
To: Babu Moger <babu.moger@....com>, <corbet@....net>, <tony.luck@...el.com>,
	<james.morse@....com>, <tglx@...utronix.de>, <mingo@...hat.com>,
	<bp@...en8.de>, <dave.hansen@...ux.intel.com>
CC: <Dave.Martin@....com>, <x86@...nel.org>, <hpa@...or.com>,
	<akpm@...ux-foundation.org>, <paulmck@...nel.org>, <rostedt@...dmis.org>,
	<Neeraj.Upadhyay@....com>, <david@...hat.com>, <arnd@...db.de>,
	<fvdl@...gle.com>, <seanjc@...gle.com>, <jpoimboe@...nel.org>,
	<pawan.kumar.gupta@...ux.intel.com>, <xin@...or.com>,
	<manali.shukla@....com>, <tao1.su@...ux.intel.com>, <sohil.mehta@...el.com>,
	<kai.huang@...el.com>, <xiaoyao.li@...el.com>, <peterz@...radead.org>,
	<xin3.li@...el.com>, <kan.liang@...ux.intel.com>,
	<mario.limonciello@....com>, <thomas.lendacky@....com>, <perry.yuan@....com>,
	<gautham.shenoy@....com>, <chang.seok.bae@...el.com>,
	<linux-doc@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
	<peternewman@...gle.com>, <eranian@...gle.com>
Subject: Re: [PATCH v15 29/34] x86,fs/resctrl: Auto assign counters on mkdir
 and clean up on group removal

Hi Babu,

On 7/8/25 3:17 PM, Babu Moger wrote:
> Resctrl provides a user-configurable option mbm_assign_on_mkdir that
> determines if a counter will automatically be assigned to an RMID, event
> pair when its associated monitor group is created via mkdir.
> 
> Enable mbm_assign_on_mkdir by default and automatically assign the counters
> when a resctrl group is created.
> 
> Counters allocated to a resctrl group should be released when the group is
> deleted. Add support to unassign and free counters during the group
> teardown.
> 
> By default, each group requires two counters: one for the MBM total event
> and one for the MBM local event.
> 
> If the counters are exhausted, the kernel will log the error message
> "Unable to allocate counter in domain" in
> /sys/fs/resctrl/info/last_cmd_status when a new group is created and the
> counter assignment will fail. However, the creation of a group should not
> fail due to assignment failures. Users have the flexibility to modify the
> assignments at a later time.

I find that this changelog jumps around a bit. Below is an attempt at some
re-organization. Please feel free to improve:

	Resctrl provides a user-configurable option mbm_assign_on_mkdir that            
	determines if a counter will automatically be assigned to an RMID, event        
	pair when its associated monitor group is created via mkdir.                    
                                                                                
	Enable mbm_assign_on_mkdir by default to automatically assign                   
	counters to the two default events (MBM total and MBM local) of a new           
	monitoring group created via mkdir. This maintains backward compatibility       
	with original resctrl support for these two events.                             
                                                                                
	Unassign and free counters belonging to a monitoring group when the group is    
	deleted.                                                                        
                                                                                
	Monitor group creation does not fail if a counter cannot be assigned to         
	one or both events. There may be limited counters and users have the      
	flexibility to modify counter assignments at a later time.                      
	Log the error message "Unable to allocate counter in domain" in                 
	/sys/fs/resctrl/info/last_cmd_status when a new monitoring group is created     
	but counter assignment failed.

> 
> Signed-off-by: Babu Moger <babu.moger@....com>
> ---

...

> ---
>  arch/x86/kernel/cpu/resctrl/monitor.c |  1 +
>  fs/resctrl/rdtgroup.c                 | 70 ++++++++++++++++++++++++++-
>  2 files changed, 69 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/x86/kernel/cpu/resctrl/monitor.c b/arch/x86/kernel/cpu/resctrl/monitor.c
> index 026c2e2d19d3..e0706083fe0e 100644
> --- a/arch/x86/kernel/cpu/resctrl/monitor.c
> +++ b/arch/x86/kernel/cpu/resctrl/monitor.c
> @@ -457,6 +457,7 @@ int __init rdt_get_mon_l3_config(struct rdt_resource *r)
>  		r->mon.mbm_cntr_assignable = true;
>  		cpuid_count(0x80000020, 5, &eax, &ebx, &ecx, &edx);
>  		r->mon.num_mbm_cntrs = (ebx & GENMASK(15, 0)) + 1;
> +		r->mon.mbm_assign_on_mkdir = true;

This is a resctrl fs default. Should it not be set in
resctrl_mon_resource_init()?


>  	}
>  
>  	r->mon_capable = true;
> diff --git a/fs/resctrl/rdtgroup.c b/fs/resctrl/rdtgroup.c
> index b7289ce2b3a6..645245f274e9 100644
> --- a/fs/resctrl/rdtgroup.c
> +++ b/fs/resctrl/rdtgroup.c
> @@ -2884,6 +2884,54 @@ static void schemata_list_destroy(void)
>  	}
>  }
>  
> +/*
> + * rdtgroup_assign_cntrs() - Assign counters to MBM events. Called when
> + *			     a new group is created.
> + * If "mbm_event" counter assignment mode is enabled, counters should be
> + * automatically assigned if the "mbm_assign_on_mkdir" is set.
> + * Each group can accommodate two counters: one for the total event and

"Each group can accommodate two counters" -> "Each group can accommodate two counters
per domain"?

> + * one for the local event. Assignments may fail due to the limited number
> + * of counters. However, it is not necessary to fail the group creation
> + * and thus no failure is returned. Users have the option to modify the
> + * counter assignments after the group has been created.
> + */
> +static void rdtgroup_assign_cntrs(struct rdtgroup *rdtgrp)
> +{
> +	struct rdt_resource *r = resctrl_arch_get_resource(RDT_RESOURCE_L3);
> +
> +	if (!r->mon_capable || !resctrl_arch_mbm_cntr_assign_enabled(r) ||
> +	    !r->mon.mbm_assign_on_mkdir)
> +		return;
> +
> +	if (resctrl_is_mon_event_enabled(QOS_L3_MBM_TOTAL_EVENT_ID))
> +		rdtgroup_assign_cntr_event(NULL, rdtgrp,
> +					   &mon_event_all[QOS_L3_MBM_TOTAL_EVENT_ID]);
> +
> +	if (resctrl_is_mon_event_enabled(QOS_L3_MBM_LOCAL_EVENT_ID))
> +		rdtgroup_assign_cntr_event(NULL, rdtgrp,
> +					   &mon_event_all[QOS_L3_MBM_LOCAL_EVENT_ID]);
> +}
> +

Reinette


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ