[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <fa42b2bd-a20f-aad0-d4fc-8a21649b33a2@amd.com>
Date: Fri, 2 Aug 2024 11:10:50 -0500
From: "Moger, Babu" <bmoger@....com>
To: Reinette Chatre <reinette.chatre@...el.com>, babu.moger@....com,
corbet@....net, fenghua.yu@...el.com, tglx@...utronix.de, mingo@...hat.com,
bp@...en8.de, dave.hansen@...ux.intel.com
Cc: x86@...nel.org, hpa@...or.com, paulmck@...nel.org, rdunlap@...radead.org,
tj@...nel.org, peterz@...radead.org, yanjiewtw@...il.com,
kim.phillips@....com, lukas.bulwahn@...il.com, seanjc@...gle.com,
jmattson@...gle.com, leitao@...ian.org, jpoimboe@...nel.org,
rick.p.edgecombe@...el.com, kirill.shutemov@...ux.intel.com,
jithu.joseph@...el.com, kai.huang@...el.com, kan.liang@...ux.intel.com,
daniel.sneddon@...ux.intel.com, pbonzini@...hat.com, sandipan.das@....com,
ilpo.jarvinen@...ux.intel.com, peternewman@...gle.com,
maciej.wieczor-retman@...el.com, linux-doc@...r.kernel.org,
linux-kernel@...r.kernel.org, eranian@...gle.com, james.morse@....com
Subject: Re: [PATCH v5 19/20] x86/resctrl: Introduce interface to list monitor
states of all the groups
Hi Reinette,
On 8/1/2024 4:37 PM, Reinette Chatre wrote:
> Hi Babu,
>
> On 7/17/24 8:22 AM, Moger, Babu wrote:
>> On 7/12/24 17:16, Reinette Chatre wrote:
>>> On 7/3/24 2:48 PM, Babu Moger wrote:
>
>>>> + */
>>>> + if (rdtgrp->mon.cntr_id[0] != MON_CNTR_UNSET)
>>>> + if (!rdtgroup_abmc_dom_state(d, rdtgrp->mon.cntr_id[0],
>>>> rdtgrp->mon.rmid))
>>>> + dom_state |= ASSIGN_TOTAL;
>>>> +
>>>> + if (rdtgrp->mon.cntr_id[1] != MON_CNTR_UNSET)
>>>> + if (!rdtgroup_abmc_dom_state(d, rdtgrp->mon.cntr_id[1],
>>>> rdtgrp->mon.rmid))
>>>> + dom_state |= ASSIGN_LOCAL;
>>>> +
>>>> + switch (dom_state) {
>>>> + case ASSIGN_NONE:
>>>> + *tmp++ = '_';
>>>> + break;
>>>> + case (ASSIGN_TOTAL | ASSIGN_LOCAL):
>>>> + *tmp++ = 't';
>>>> + *tmp++ = 'l';
>>>> + break;
>>>> + case ASSIGN_TOTAL:
>>>> + *tmp++ = 't';
>>>> + break;
>>>> + case ASSIGN_LOCAL:
>>>> + *tmp++ = 'l';
>>>> + break;
>>>> + default:
>>>> + break;
>>>> + }
>>>
>>> This switch statement does not scale. Adding new flags will be painful.
>>> Can flags not
>>> just incrementally be printed as learned from hardware with "_"
>>> printed as
>>> last resort?
>>> This would elimininate need for these "ASSIGN" flags.
>>
>> Let me try to understand this.
>>
>> You want to remove switch statement.
>>
>> if (rdtgrp->mon.cntr_id[0] != MON_CNTR_UNSET)
>> if (!rdtgroup_abmc_dom_state(d, rdtgrp->mon.cntr_id[0],
>> rdtgrp->mon.rmid))
>> *tmp++ = 't';
>>
>> if (rdtgrp->mon.cntr_id[1] != MON_CNTR_UNSET)
>> if (!rdtgroup_abmc_dom_state(d, rdtgrp->mon.cntr_id[1],
>> rdtgrp->mon.rmid))
>> *tmp++ = 'l';
>>
>> If none of these flags are available, then
>> *tmp++ = '_';
>>
>> Is that the idea?
>
> Indeed. Thank you. Can this be done without hard coding the counter index?
Yes. We can do that.
--
- Babu Moger
Powered by blists - more mailing lists