[PATCH v4 1/3] KVM: SVM: use vmsave/vmload for saving/restoring additional host state

2021-02-02 Thread Michael Roth
] AMD64 Architecture Programmer's Manual, Rev 3.31, Volume 3, Chapter 4, VMSAVE/VMLOAD [3] Secure Virtual Machine Architecture Reference Manual, Rev 3.01 Suggested-by: Tom Lendacky Signed-off-by: Michael Roth --- arch/x86/kvm/svm/svm.c | 31 +-- arch/x86/kvm/svm

[PATCH v4 2/3] KVM: SVM: remove uneeded fields from host_save_users_msrs

2021-02-02 Thread Michael Roth
-by: Michael Roth --- arch/x86/kvm/svm/sev.c | 16 arch/x86/kvm/svm/svm.c | 6 ++ arch/x86/kvm/svm/svm.h | 7 ++- 3 files changed, 8 insertions(+), 21 deletions(-) diff --git a/arch/x86/kvm/svm/sev.c b/arch/x86/kvm/svm/sev.c index a3e2b29f484d..87167ef8ca23 100644 --- a/arch

[PATCH v4 3/3] KVM: SVM: use .prepare_guest_switch() to handle CPU register save/setup

2021-02-02 Thread Michael Roth
for the VMX implementation. Additionally, since handling of saving/restoring host user MSRs is the same both with/without SEV-ES enabled, move that handling to common code. Suggested-by: Sean Christopherson Signed-off-by: Michael Roth --- arch/x86/kvm/svm/sev.c | 22 +--- arch/x86/kvm/svm

[PATCH v4 0/3] KVM: SVM: Refactor vcpu_load/put to use vmload/vmsave for host state

2021-02-02 Thread Michael Roth
Hi Sean, Paolo, Following up from previous v3 discussion: https://lore.kernel.org/kvm/x%2fsfw15owarse...@google.com/ I got bit in internal testing by a bug in v3 of this series that Sean had already pointed out in v3 comments, so I thought it might be good to go ahead and send a v4 with those

[PATCH] KVM: x86: fix CPUID entries returned by KVM_GET_CPUID2 ioctl

2021-01-27 Thread Michael Roth
;) Cc: Vitaly Kuznetsov Signed-off-by: Michael Roth --- arch/x86/kvm/cpuid.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/kvm/cpuid.c b/arch/x86/kvm/cpuid.c index 13036cf0b912..38172ca627d3 100644 --- a/arch/x86/kvm/cpuid.c +++ b/arch/x86/kvm/cpuid.c @@ -321,7

Re: [PATCH v3 1/3] KVM: SVM: use vmsave/vmload for saving/restoring additional host state

2021-01-07 Thread Michael Roth
On Tue, Jan 05, 2021 at 09:20:03AM -0800, Sean Christopherson wrote: > On Tue, Jan 05, 2021, Michael Roth wrote: > > @@ -3703,16 +3688,9 @@ static noinstr void svm_vcpu_enter_exit(struct > > kvm_vcpu *vcpu, > > if (sev_es_guest(svm->vcpu.kvm)) { > >

[PATCH v3 2/3] KVM: SVM: remove uneeded fields from host_save_users_msrs

2021-01-05 Thread Michael Roth
-by: Michael Roth --- arch/x86/kvm/svm/sev.c | 16 arch/x86/kvm/svm/svm.c | 6 ++ arch/x86/kvm/svm/svm.h | 7 ++- 3 files changed, 8 insertions(+), 21 deletions(-) diff --git a/arch/x86/kvm/svm/sev.c b/arch/x86/kvm/svm/sev.c index e57847ff8bd2..2a93b63322f4 100644 --- a/arch

[PATCH v3 3/3] KVM: SVM: use .prepare_guest_switch() to handle CPU register save/setup

2021-01-05 Thread Michael Roth
for the VMX implementation. Additionally, since handling of saving/restoring host user MSRs is the same both with/without SEV-ES enabled, move that handling to common code. Suggested-by: Sean Christopherson Signed-off-by: Michael Roth --- arch/x86/kvm/svm/sev.c | 22 +--- arch/x86/kvm/svm

[PATCH v3 1/3] KVM: SVM: use vmsave/vmload for saving/restoring additional host state

2021-01-05 Thread Michael Roth
] AMD64 Architecture Programmer's Manual, Rev 3.31, Volume 3, Chapter 4, VMSAVE/VMLOAD [3] Secure Virtual Machine Architecture Reference Manual, Rev 3.01 Suggested-by: Tom Lendacky Signed-off-by: Michael Roth --- arch/x86/kvm/svm/svm.c | 36 +++- arch/x86/kvm

[PATCH 0/3] KVM: SVM: Refactor vcpu_load/put to use vmload/vmsave for host state

2021-01-05 Thread Michael Roth
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

Re: [PATCH v2] KVM: SVM: use vmsave/vmload for saving/restoring additional host state

2020-12-16 Thread Michael Roth
On Wed, Dec 16, 2020 at 04:23:22PM +0100, Paolo Bonzini wrote: > On 16/12/20 16:12, Michael Roth wrote: > > It looks like it does save us ~20-30 cycles vs. vmload, but maybe not > > enough to justify the added complexity. Additionally, since we still > > need to cal

Re: [PATCH v2] KVM: SVM: use vmsave/vmload for saving/restoring additional host state

2020-12-16 Thread Michael Roth
On Tue, Dec 15, 2020 at 12:17:47PM -0600, Michael Roth wrote: > On Mon, Dec 14, 2020 at 02:29:46PM -0800, Andy Lutomirski wrote: > > > > > > > On Dec 14, 2020, at 2:02 PM, Michael Roth wrote: > > > > > > On Mon, Dec 14, 2020 at 11:38:23AM -0800, Se

Re: [PATCH v2] KVM: SVM: use vmsave/vmload for saving/restoring additional host state

2020-12-15 Thread Michael Roth
Hi Sean, Sorry to reply out-of-thread, our mail server is having issues with certain email addresses at the moment so I only see your message via the archives atm. But regarding: >>> I think we can defer this until we're actually planning on running >>> the guest, >>> i.e. put this in

Re: [PATCH v2] KVM: SVM: use vmsave/vmload for saving/restoring additional host state

2020-12-15 Thread Michael Roth
On Mon, Dec 14, 2020 at 02:29:46PM -0800, Andy Lutomirski wrote: > > > > On Dec 14, 2020, at 2:02 PM, Michael Roth wrote: > > > > On Mon, Dec 14, 2020 at 11:38:23AM -0800, Sean Christopherson wrote: > >> +Andy, who provided a lot of feedback on v1. > &

Re: [PATCH v2] KVM: SVM: use vmsave/vmload for saving/restoring additional host state

2020-12-14 Thread Michael Roth
On Mon, Dec 14, 2020 at 11:38:23AM -0800, Sean Christopherson wrote: > +Andy, who provided a lot of feedback on v1. > > On Mon, Dec 14, 2020, Michael Roth wrote: > > Cc: Andy Lutomirski > > > Suggested-by: Tom Lendacky > > Signed-off-by: Michael Roth > >

[PATCH v2] KVM: SVM: use vmsave/vmload for saving/restoring additional host state

2020-12-14 Thread Michael Roth
] AMD64 Architecture Programmer's Manual, Rev 3.31, Volume 3, Chapter 4, VMSAVE/VMLOAD [3] Secure Virtual Machine Architecture Reference Manual, Rev 3.01 Suggested-by: Tom Lendacky Signed-off-by: Michael Roth --- v2: * rebase on latest kvm/next * move VMLOAD to just after vmexit so we can use

[PATCH] KVM: SVM: use vmsave/vmload for saving/restoring additional host state

2020-12-10 Thread Michael Roth
] AMD64 Architecture Programmer's Manual, Rev 3.31, Volume 3, Chapter 4, VMSAVE/VMLOAD [3] Secure Virtual Machine Architecture Reference Manual, Rev 3.01 Suggested-by: Tom Lendacky Signed-off-by: Michael Roth --- arch/x86/kvm/svm/svm.c | 48 ++ arch/x86/kvm

Re: [PATCH v7 01/72] KVM: SVM: nested: Don't allocate VMCB structures on stack

2020-11-05 Thread Michael Roth
On Thu, Nov 05, 2020 at 05:38:12PM +0100, Borislav Petkov wrote: > On Thu, Nov 05, 2020 at 10:24:37AM -0600, Michael Roth wrote: > > > out_set_gif: > > > svm_set_gif(svm, !!(kvm_state->flags & KVM_STATE_NESTED_GIF_SET)); > > > - re

Re: [PATCH v7 01/72] KVM: SVM: nested: Don't allocate VMCB structures on stack

2020-11-05 Thread Michael Roth
Quoting Michael Roth (2020-11-05 10:24:37) > Quoting Joerg Roedel (2020-09-07 08:15:02) > > From: Joerg Roedel > > > > Do not allocate a vmcb_control_area and a vmcb_save_area on the stack, > > as these structures will become larger with future exte

Re: [PATCH v7 01/72] KVM: SVM: nested: Don't allocate VMCB structures on stack

2020-11-05 Thread Michael Roth
Quoting Joerg Roedel (2020-09-07 08:15:02) > From: Joerg Roedel > > Do not allocate a vmcb_control_area and a vmcb_save_area on the stack, > as these structures will become larger with future extenstions of > SVM and thus the svm_set_nested_state() function will become a too large > stack frame.