KVM: nSVM: few fixes for the nested migration
v2 cover 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(-)
Signature · 1 line
2.26.2
PATCH v2 1/2 KVM: nSVM: always restore the L1's GIF on migration
While usually the L1's GIF is set while L2 runs, and usually migration nested state is loaded after a vCPU reset which also sets L1's GIF to true, this is not guaranteed.
--- arch/x86/kvm/svm/nested.c | 2 ++ 1 file changed, 2 insertions(+)
arch/x86/kvm/svm/nested.c +2 -0
@@ -1314,6 +1314,8 @@ static int svm_set_nested_state(struct kvm_vcpu *vcpu,else svm->nested.vmcb02.ptr->save = svm->vmcb01.ptr->save; +svm_set_gif (svm, !!(kvm_state->flags &KVM_STATE_NESTED_GIF_SET )); + svm->nested.nested_run_pending = !!(kvm_state->flags &KVM_STATE_NESTED_RUN_PENDING );
Signature · 1 line
2.26.2
PATCH v2 2/2 KVM: nSVM: remove a warning about vmcb01 VM exit reason
In reply to Maxim LevitskyWhile 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.
--- arch/x86/kvm/svm/nested.c | 1 - 1 file changed, 1 deletion(-)
arch/x86/kvm/svm/nested.c +0 -1
@@ -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
Signature · 1 line
2.26.2
Quoted 11 lines · Maxim Levitsky
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
Quoted 10 lines
Best regards,
Maxim LevitskyMaxim Levitsky (2):
KVM: nSVM: always restore the L1's GIF on migration
KVM: nSVM: remove a warning about vmcb01 VM exit reasonarch/x86/kvm/svm/nested.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)