summaryrefslogtreecommitdiffstats
path: root/arch/x86/kvm/x86.c
diff options
context:
space:
mode:
authorEugene Korenevsky2015-03-29 22:56:12 +0200
committerPaolo Bonzini2015-04-08 10:46:56 +0200
commit5a4f55cde81f1633cb7ae9f0963b722e47acdc36 (patch)
tree8350e79b1b046374a5b4658dc498a3f8b1e8b8f5 /arch/x86/kvm/x86.c
parentKVM: vmx: pass error code with internal error #2 (diff)
downloadkernel-qcow2-linux-5a4f55cde81f1633cb7ae9f0963b722e47acdc36.tar.gz
kernel-qcow2-linux-5a4f55cde81f1633cb7ae9f0963b722e47acdc36.tar.xz
kernel-qcow2-linux-5a4f55cde81f1633cb7ae9f0963b722e47acdc36.zip
KVM: x86: cache maxphyaddr CPUID leaf in struct kvm_vcpu
cpuid_maxphyaddr(), which performs lot of memory accesses is called extensively across KVM, especially in nVMX code. This patch adds a cached value of maxphyaddr to vcpu.arch to reduce the pressure onto CPU cache and simplify the code of cpuid_maxphyaddr() callers. The cached value is initialized in kvm_arch_vcpu_init() and reloaded every time CPUID is updated by usermode. It is obvious that these reloads occur infrequently. Signed-off-by: Eugene Korenevsky <ekorenevsky@gmail.com> Message-Id: <20150329205612.GA1223@gnote> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'arch/x86/kvm/x86.c')
-rw-r--r--arch/x86/kvm/x86.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 50861dd15a94..a578629acb42 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -7317,6 +7317,8 @@ int kvm_arch_vcpu_init(struct kvm_vcpu *vcpu)
vcpu->arch.guest_supported_xcr0 = 0;
vcpu->arch.guest_xstate_size = XSAVE_HDR_SIZE + XSAVE_HDR_OFFSET;
+ vcpu->arch.maxphyaddr = cpuid_query_maxphyaddr(vcpu);
+
kvm_async_pf_hash_reset(vcpu);
kvm_pmu_init(vcpu);