kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* KVM: VMX: flush TLB with INVEPT on cpu migration
@ 2009-10-01 22:16 Marcelo Tosatti
  2009-10-02 20:56 ` Ram Pai
  2009-10-21  1:18 ` Max Laier
  0 siblings, 2 replies; 4+ messages in thread
From: Marcelo Tosatti @ 2009-10-01 22:16 UTC (permalink / raw)
  To: kvm; +Cc: Avi Kivity, Yang, Sheng


It is possible that stale EPTP-tagged mappings are used, if a 
vcpu migrates to a different pcpu.

Set KVM_REQ_TLB_FLUSH in vmx_vcpu_load, when switching pcpus, which
will invalidate both VPID and EPT mappings on the next vm-entry.

Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>

diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index e86f1a6..97f4265 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -708,7 +708,7 @@ static void vmx_vcpu_load(struct kvm_vcpu *vcpu, int cpu)
 	if (vcpu->cpu != cpu) {
 		vcpu_clear(vmx);
 		kvm_migrate_timers(vcpu);
-		vpid_sync_vcpu_all(vmx);
+		set_bit(KVM_REQ_TLB_FLUSH, &vcpu->requests);
 		local_irq_disable();
 		list_add(&vmx->local_vcpus_link,
 			 &per_cpu(vcpus_on_cpu, cpu));

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: KVM: VMX: flush TLB with INVEPT on cpu migration
  2009-10-01 22:16 KVM: VMX: flush TLB with INVEPT on cpu migration Marcelo Tosatti
@ 2009-10-02 20:56 ` Ram Pai
  2009-10-21  1:18 ` Max Laier
  1 sibling, 0 replies; 4+ messages in thread
From: Ram Pai @ 2009-10-02 20:56 UTC (permalink / raw)
  To: Marcelo Tosatti; +Cc: kvm, Avi Kivity, Yang, Sheng


On Thu, 2009-10-01 at 19:16 -0300, Marcelo Tosatti wrote:
> It is possible that stale EPTP-tagged mappings are used, if a 
> vcpu migrates to a different pcpu.
> 
> Set KVM_REQ_TLB_FLUSH in vmx_vcpu_load, when switching pcpus, which
> will invalidate both VPID and EPT mappings on the next vm-entry.
> 
> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
> 
> diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
> index e86f1a6..97f4265 100644
> --- a/arch/x86/kvm/vmx.c
> +++ b/arch/x86/kvm/vmx.c
> @@ -708,7 +708,7 @@ static void vmx_vcpu_load(struct kvm_vcpu *vcpu, int cpu)
>  	if (vcpu->cpu != cpu) {
>  		vcpu_clear(vmx);
>  		kvm_migrate_timers(vcpu);
> -		vpid_sync_vcpu_all(vmx);
> +		set_bit(KVM_REQ_TLB_FLUSH, &vcpu->requests);
>  		local_irq_disable();
>  		list_add(&vmx->local_vcpus_link,
>  			 &per_cpu(vcpus_on_cpu, cpu));
> --

This patch fixes my ept misconfig problem seen very so often while
installing sles11 guest.

thanks,
RP

 


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: KVM: VMX: flush TLB with INVEPT on cpu migration
  2009-10-01 22:16 KVM: VMX: flush TLB with INVEPT on cpu migration Marcelo Tosatti
  2009-10-02 20:56 ` Ram Pai
@ 2009-10-21  1:18 ` Max Laier
  2009-10-22 15:10   ` Avi Kivity
  1 sibling, 1 reply; 4+ messages in thread
From: Max Laier @ 2009-10-21  1:18 UTC (permalink / raw)
  To: Marcelo Tosatti, kvm

On Friday 02 October 2009 00:16:58 you wrote:
> It is possible that stale EPTP-tagged mappings are used, if a
> vcpu migrates to a different pcpu.
> 
> Set KVM_REQ_TLB_FLUSH in vmx_vcpu_load, when switching pcpus, which
> will invalidate both VPID and EPT mappings on the next vm-entry.

Thank you - I was at the brink of a nervous break-down before discovering 
this.  Maybe it would help for the future to add a comment to 
ept_misconfig_inspect_spte that explains that this might be caused by out of 
sync tlbs, too (esp. when it doesn't show an apparent cause of the misconfig)

> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
> 
> diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
> index e86f1a6..97f4265 100644
> --- a/arch/x86/kvm/vmx.c
> +++ b/arch/x86/kvm/vmx.c
> @@ -708,7 +708,7 @@ static void vmx_vcpu_load(struct kvm_vcpu *vcpu, int
>  cpu) if (vcpu->cpu != cpu) {
>  		vcpu_clear(vmx);
>  		kvm_migrate_timers(vcpu);
> -		vpid_sync_vcpu_all(vmx);
> +		set_bit(KVM_REQ_TLB_FLUSH, &vcpu->requests);
>  		local_irq_disable();
>  		list_add(&vmx->local_vcpus_link,
>  			 &per_cpu(vcpus_on_cpu, cpu));
> --
> To unsubscribe from this list: send the line "unsubscribe kvm" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 
> 
> !DSPAM:4ac52dbb832371894110002!
> 

-- 
/"\  Best regards,                      | mlaier@freebsd.org
\ /  Max Laier                          | ICQ #67774661
 X   http://pf4freebsd.love2party.net/  | mlaier@EFnet
/ \  ASCII Ribbon Campaign              | Against HTML Mail and News

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: KVM: VMX: flush TLB with INVEPT on cpu migration
  2009-10-21  1:18 ` Max Laier
@ 2009-10-22 15:10   ` Avi Kivity
  0 siblings, 0 replies; 4+ messages in thread
From: Avi Kivity @ 2009-10-22 15:10 UTC (permalink / raw)
  To: Max Laier; +Cc: Marcelo Tosatti, kvm

On 10/21/2009 03:18 AM, Max Laier wrote:
> On Friday 02 October 2009 00:16:58 you wrote:
>    
>> It is possible that stale EPTP-tagged mappings are used, if a
>> vcpu migrates to a different pcpu.
>>
>> Set KVM_REQ_TLB_FLUSH in vmx_vcpu_load, when switching pcpus, which
>> will invalidate both VPID and EPT mappings on the next vm-entry.
>>      
> Thank you - I was at the brink of a nervous break-down before discovering
> this.  Maybe it would help for the future to add a comment to
> ept_misconfig_inspect_spte that explains that this might be caused by out of
> sync tlbs, too (esp. when it doesn't show an apparent cause of the misconfig)
>    

In fact ept_misconfig_inspect_spte() was added in order to track down 
this bug, so it will probably be removed in the future.

-- 
error compiling committee.c: too many arguments to function


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2009-10-22 15:10 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-10-01 22:16 KVM: VMX: flush TLB with INVEPT on cpu migration Marcelo Tosatti
2009-10-02 20:56 ` Ram Pai
2009-10-21  1:18 ` Max Laier
2009-10-22 15:10   ` Avi Kivity

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).