mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Satish Kharat <satishkh@cisco.com>
To: Sean Christopherson <seanjc@google.com>
Cc: Satish Kharat <satishkh@cisco.com>,
	Paolo Bonzini <pbonzini@redhat.com>,
	kvm@vger.kernel.org, linux-kernel@vger.kernel.org,
	Oliver Upton <oupton@kernel.org>, Marc Zyngier <maz@kernel.org>
Subject: Re: [PATCH v2 5/6] KVM: Send reschedule IPIs instead of SMP function calls for non-waiting requests
Date: Sat, 21 Nov 2026 07:24:30 -0800	[thread overview]
Message-ID: <20261121152434.955716-1-satishkh@cisco.com> (raw)
In-Reply-To: <20261119235656.70315-6-seanjc@google.com>

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@cisco.com>

Test automation was LLM-assisted; all results were reviewed by me. Full
logs available on request.

Thanks,
Satish

  reply	other threads:[~2026-11-21 15:24 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-19 23:56 [PATCH v2 0/6] KVM: Send reschedule IPIs " Sean Christopherson
2026-11-19 23:56 ` [PATCH v2 1/6] s390/smp: Export arch_smp_send_reschedule() for KVM Sean Christopherson
2026-11-19 23:56 ` [PATCH v2 2/6] KVM: Add struct and helpers to handle kicking multiple (v)CPUs Sean Christopherson
2026-11-19 23:56 ` [PATCH v2 3/6] KVM: Add dedicated flag to track if multi-vCPU request needs at least one kick Sean Christopherson
2026-11-19 23:56 ` [PATCH v2 4/6] KVM: Don't kick offline CPUs when making a multi-vCPU request Sean Christopherson
2026-11-19 23:56 ` [PATCH v2 5/6] KVM: Send reschedule IPIs instead of SMP function calls for non-waiting requests Sean Christopherson
2026-11-21 15:24   ` Satish Kharat [this message]
2026-11-19 23:56 ` [PATCH v2 6/6] KVM: Extract and dedup the kick code to check if a CPU needs an IPI Sean Christopherson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261121152434.955716-1-satishkh@cisco.com \
    --to=satishkh@cisco.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maz@kernel.org \
    --cc=oupton@kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=seanjc@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®