KVM: SVM: Delay restoration of host MSR_TSC_AUX until return to userspace
authorSean Christopherson <seanjc@google.com>
Fri, 23 Apr 2021 22:34:04 +0000 (15:34 -0700)
committerPaolo Bonzini <pbonzini@redhat.com>
Mon, 26 Apr 2021 09:26:13 +0000 (05:26 -0400)
commit844d69c26d836fde97bf6f38a0a69da9fa42e985
treee4244ad1b8062b3d21afd2337582a3618f54ac3b
parentdbd6127375aacaa1e034e77537aa7373223e276c
KVM: SVM: Delay restoration of host MSR_TSC_AUX until return to userspace

Use KVM's "user return MSRs" framework to defer restoring the host's
MSR_TSC_AUX until the CPU returns to userspace.  Add/improve comments to
clarify why MSR_TSC_AUX is intercepted on both RDMSR and WRMSR, and why
it's safe for KVM to keep the guest's value loaded even if KVM is
scheduled out.

Cc: Reiji Watanabe <reijiw@google.com>
Signed-off-by: Sean Christopherson <seanjc@google.com>
Message-Id: <20210423223404.3860547-5-seanjc@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/svm/svm.c
arch/x86/kvm/svm/svm.h