On 21/05/21 01:03, Jim Mattson wrote:
At present, there are two reasons why kvm_check_nested_events may
return a non-zero value:
1) we just emulated a shutdown VM-exit from L2 to L1.
2) we need to perform an immediate VM-exit from vmcs02.
In either case, transition the vCPU to "running."
Signed-off-by: Jim Mattson <jmattson@xxxxxxxxxx>
Reviewed-by: Oliver Upton <oupton@xxxxxxxxxx>
---
arch/x86/kvm/x86.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index d517460db413..d3fea8ea3628 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -9468,8 +9468,8 @@ static inline int vcpu_block(struct kvm *kvm, struct kvm_vcpu *vcpu)
static inline bool kvm_vcpu_running(struct kvm_vcpu *vcpu)
{
- if (is_guest_mode(vcpu))
- kvm_check_nested_events(vcpu);
+ if (is_guest_mode(vcpu) && kvm_check_nested_events(vcpu))
+ return true;
That doesn't make the vCPU running. You still need to go through
vcpu_block, which would properly update the vCPU's mp_state.
What is this patch fixing?
Paolo
return (vcpu->arch.mp_state == KVM_MP_STATE_RUNNABLE &&
!vcpu->arch.apf.halted);