Re: [PATCH v2 5/6] KVM: Send reschedule IPIs instead of SMP function calls for non-waiting requests
From: Satish Kharat
Date: Sat Nov 21 2026 - 10:25:04 EST
On Thu, Nov 19, 2026 at 03:56:55PM -0800, Sean Christopherson wrote:
> When kicking multiple vCPUs for a non-waiting request, send a reschedule
> IPI to each vCPU instead of batching IPIs via a single SMP function call so
> that KVM can make non-waiting requests with IRQs disabled.
>
> Avoiding SMP function calls for non-waiting requests fixes a potential
> deadlock if KVM VMX triggers KVM_REQ_UNBLOCK to all vCPUs when starting
> device assignmennt:
>
> WARNING: kernel/smp.c:943 at smp_call_function_many_cond
> kvm_make_all_cpus_request [kvm]
> kvm_arch_irq_bypass_add_producer [kvm]
> __connect [irqbypass]
> irq_bypass_register_producer [irqbypass]
> vfio_msi_set_vector_signal [vfio_pci_core]
Thanks for picking this up. I reported the splat above, so I ran the series
against the workload that originally triggered it.
Setup:
- Intel VT-d host (Cisco UCS C220 M7, Xeon Platinum), APICv and
device-posted interrupts enabled.
- Guest with a Cisco VIC (enic) VF assigned via VFIO.
- KVM built from this series as modules and loaded against the running
kernel (no reboot). To confirm the series itself does the work, my
arch/x86/kvm/irq.c change was intentionally not applied.
- Trigger: reload the guest's enic driver to re-arm the VF's MSI-X vectors
while other vCPUs spin in guest mode, i.e.
vfio_msi_set_vector_signal() -> irq_bypass_register_producer() ->
kvm_arch_irq_bypass_add_producer() -> pi_start_bypass() ->
kvm_make_all_cpus_request(KVM_REQ_UNBLOCK) with IRQs disabled.
Before/after, same trigger:
- With a build that has neither my irq.c fix nor this series, the warning
reproduces on the first cycle.
- With this series applied, no warning across repeated reload cycles.
Function tracing shows the bypass callback issuing reschedule IPIs
(native_smp_send_reschedule) for the non-waiting request instead of
reaching smp_call_function_many_cond(); waiting requests still use the
batched SMP call with IRQs enabled. Bidirectional VF traffic (ICMP and
TCP) and repeated driver reloads pass, lockdep stays enabled, and no new
warnings appear.
irqfd_test, irq_test, vmx_posted_intr_test and smptest also pass with the
series applied.
This was Intel-only and module-against-running-kernel; I did not exercise
the arm64 KVM_IRQFD path, s390, or AMD, so the tag below is for the x86
VFIO / KVM_REQ_UNBLOCK path I can vouch for.
Tested-by: Satish Kharat <satishkh@xxxxxxxxx>
Test automation was LLM-assisted; all results were reviewed by me. Full
logs available on request.
Thanks,
Satish