diff mbox

[1/2] KVM: Make paravirt tlb flush also reload PAE PDPTEs

Message ID 1243241244-25953-2-git-send-email-avi@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Avi Kivity May 25, 2009, 8:47 a.m. UTC
The paravirt tlb flush may be used not only to flush TLBs, but also
to reload the four page-directory-pointer-table entries, as it is used
as a replacement for reloading CR3.  Change the code to do the entire
CR3 reloading dance instead of simply flushing the TLB.

Signed-off-by: Avi Kivity <avi@redhat.com>
---
 arch/x86/kvm/mmu.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

Comments

Marcelo Tosatti May 25, 2009, 11:59 a.m. UTC | #1
On Mon, May 25, 2009 at 11:47:23AM +0300, Avi Kivity wrote:
> The paravirt tlb flush may be used not only to flush TLBs, but also
> to reload the four page-directory-pointer-table entries, as it is used
> as a replacement for reloading CR3.  Change the code to do the entire
> CR3 reloading dance instead of simply flushing the TLB.

Ugh, my bad.

ACK.


> 
> Signed-off-by: Avi Kivity <avi@redhat.com>
> ---
>  arch/x86/kvm/mmu.c |    3 +--
>  1 files changed, 1 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c
> index 6880a4c..7030b5f 100644
> --- a/arch/x86/kvm/mmu.c
> +++ b/arch/x86/kvm/mmu.c
> @@ -2927,8 +2927,7 @@ static int kvm_pv_mmu_write(struct kvm_vcpu *vcpu,
>  
>  static int kvm_pv_mmu_flush_tlb(struct kvm_vcpu *vcpu)
>  {
> -	kvm_x86_ops->tlb_flush(vcpu);
> -	set_bit(KVM_REQ_MMU_SYNC, &vcpu->requests);
> +	kvm_set_cr3(vcpu, vcpu->arch.cr3);
>  	return 1;
>  }
>  
> -- 
> 1.6.0.6
--
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
Avi Kivity May 25, 2009, 3:09 p.m. UTC | #2
Marcelo Tosatti wrote:
> On Mon, May 25, 2009 at 11:47:23AM +0300, Avi Kivity wrote:
>   
>> The paravirt tlb flush may be used not only to flush TLBs, but also
>> to reload the four page-directory-pointer-table entries, as it is used
>> as a replacement for reloading CR3.  Change the code to do the entire
>> CR3 reloading dance instead of simply flushing the TLB.
>>     
>
> Ugh, my bad.
>   

Not really -- the pvop is misleadingly named.
diff mbox

Patch

diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c
index 6880a4c..7030b5f 100644
--- a/arch/x86/kvm/mmu.c
+++ b/arch/x86/kvm/mmu.c
@@ -2927,8 +2927,7 @@  static int kvm_pv_mmu_write(struct kvm_vcpu *vcpu,
 
 static int kvm_pv_mmu_flush_tlb(struct kvm_vcpu *vcpu)
 {
-	kvm_x86_ops->tlb_flush(vcpu);
-	set_bit(KVM_REQ_MMU_SYNC, &vcpu->requests);
+	kvm_set_cr3(vcpu, vcpu->arch.cr3);
 	return 1;
 }