]> git.baikalelectronics.ru Git - kernel.git/commit
KVM: x86: SVM: don't set VMLOAD/VMSAVE intercepts on vCPU reset
authorPaolo Bonzini <pbonzini@redhat.com>
Thu, 23 Sep 2021 16:46:07 +0000 (12:46 -0400)
committerPaolo Bonzini <pbonzini@redhat.com>
Fri, 1 Oct 2021 07:37:34 +0000 (03:37 -0400)
commit96b4593f37ca276212b6f9996baffd3bd1b7f2ee
tree106f72aeb5c1e2e53bfa5243e87bacb17afc9d47
parent8bd48662495b5ffd87d2132d9ced11770603314b
KVM: x86: SVM: don't set VMLOAD/VMSAVE intercepts on vCPU reset

Commit 69055e5a91f4 ("KVM: nSVM: improve SYSENTER emulation on AMD"),
made init_vmcb set vmload/vmsave intercepts unconditionally,
and relied on svm_vcpu_after_set_cpuid to clear them when possible.

However init_vmcb is also called when the vCPU is reset, and it is
not followed by another call to svm_vcpu_after_set_cpuid because
the CPUID is already set.  This mistake makes the VMSAVE/VMLOAD intercept
to be set when it is not needed, and harms performance of the nested
guest.

Extract the relevant parts of svm_vcpu_after_set_cpuid so that they
can be called again on reset.

Fixes: 69055e5a91f4 ("KVM: nSVM: improve SYSENTER emulation on AMD")
Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/svm/svm.c