2021-05-04 14:44:13

by Maxim Levitsky

[permalink] [raw]
Subject: [PATCH v2 0/2] KVM: nSVM: few fixes for the nested migration

Those are few fixes for issues I uncovered by doing variants of a

synthetic migration test I just created:



I modified the qemu, such that on each vm pause/resume cycle,

just prior to resuming a vCPU, qemu reads its KVM state,

then (optionaly) resets this state by uploading a

dummy reset state to KVM, and then it uploads back to KVM,

the state that this vCPU had before.



V2: those are only last 2 patches from V1,

updated with review feedback from Paolo (Thanks!).



Best regards,

Maxim Levitsky



Maxim Levitsky (2):

KVM: nSVM: always restore the L1's GIF on migration

KVM: nSVM: remove a warning about vmcb01 VM exit reason



arch/x86/kvm/svm/nested.c | 3 ++-

1 file changed, 2 insertions(+), 1 deletion(-)



--

2.26.2





2021-05-04 15:07:58

by Maxim Levitsky

[permalink] [raw]
Subject: [PATCH v2 2/2] KVM: nSVM: remove a warning about vmcb01 VM exit reason

While in most cases, when returning to use the VMCB01,
the exit reason stored in it will be SVM_EXIT_VMRUN,
on first VM exit after a nested migration this field
can contain anything since the VM entry did happen
before the migration.

Remove this warning to avoid the false positive.

Signed-off-by: Maxim Levitsky <[email protected]>
---
arch/x86/kvm/svm/nested.c | 1 -
1 file changed, 1 deletion(-)

diff --git a/arch/x86/kvm/svm/nested.c b/arch/x86/kvm/svm/nested.c
index b331446f67f3..5e8d8443154e 100644
--- a/arch/x86/kvm/svm/nested.c
+++ b/arch/x86/kvm/svm/nested.c
@@ -764,7 +764,6 @@ int nested_svm_vmexit(struct vcpu_svm *svm)
nested_svm_copy_common_state(svm->nested.vmcb02.ptr, svm->vmcb01.ptr);

svm_switch_vmcb(svm, &svm->vmcb01);
- WARN_ON_ONCE(svm->vmcb->control.exit_code != SVM_EXIT_VMRUN);

/*
* On vmexit the GIF is set to false and
--
2.26.2

2021-05-04 16:21:48

by Paolo Bonzini

[permalink] [raw]
Subject: Re: [PATCH v2 0/2] KVM: nSVM: few fixes for the nested migration

On 04/05/21 16:39, Maxim Levitsky wrote:
> Those are few fixes for issues I uncovered by doing variants of a
> synthetic migration test I just created:
>
> I modified the qemu, such that on each vm pause/resume cycle,
> just prior to resuming a vCPU, qemu reads its KVM state,
> then (optionaly) resets this state by uploading a
> dummy reset state to KVM, and then it uploads back to KVM,
> the state that this vCPU had before.
>
> V2: those are only last 2 patches from V1,
> updated with review feedback from Paolo (Thanks!).

Queued, thanks.

Paolo

> Best regards,
> Maxim Levitsky
>
> Maxim Levitsky (2):
> KVM: nSVM: always restore the L1's GIF on migration
> KVM: nSVM: remove a warning about vmcb01 VM exit reason
>
> arch/x86/kvm/svm/nested.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>