[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aaab030c-29ca-4aae-b821-dd8fbb2fe5a8@amd.com>
Date: Thu, 7 Aug 2025 13:29:43 -0500
From: "Moger, Babu" <babu.moger@....com>
To: Reinette Chatre <reinette.chatre@...el.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 v16 17/34] fs/resctrl: Add the functionality to assign MBM
events
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@....com>
>> ---
>
> ...
>
>> ---
>> 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
Powered by blists - more mailing lists