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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Thu, 4 Apr 2024 14:24:56 +1300
From: "Huang, Kai" <kai.huang@...el.com>
To: Chao Gao <chao.gao@...el.com>
CC: "Yamahata, Isaku" <isaku.yamahata@...el.com>, "kvm@...r.kernel.org"
	<kvm@...r.kernel.org>, "linux-kernel@...r.kernel.org"
	<linux-kernel@...r.kernel.org>, "isaku.yamahata@...il.com"
	<isaku.yamahata@...il.com>, Paolo Bonzini <pbonzini@...hat.com>, "Aktas,
 Erdem" <erdemaktas@...gle.com>, Sean Christopherson <seanjc@...gle.com>,
	"Sagi Shahar" <sagis@...gle.com>, "Chen, Bo2" <chen.bo@...el.com>, "Yuan,
 Hang" <hang.yuan@...el.com>, "Zhang, Tina" <tina.zhang@...el.com>, "Sean
 Christopherson" <sean.j.christopherson@...el.com>,
	"isaku.yamahata@...ux.intel.com" <isaku.yamahata@...ux.intel.com>
Subject: Re: [PATCH v19 038/130] KVM: TDX: create/destroy VM structure



On 4/04/2024 2:03 pm, Chao Gao wrote:
> On Thu, Apr 04, 2024 at 11:13:49AM +1300, Huang, Kai wrote:
>>
>>
>> On 22/03/2024 3:17 am, Yamahata, Isaku wrote:
>>>>> +
>>>>> +	for_each_online_cpu(i) {
>>>>> +		int pkg = topology_physical_package_id(i);
>>>>> +
>>>>> +		if (cpumask_test_and_set_cpu(pkg, packages))
>>>>> +			continue;
>>>>> +
>>>>> +		/*
>>>>> +		 * Program the memory controller in the package with an
>>>>> +		 * encryption key associated to a TDX private host key id
>>>>> +		 * assigned to this TDR.  Concurrent operations on same memory
>>>>> +		 * controller results in TDX_OPERAND_BUSY.  Avoid this race by
>>>>> +		 * mutex.
>>>>> +		 */
>>>>> +		mutex_lock(&tdx_mng_key_config_lock[pkg]);
>>>> the lock is superfluous to me. with cpu lock held, even if multiple CPUs try to
>>>> create TDs, the same set of CPUs (the first online CPU of each package) will be
>>>> selected to configure the key because of the cpumask_test_and_set_cpu() above.
>>>> it means, we never have two CPUs in the same socket trying to program the key,
>>>> i.e., no concurrent calls.
>>> Makes sense. Will drop the lock.
>>
>> Hmm.. Skipping in cpumask_test_and_set_cpu() would result in the second
>> TDH.MNG.KEY.CONFIG not being done for the second VM.  No?
> 
> No. Because @packages isn't shared between VMs.

I see.  Thanks.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ