Re: [PATCH] do not call gva_to_gpa on physical address

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 07/14/2010 06:38 PM, Gleb Natapov wrote:
When tdp is enabled cr2 passed to emulator is pga not gva, so no need to
call gva_to_gpa on it.

Signed-off-by: Gleb Natapov<gleb@xxxxxxxxxx>
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index fb08316..721bf0a 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -3944,10 +3944,13 @@ static bool reexecute_instruction(struct kvm_vcpu *vcpu, gva_t gva)
  	if (kvm_mmu_unprotect_page_virt(vcpu, gva))
  		return true;

-	gpa = kvm_mmu_gva_to_gpa_system(vcpu, gva, NULL);
+	if (!tdp_enabled) {
+		gpa = kvm_mmu_gva_to_gpa_system(vcpu, gva, NULL);

-	if (gpa == UNMAPPED_GVA)
-		return true; /* let cpu generate fault */
+		if (gpa == UNMAPPED_GVA)
+			return true; /* let cpu generate fault */
+	} else
+		gpa = gva;

  	if (!kvm_is_error_hva(gfn_to_hva(vcpu->kvm, gpa>>  PAGE_SHIFT)))
  		return true;

Why not

    if (tdp_enabled)
              return false;

at the top? Is there any reason ever to reexecute an instruction with tdp enabled?

--
I have a truly marvellous patch that fixes the bug which this
signature is too narrow to contain.

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux