[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <b8ea0a74-347d-475f-a36d-8944ced16951@amd.com>
Date: Wed, 25 Oct 2023 15:42:14 -0500
From: "Moger, Babu" <babu.moger@....com>
To: Tony Luck <tony.luck@...el.com>,
Peter Newman <peternewman@...gle.com>
Cc: Fenghua Yu <fenghua.yu@...el.com>,
Reinette Chatre <reinette.chatre@...el.com>,
Jonathan Corbet <corbet@....net>,
Shuah Khan <skhan@...uxfoundation.org>, x86@...nel.org,
Shaopeng Tan <tan.shaopeng@...itsu.com>,
James Morse <james.morse@....com>,
Jamie Iles <quic_jiles@...cinc.com>,
Randy Dunlap <rdunlap@...radead.org>,
linux-kernel@...r.kernel.org, linux-doc@...r.kernel.org,
patches@...ts.linux.dev
Subject: Re: [PATCH] x86/resctrl: mba_MBps: Fall back to total b/w if local
b/w unavailable
Tony,
On 10/25/23 15:39, Moger, Babu wrote:
> Hi Tony,
>
> On 10/25/23 14:38, Tony Luck wrote:
>> On Wed, Oct 25, 2023 at 02:46:53PM +0200, Peter Newman wrote:
>>> Hi Tony,
>>>
>>> On Tue, Oct 24, 2023 at 8:16 PM Tony Luck <tony.luck@...el.com> wrote:
>>>> --- a/arch/x86/kernel/cpu/resctrl/monitor.c
>>>> +++ b/arch/x86/kernel/cpu/resctrl/monitor.c
>>>> @@ -418,6 +418,14 @@ static int __mon_event_count(u32 rmid, struct rmid_read *rr)
>>>> return 0;
>>>> }
>>>>
>>>> +static struct mbm_state *get_mbm_data(struct rdt_domain *dom_mbm, int rmid)
>>>> +{
>>>> + if (is_mbm_local_enabled())
>>>> + return &dom_mbm->mbm_local[rmid];
>>>> +
>>>> + return &dom_mbm->mbm_total[rmid];
>>>> +}
>>>
>>> That looks very similar to the get_mbm_state() function I added to
>>> this same file recently:
>>>
>>> https://lore.kernel.org/all/20221220164132.443083-2-peternewman%40google.com
>>>
>>> I think the name you picked is misleadingly general. "local if
>>> available, otherwise total" seems to be a choice specific to the mbps
>>> controller. I think these functions should be reconciled a little
>>> better.
>>>
>>
>> Peter (and Babu, who made the same point about get_mbm_state().
>>
>> Do you want to see your function extended to do the "pick an MBM event?"
>>
>> I could add a s/w defined "event" to the enum resctrl_event_id and
>> extend get_mbm_state() like this:
>>
>>
>> static struct mbm_state *get_mbm_state(struct rdt_domain *d, u32 rmid,
>> enum resctrl_event_id evtid)
>> {
>> switch (evtid) {
>> case QOS_L3_MBM_TOTAL_EVENT_ID:
>> return &d->mbm_total[rmid];
>> case QOS_L3_MBM_LOCAL_EVENT_ID:
>> return &d->mbm_local[rmid];
>> + case QOS_L3_MBM_LOCAL_OR_TOTAL_EVENT_ID:
>> + if (is_mbm_local_enabled())
>> + return &d->mbm_local[rmid];
>> + if (is_mbm_total_enabled())
>> + return &d->mbm_total[rmid];
>> + fallthrough;
>> default:
>> return NULL;
>> }
>> }
>>
>> Is this the direction you are thinking of?
>
> No. I was not thinking bit different.
I meant, I was thinking bit different.
>
> You need these changes in only two functions, mbm_bw_count and
> update_mba_bw. You decide which event you want to use based on availability,
>
> Something like this. I updated mbm_bw_count.
>
> diff --git a/arch/x86/kernel/cpu/resctrl/monitor.c
> b/arch/x86/kernel/cpu/resctrl/monitor.c
> index 0ad23475fe16..302993e4fbc3 100644
> --- a/arch/x86/kernel/cpu/resctrl/monitor.c
> +++ b/arch/x86/kernel/cpu/resctrl/monitor.c
> @@ -436,8 +436,16 @@ static int __mon_event_count(u32 rmid, struct
> rmid_read *rr)
> */
> static void mbm_bw_count(u32 rmid, struct rmid_read *rr)
> {
> - struct mbm_state *m = &rr->d->mbm_local[rmid];
> u64 cur_bw, bytes, cur_bytes;
> + struct mbm_state *m;
> + int evtid;
> +
> + if (is_mbm_local_enabled())
> + evtid = QOS_L3_MBM_LOCAL_EVENT_ID;
> + else
> + evtid = QOS_L3_MBM_TOTAL_EVENT_ID;
> +
> + m = get_mbm_state(rr->d, rmid, evtid);
>
> cur_bytes = rr->val;
> bytes = cur_bytes - m->prev_bw_bytes;
>
>
> Will this work?
>
> Thanks
> Babu
>
>
>>
>> Callers then look like:
>>
>> static void mbm_bw_count(u32 rmid, struct rmid_read *rr)
>> {
>> struct mbm_state *m = get_mbm_state(rr->d, rmid, QOS_L3_MBM_LOCAL_OR_TOTAL_EVENT_ID);
>> u64 cur_bw, bytes, cur_bytes;
>>
>> similar for the other three places where this is needed.
>>
>> Any suggestions on how "QOS_L3_MBM_LOCAL_OR_TOTAL_EVENT_ID" could be
>> abbreviated, or just have some different, but descriptive, name?
>>
>> -Tony
>
--
Thanks
Babu Moger
Powered by blists - more mailing lists