[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210105143749.557054-1-michael.roth@amd.com>
Date: Tue, 5 Jan 2021 08:37:47 -0600
From: Michael Roth <michael.roth@....com>
To: kvm@...r.kernel.org
Cc: Paolo Bonzini <pbonzini@...hat.com>,
Sean Christopherson <seanjc@...gle.com>,
Andy Lutomirski <luto@...capital.net>,
Vitaly Kuznetsov <vkuznets@...hat.com>,
Wanpeng Li <wanpengli@...cent.com>,
Jim Mattson <jmattson@...gle.com>,
Joerg Roedel <joro@...tes.org>,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
x86@...nel.org, "H . Peter Anvin" <hpa@...or.com>,
linux-kernel@...r.kernel.org
Subject: [PATCH 0/3] KVM: SVM: Refactor vcpu_load/put to use vmload/vmsave for host state
This series re-works the SVM KVM implementation to use vmload/vmsave to
handle saving/restoring additional host MSRs rather than explicit MSR
read/writes, resulting in a significant performance improvement for some
specific workloads and simplifying some of the save/load code (PATCH 1).
With those changes some commonalities emerge between SEV-ES and normal
vcpu_load/vcpu_put paths, which we then take advantage of to share more code,
as well as refactor them in a way that more closely aligns with the VMX
implementation (PATCH 2 and 3).
v3:
- rebased on kvm-next
- remove uneeded braces from host MSR save/load loops (Sean)
- use page_to_phys() in place of page_to_pfn() and shifting (Sean)
- use stack instead of struct field to cache host save area outside of
per-cpu storage, and pass as an argument to __svm_vcpu_run() to
handle the VMLOAD in ASM code rather than inlining ASM (Sean/Andy)
- remove now-uneeded index/sev_es_restored fields from
host_save_user_msrs list
- move host-saving/guest-loading of registers to prepare_guest_switch(),
and host-loading of registers to prepare_host_switch, for both normal
and sev-es paths (Sean)
v2:
- rebase on latest kvm/next
- move VMLOAD to just after vmexit so we can use it to handle all FS/GS
host state restoration and rather than relying on loadsegment() and
explicit write to MSR_GS_BASE (Andy)
- drop 'host' field from struct vcpu_svm since it is no longer needed
for storing FS/GS/LDT state (Andy)
arch/x86/kvm/svm/sev.c | 30 +-----------------------------
arch/x86/kvm/svm/svm.c | 112 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------------------------------------------------------
arch/x86/kvm/svm/svm.h | 31 ++++++-------------------------
arch/x86/kvm/svm/vmenter.S | 10 ++++++++++
4 files changed, 75 insertions(+), 108 deletions(-)
Powered by blists - more mailing lists