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


Groups > linux.kernel > #1232544

Re: [PATCH 1/2] KVM: introduce __vmx_flush_tlb to handle specific vpid

From Wanpeng Li <wanpeng.li@hotmail.com>
Newsgroups linux.kernel
Subject Re: [PATCH 1/2] KVM: introduce __vmx_flush_tlb to handle specific vpid
Date 2015-09-25 05:10 +0200
Message-ID <qcryx-5S8-3@gated-at.bofh.it> (permalink)
References <qbPtg-1lx-31@gated-at.bofh.it> <qchpw-8a5-15@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On 9/25/15 12:12 AM, Bandan Das wrote:
> Wanpeng Li <wanpeng.li@hotmail.com> writes:
>
>> Introduce __vmx_flush_tlb() to handle specific vpid.
>>
>> Signed-off-by: Wanpeng Li <wanpeng.li@hotmail.com>
>> ---
>>   arch/x86/kvm/vmx.c | 21 +++++++++++++--------
>>   1 file changed, 13 insertions(+), 8 deletions(-)
>>
>> diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
>> index 794c529..7188c5e 100644
>> --- a/arch/x86/kvm/vmx.c
>> +++ b/arch/x86/kvm/vmx.c
>> @@ -1343,13 +1343,13 @@ static void loaded_vmcs_clear(struct loaded_vmcs *loaded_vmcs)
>>   			 __loaded_vmcs_clear, loaded_vmcs, 1);
>>   }
>>   
>> -static inline void vpid_sync_vcpu_single(struct vcpu_vmx *vmx)
>> +static inline void vpid_sync_vcpu_single(int vpid)
>>   {
>> -	if (vmx->vpid == 0)
>> +	if (vpid == 0)
>>   		return;
>>   
>>   	if (cpu_has_vmx_invvpid_single())
>> -		__invvpid(VMX_VPID_EXTENT_SINGLE_CONTEXT, vmx->vpid, 0);
>> +		__invvpid(VMX_VPID_EXTENT_SINGLE_CONTEXT, vpid, 0);
>>   }
>>   
>>   static inline void vpid_sync_vcpu_global(void)
>> @@ -1358,10 +1358,10 @@ static inline void vpid_sync_vcpu_global(void)
>>   		__invvpid(VMX_VPID_EXTENT_ALL_CONTEXT, 0, 0);
>>   }
>>   
>> -static inline void vpid_sync_context(struct vcpu_vmx *vmx)
>> +static inline void vpid_sync_context(int vpid)
>>   {
>>   	if (cpu_has_vmx_invvpid_single())
>> -		vpid_sync_vcpu_single(vmx);
>> +		vpid_sync_vcpu_single(vpid);
>>   	else
>>   		vpid_sync_vcpu_global();
>>   }
> Not sure myself what's the right thing to do but this may be undesirable
> in a nested environment. Assuming the processor supports global invalidation
> only, this seems like a easy way for the nested guest to invalidate *all*
> mappings - even the L1 specific mappings.

Indeed, however, there's no easy way to handle the w/o single 
invalidation case, we can improve it if you have any idea, otherwise, it 
can be left to further optimization. :-)

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 | Next in thread | Find similar | Unroll thread


Thread

[PATCH 1/2] KVM: introduce __vmx_flush_tlb to handle specific vpid Wanpeng Li <wanpeng.li@hotmail.com> - 2015-09-23 12:30 +0200
  Re: [PATCH 1/2] KVM: introduce __vmx_flush_tlb to handle specific vpid Bandan Das <bsd@redhat.com> - 2015-09-24 18:20 +0200
    Re: [PATCH 1/2] KVM: introduce __vmx_flush_tlb to handle specific  vpid Wanpeng Li <wanpeng.li@hotmail.com> - 2015-09-25 05:10 +0200
    Re: [PATCH 1/2] KVM: introduce __vmx_flush_tlb to handle specific  vpid Paolo Bonzini <pbonzini@redhat.com> - 2015-09-25 10:10 +0200

csiph-web