lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <b21ebeb7-090a-4c6d-918f-6ce9c5220ae2@amd.com>
Date: Fri, 16 Aug 2024 15:40:06 -0500
From: "Moger, Babu" <babu.moger@....com>
To: James Morse <james.morse@....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, mingo@...hat.com,
 bp@...en8.de, corbet@....net, fenghua.yu@...el.com,
 reinette.chatre@...el.com, tglx@...utronix.de, dave.hansen@...ux.intel.com
Subject: Re: [PATCH v6 20/22] x86/resctrl: Enable AMD ABMC feature by default
 when supported

Hi James,

On 8/16/24 11:32, James Morse wrote:
> Hi Babu,
> 
> On 06/08/2024 23:00, 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.
> 
>> diff --git a/arch/x86/kernel/cpu/resctrl/core.c b/arch/x86/kernel/cpu/resctrl/core.c
>> index 6fb0cfdb5529..a7980f84c487 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_mbm_cntr_assign_configure();
>>  		return;
>>  	}
>>  
>> @@ -620,6 +621,7 @@ static void domain_add_cpu_mon(int cpu, struct rdt_resource *r)
>>  	arch_mon_domain_online(r, d);
>>  
>>  	resctrl_mbm_evt_config_init(hw_dom);
>> +	resctrl_arch_mbm_cntr_assign_configure();
>>  
>>  	if (arch_domain_mbm_alloc(r->mon.num_rmid, hw_dom)) {
>>  		mon_domain_free(hw_dom);
> 
>> diff --git a/arch/x86/kernel/cpu/resctrl/rdtgroup.c b/arch/x86/kernel/cpu/resctrl/rdtgroup.c
>> index 66febff2a3d3..d15fd1bde5f4 100644
>> --- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c
>> +++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c
>> @@ -2756,6 +2756,23 @@ void resctrl_arch_mbm_cntr_assign_disable(void)
>>  	}
>>  }
>>  
>> +void resctrl_arch_mbm_cntr_assign_configure(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);
> 
> As before - this lock isn't available to the architecture code after the filesystem code
> moves to /fs/. To prevent concurrent calls to resctrl_abmc_set_one_amd() I think you need
> your own mutex.

These calls are originated from domain_add_cpu_mon sequence. It holds the
lock already. We should be good. I will remove the lock.

> 
> 
>> +	if (r->mon.mbm_cntr_assignable) {
>> +		if (!hw_res->mbm_cntr_assign_enabled)
>> +			hw_res->mbm_cntr_assign_enabled = true;
>> +		resctrl_abmc_set_one_amd(&enable);
>> +	}
>> +
>> +	mutex_unlock(&rdtgroup_mutex);
>> +}
> 
> Neither of this functions callers are in filesystem code, could you drop the 'arch' from
> the name - it isn't part of the fs/arch interface.

Yes. Sure.

> 
> 
> Thanks,
> 
> James
> 

-- 
Thanks
Babu Moger

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ