Re: [PATCH v16 17/34] fs/resctrl: Add the functionality to assign MBM events

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Reinette,

On 7/30/25 14:52, Reinette Chatre wrote:
> Hi Babu,
> 
> On 7/25/25 11:29 AM, Babu Moger wrote:
>> When supported, "mbm_event" counter assignment mode offers "num_mbm_cntrs"
>> number of counters that can be assigned to RMID, event pairs and monitor
>> bandwidth usage as long as it is assigned.
>>
>> Add the functionality to allocate and assign a counter to an RMID, event
>> pair in the domain.
>>
>> If all the counters are in use, kernel will log the error message
> 
> I think dropping "kernel will" will help the text to be imperative.
> 
>> "Failed to allocate counter for <event> in domain <id>" in
>> /sys/fs/resctrl/info/last_cmd_status when a new assignment is requested.
> 
> "when a new assignment is requested" can be dropped. Or alternatively:
> 	Log the error message "Failed to allocate counter for <event> in domain
> 	<id>" in /sys/fs/resctrl/info/last_cmd_status if all the counters
> 	are in use.
> 

Sure. will do.

>> Exit on the first failure when assigning counters across all the domains.
>>
>> Signed-off-by: Babu Moger <babu.moger@xxxxxxx>
>> ---
> 
> ...
> 
>> ---
>>  fs/resctrl/internal.h |   3 +
>>  fs/resctrl/monitor.c  | 130 ++++++++++++++++++++++++++++++++++++++++++
>>  2 files changed, 133 insertions(+)
>>
>> diff --git a/fs/resctrl/internal.h b/fs/resctrl/internal.h
>> index db3a0f12ad77..419423bdabdc 100644
>> --- a/fs/resctrl/internal.h
>> +++ b/fs/resctrl/internal.h
>> @@ -387,6 +387,9 @@ bool closid_allocated(unsigned int closid);
>>  
>>  int resctrl_find_cleanest_closid(void);
>>  
>> +int rdtgroup_assign_cntr_event(struct rdt_mon_domain *d, struct rdtgroup *rdtgrp,
>> +			       struct mon_evt *mevt);
>> +
> 
> This internal.h change does not look necessary? Looking ahead this is because 
> rdtgroup.c:rdtgroup_assign_cntrs() needs it, but rdtgroup_assign_cntrs()
> also belongs in monitor.c, no? 

Yes. Brought rdtgroup_assign_cntrs() in this patch for completeness and
moved everything into monitor.c.

> 
>>  #ifdef CONFIG_RESCTRL_FS_PSEUDO_LOCK
>>  int rdtgroup_locksetup_enter(struct rdtgroup *rdtgrp);
>>  
> 
> ...
> 
>> +/*
>> + * rdtgroup_alloc_assign_cntr() - Allocate a counter ID and assign it to the event
>> + * pointed to by @mevt and the resctrl group @rdtgrp within the domain @d.
>> + *
>> + * Return:
>> + * 0 on success, < 0 on failure.
>> + */
>> +static int rdtgroup_alloc_assign_cntr(struct rdt_resource *r, struct rdt_mon_domain *d,
>> +				      struct rdtgroup *rdtgrp, struct mon_evt *mevt)
>> +{
>> +	int cntr_id;
>> +
>> +	/* No action required if the counter is assigned already. */
>> +	cntr_id = mbm_cntr_get(r, d, rdtgrp, mevt->evtid);
>> +	if (cntr_id >= 0)
>> +		return 0;
>> +
>> +	cntr_id = mbm_cntr_alloc(r, d, rdtgrp, mevt->evtid);
>> +	if (cntr_id <  0) {
> 
> Extra space above.

Sure.

> 
>> +		rdt_last_cmd_printf("Failed to allocate counter for %s in domain %d\n",
>> +				    mevt->name, d->hdr.id);
>> +		return cntr_id;
>> +	}
>> +
>> +	rdtgroup_assign_cntr(r, d, mevt->evtid, rdtgrp->mon.rmid, rdtgrp->closid, cntr_id, true);
>> +
>> +	return 0;
>> +}
>> +
> 
> Reinette
> 

-- 
Thanks
Babu Moger





[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux