[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <b4d33443-e7b8-4394-9ac5-dc16115c32f7@intel.com>
Date: Thu, 1 Aug 2024 14:37:09 -0700
From: Reinette Chatre <reinette.chatre@...el.com>
To: <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 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?
Reinette
Powered by blists - more mailing lists