Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1225870

Re: [PATCH v4 1/2] KVM: nVMX: enhance allocate/free_vpid to handle shadow vpid

From Wanpeng Li <wanpeng.li@hotmail.com>
Newsgroups linux.kernel
Subject Re: [PATCH v4 1/2] KVM: nVMX: enhance allocate/free_vpid to handle shadow vpid
Date 2015-09-16 11:20 +0200
Message-ID <q9h2G-7W-21@gated-at.bofh.it> (permalink)
References <q9fke-63y-19@gated-at.bofh.it> <q9fke-63y-31@gated-at.bofh.it> <q9h2G-7W-7@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On 9/16/15 5:11 PM, Jan Kiszka wrote:
> On 2015-09-16 09:19, Wanpeng Li wrote:
>> Enhance allocate/free_vid to handle shadow vpid.
>>
>> Signed-off-by: Wanpeng Li <wanpeng.li@hotmail.com>
>> ---
>>   arch/x86/kvm/vmx.c | 23 +++++++++++------------
>>   1 file changed, 11 insertions(+), 12 deletions(-)
>>
>> diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
>> index 9ff6a3f..c5222b8 100644
>> --- a/arch/x86/kvm/vmx.c
>> +++ b/arch/x86/kvm/vmx.c
>> @@ -4155,29 +4155,28 @@ static int alloc_identity_pagetable(struct kvm *kvm)
>>   	return r;
>>   }
>>   
>> -static void allocate_vpid(struct vcpu_vmx *vmx)
>> +static int allocate_vpid(void)
>>   {
>>   	int vpid;
>>   
>> -	vmx->vpid = 0;
>>   	if (!enable_vpid)
>> -		return;
>> +		return 0;
>>   	spin_lock(&vmx_vpid_lock);
>>   	vpid = find_first_zero_bit(vmx_vpid_bitmap, VMX_NR_VPIDS);
>> -	if (vpid < VMX_NR_VPIDS) {
>> -		vmx->vpid = vpid;
>> +	if (vpid < VMX_NR_VPIDS)
>>   		__set_bit(vpid, vmx_vpid_bitmap);
>> -	}
>> +	else
>> +		vpid = 0;
>>   	spin_unlock(&vmx_vpid_lock);
>> +	return vpid;
>>   }
>>   
>> -static void free_vpid(struct vcpu_vmx *vmx)
>> +static void free_vpid(int vpid)
>>   {
>>   	if (!enable_vpid)
> || vpid == 0
>
> Otherwise you clear bit zero and cause the next allocate_vpid return 0 -
> from the bitmap.

Will do, thanks. :-)

Regards,
Wanpeng Li
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

[PATCH v4 1/2] KVM: nVMX: enhance allocate/free_vpid to handle shadow vpid Wanpeng Li <wanpeng.li@hotmail.com> - 2015-09-16 09:30 +0200
  Re: [PATCH v4 1/2] KVM: nVMX: enhance allocate/free_vpid to handle  shadow vpid Jan Kiszka <jan.kiszka@siemens.com> - 2015-09-16 11:20 +0200
    Re: [PATCH v4 1/2] KVM: nVMX: enhance allocate/free_vpid to handle  shadow vpid Wanpeng Li <wanpeng.li@hotmail.com> - 2015-09-16 11:20 +0200

csiph-web