Skip to content

Commit 6bad6ec

Browse files
sean-jcbonzini
authored andcommitted
KVM: VMX: Assert that IRQs are disabled when putting vCPU on PI wakeup list
Assert that IRQs are already disabled when putting a vCPU on a CPU's PI wakeup list, as opposed to saving/disabling+restoring IRQs. KVM relies on IRQs being disabled until the vCPU task is fully scheduled out, i.e. until the scheduler has dropped all of its per-CPU locks (e.g. for the runqueue), as attempting to wake the task while it's being scheduled out could lead to deadlock. Signed-off-by: Sean Christopherson <[email protected]> Reviewed-by: Maxim Levitsky <[email protected]> Reviewed-by: Yan Zhao <[email protected]> Message-ID: <[email protected]> Signed-off-by: Paolo Bonzini <[email protected]>
1 parent 782f9fe commit 6bad6ec

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

arch/x86/kvm/vmx/posted_intr.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -148,9 +148,8 @@ static void pi_enable_wakeup_handler(struct kvm_vcpu *vcpu)
148148
struct pi_desc *pi_desc = vcpu_to_pi_desc(vcpu);
149149
struct vcpu_vmx *vmx = to_vmx(vcpu);
150150
struct pi_desc old, new;
151-
unsigned long flags;
152151

153-
local_irq_save(flags);
152+
lockdep_assert_irqs_disabled();
154153

155154
raw_spin_lock(&per_cpu(wakeup_vcpus_on_cpu_lock, vcpu->cpu));
156155
list_add_tail(&vmx->pi_wakeup_list,
@@ -176,8 +175,6 @@ static void pi_enable_wakeup_handler(struct kvm_vcpu *vcpu)
176175
*/
177176
if (pi_test_on(&new))
178177
__apic_send_IPI_self(POSTED_INTR_WAKEUP_VECTOR);
179-
180-
local_irq_restore(flags);
181178
}
182179

183180
static bool vmx_needs_pi_wakeup(struct kvm_vcpu *vcpu)

0 commit comments

Comments
 (0)