[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <156f0807-964a-4980-8ad8-aa6735f9ffb6@intel.com>
Date: Thu, 1 Aug 2024 14:40:17 -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 18/20] x86/resctrl: Enable AMD ABMC feature by default
when supported
Hi Babu,
On 7/25/24 5:16 PM, Moger, Babu wrote:
> Hi Reinette,
>
> On 7/16/2024 6:23 PM, Moger, Babu wrote:
>> Hi Reinette,
>>
>> On 7/12/2024 5:15 PM, Reinette Chatre wrote:
>>> Hi Babu,
>>>
>>> On 7/3/24 2:48 PM, Babu Moger wrote:
>>>> Enable ABMC by default when supported during the boot up.
>>>>
>>>> Users will not see any difference in the behavior when resctrl is
>>>> mounted. With automatic assignment everything will work as running
>>>> in the legacy monitor mode.
>>>>
>>>> Signed-off-by: Babu Moger <babu.moger@....com>
>>>> ---
>>>> v5: New patch to enable ABMC by default.
>>>> ---
>>>> arch/x86/kernel/cpu/resctrl/core.c | 2 ++
>>>> arch/x86/kernel/cpu/resctrl/internal.h | 1 +
>>>> arch/x86/kernel/cpu/resctrl/rdtgroup.c | 17 +++++++++++++++++
>>>> 3 files changed, 20 insertions(+)
>>>>
>>>> diff --git a/arch/x86/kernel/cpu/resctrl/core.c b/arch/x86/kernel/cpu/resctrl/core.c
>>>> index 6265ef8b610f..b69b2650bde3 100644
>>>> --- a/arch/x86/kernel/cpu/resctrl/core.c
>>>> +++ b/arch/x86/kernel/cpu/resctrl/core.c
>>>> @@ -599,6 +599,7 @@ static void domain_add_cpu_mon(int cpu, struct rdt_resource *r)
>>>> d = container_of(hdr, struct rdt_mon_domain, hdr);
>>>> cpumask_set_cpu(cpu, &d->hdr.cpu_mask);
>>>> + resctrl_arch_configure_abmc();
>>>> return;
>>>> }
>>>> @@ -620,6 +621,7 @@ static void domain_add_cpu_mon(int cpu, struct rdt_resource *r)
>>>> arch_mon_domain_online(r, d);
>>>> resctrl_arch_mbm_evt_config(hw_dom);
>>>> + resctrl_arch_configure_abmc();
>>>> if (arch_domain_mbm_alloc(r->mon.num_rmid, hw_dom)) {
>>>> mon_domain_free(hw_dom);
>>>> diff --git a/arch/x86/kernel/cpu/resctrl/internal.h b/arch/x86/kernel/cpu/resctrl/internal.h
>>>> index beb005775fe4..0f858cff8ab1 100644
>>>> --- a/arch/x86/kernel/cpu/resctrl/internal.h
>>>> +++ b/arch/x86/kernel/cpu/resctrl/internal.h
>>>> @@ -707,6 +707,7 @@ void rdt_domain_reconfigure_cdp(struct rdt_resource *r);
>>>> void __init resctrl_file_fflags_init(const char *config,
>>>> unsigned long fflags);
>>>> void resctrl_arch_mbm_evt_config(struct rdt_hw_mon_domain *hw_dom);
>>>> +void resctrl_arch_configure_abmc(void);
>>>> unsigned int mon_event_config_index_get(u32 evtid);
>>>> int resctrl_arch_assign_cntr(struct rdt_mon_domain *d, u32 evtid, u32 rmid,
>>>> u32 cntr_id, u32 closid, bool enable);
>>>> diff --git a/arch/x86/kernel/cpu/resctrl/rdtgroup.c b/arch/x86/kernel/cpu/resctrl/rdtgroup.c
>>>> index 531233779f8d..d978668c8865 100644
>>>> --- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c
>>>> +++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c
>>>> @@ -2733,6 +2733,23 @@ void resctrl_arch_abmc_disable(void)
>>>> }
>>>> }
>>>> +void resctrl_arch_configure_abmc(void)
>>>> +{
>>>> + struct rdt_resource *r = &rdt_resources_all[RDT_RESOURCE_L3].r_resctrl;
>>>> + struct rdt_hw_resource *hw_res = resctrl_to_arch_res(r);
>>>> + bool enable = true;
>>>> +
>>>> + mutex_lock(&rdtgroup_mutex);
>>>> +
>>>> + if (r->mon.abmc_capable) {
>>>> + if (!hw_res->abmc_enabled)
>>>> + hw_res->abmc_enabled = true;
>>>> + resctrl_abmc_set_one_amd(&enable);
>>>> + }
>>>
>>> This does not look right. It is not architecture code that needs to
>>> decide if this feature is enabled or not, right? The feature is enabled
>>> via fs (for example when user writes to mbm_mode). If the default is
>>> enabled then it should be set by fs. resctrl_arch_configure_abmc()
>>> then checks if feature is capable and enabled before it configures
>>> it on the CPU.
>
> Looking at the code again, I think it is fine to do it here. This is arch initialization code. I am checking if the feature is available and enable it by default. The fs code is not initialized yet at this stage.
>
> Other option is to move everything to rdt_enable_ctx which is during the mount time.
>
> I will keep it as is now. We can discuss more on this in v6.
I will take a look at v6. At this time I do still believe that this should be
controlled only by fs code.
Reinette
Powered by blists - more mailing lists