Skip to contentSkip to conversation

async PF event can fail to wakeup vcpu from halt

PATCH Applied Gleb Natapov 2 participants 2 messages May 3, 2012 – May 6, 2012

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 async PF event can fail to wakeup vcpu from halt

If vcpu executes hlt instruction while async PF is waiting to be delivered vcpu can block and deliver async PF only after another even wakes it up. This happens because kvm_check_async_pf_completion() will remove completion event from vcpu->async_pf.done before entering kvm_vcpu_block() and this will make kvm_arch_vcpu_runnable() return false. The solution is to make vcpu runnable when processing completion.

arch/x86/kvm/x86.c +1 -0
index 4de705c..6d44308 100644
@@ -6611,6 +6611,7 @@ void kvm_arch_async_page_present(struct kvm_vcpu *vcpu,
 		kvm_inject_page_fault(vcpu, &fault);
 	}
 	vcpu->arch.apf.halted = false;
+	vcpu->arch.mp_state = KVM_MP_STATE_RUNNABLE;
 }
 
 bool kvm_arch_can_inject_async_page_present(struct kvm_vcpu *vcpu)

--
Gleb.

Applied
#1 lore raw
Quoted 8 lines · Gleb Natapov

If vcpu executes hlt instruction while async PF is waiting to be delivered vcpu can block and deliver async PF only after another even wakes it up. This happens because kvm_check_async_pf_completion() will remove completion event from vcpu->async_pf.done before entering kvm_vcpu_block() and this will make kvm_arch_vcpu_runnable() return false. The solution is to make vcpu runnable when processing completion.

Thanks, applied to master for 3.4.

Signature · 1 line
error compiling committee.c: too many arguments to function