lkml.org 
[lkml]   [2015]   [Sep]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH 1/2] KVM: introduce __vmx_flush_tlb to handle specific vpid
From
Date
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


\
 
 \ /
  Last update: 2015-09-25 05:21    [W:0.177 / U:0.164 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site