[PATCH v2 0/4] KVM: nSVM: few random fixes

From: Maxim Levitsky
Date: Thu Jan 07 2021 - 04:40:50 EST


This is a series of fixes to nested SVM, that finally makes my kvm on kvm
stress test pass, and fix various other issues/regressions.

Patch 1 is a fix for recent regression related to code that delayed the nested
msr bitmap processing to the next vm entry, and started to crash the L1 after
my on demand nested state allocation patches.

The problem was that the code assumed that we will still be in the nested
guest mode on next vmentry after setting the nested state, but a pending event
can cause a nested vmexit prior to that.

Patch 2 makes KVM restore nested_run_pending flag on migration which fixes
various issues including potentially missed L1->L2 event injection
if migration happens while nested run is pending.

Patches 3,4 are few things I found while reviewing the nested migration code.
I don't have a reproducer for them.

Thanks a lot to Sean Christopherson for the review feedback on V1 of this
series, which is fully incorporated in this series.

Best regards,
Maxim Levitsky

Maxim Levitsky (4):
KVM: nSVM: cancel KVM_REQ_GET_NESTED_STATE_PAGES on nested vmexit
KVM: nSVM: correctly restore nested_run_pending on migration
KVM: nSVM: always leave the nested state first on KVM_SET_NESTED_STATE
KVM: nSVM: mark vmcb as dirty when forcingly leaving the guest mode

arch/x86/kvm/svm/nested.c | 12 ++++++++++++
1 file changed, 12 insertions(+)

--
2.26.2