]> git.baikalelectronics.ru Git - kernel.git/commit
KVM: x86: Avoid guest page table walk when gpa_available is set
authorBrijesh Singh <brijesh.singh@amd.com>
Thu, 17 Aug 2017 16:36:57 +0000 (18:36 +0200)
committerRadim Krčmář <rkrcmar@redhat.com>
Fri, 18 Aug 2017 12:37:49 +0000 (14:37 +0200)
commit7769325665910606ae3db83da434ef740cee5608
tree709c8d0d99cb3bdcd29fcc70f5f01122c58ab686
parent884d1630e72e75524b76ef6fe5e61c66d63b2c4c
KVM: x86: Avoid guest page table walk when gpa_available is set

When a guest causes a page fault which requires emulation, the
vcpu->arch.gpa_available flag is set to indicate that cr2 contains a
valid GPA.

Currently, emulator_read_write_onepage() makes use of gpa_available flag
to avoid a guest page walk for a known MMIO regions. Lets not limit
the gpa_available optimization to just MMIO region. The patch extends
the check to avoid page walk whenever gpa_available flag is set.

Signed-off-by: Brijesh Singh <brijesh.singh@amd.com>
[Fix EPT=0 according to Wanpeng Li's fix, plus ensure VMX also uses the
 new code. - Paolo]
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: David Hildenbrand <david@redhat.com>
[Moved "ret < 0" to the else brach, as per David's review. - Radim]
Signed-off-by: Radim Krčmář <rkrcmar@redhat.com>
arch/x86/include/asm/kvm_host.h
arch/x86/kvm/mmu.c
arch/x86/kvm/svm.c
arch/x86/kvm/vmx.c
arch/x86/kvm/x86.c