All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] hw/nvme: fix legacy INTx handling
@ 2026-09-23 12:20 Markku Ahvenjärvi
  2026-09-23 12:20 ` [PATCH 1/3] hw/nvme: prevent cq_pending underflow Markku Ahvenjärvi
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Markku Ahvenjärvi @ 2026-09-23 12:20 UTC (permalink / raw)
  To: qemu-devel
  Cc: Keith Busch, Klaus Jensen, Jesper Devantier, qemu-block,
	Markku Ahvenjärvi

This series fixes three cases where an NVMe legacy INTx interrupt may
remain asserted, causing an interrupt storm in the guest:

* cq_pending can underflow when a doorbell notification is processed for
  a completion queue that is already empty.

* A stale CQ event index can cause the guest to suppress a subsequent
  MMIO CQ doorbell write, preventing QEMU from observing the updated CQ
  head.

* Controller reset does not clear pending CQ interrupt state.

Without these fixes, a Linux guest using legacy PCI interrupts may see
the following:

[    2.058360] irq 23: nobody cared (try booting with the "irqpoll" option)
[    2.058724] handlers:
[    2.058820] [<000000006a09281a>] nvme_irq
[    2.058966] [<000000006a09281a>] nvme_irq
[    2.059113] Disabling IRQ #23

I reproduced the interrupt storm with Linux 6.12, 6.18, and 7.2 by
booting the guest with pci=nomsi. The cq_pending underflow occurred with
ioeventfd=on, but its fix covers both ioeventfd=on and ioeventfd=off
configurations. The stale event-index issue occurred with both
ioeventfd=on and ioeventfd=off.

The following command was used to reproduce the interrupt storm with
ioeventfd=on:

qemu-system-x86_64 \
      -machine q35,accel=kvm \
      -m 2G -smp 2 \
      -kernel ./linux-7.2/arch/x86/boot/bzImage \
      -append 'console=ttyS0 root=/dev/nvme0n1p1 rw pci=nomsi' \
      -drive if=none,file=./guest-image.qcow2,id=disk0,format=qcow2 \
      -device nvme,drive=disk0,serial=testserial0,ioeventfd=on \
      -nographic

The controller-reset fix addresses QEMU issue 4142:
https://gitlab.com/qemu-project/qemu/-/work_items/4142

I was unable to reproduce this issue with a Linux guest, but a
controller reset must clear the CQ interrupt state and deassert the
interrupt line.

Kind regards,
Markku Ahvenjärvi

---
Markku Ahvenjärvi (3):
      hw/nvme: prevent cq_pending underflow
      hw/nvme: fix missed CQ updates
      hw/nvme: clear interrupts on controller reset

 hw/nvme/ctrl.c | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)
---
base-commit: 7074591d7954876951f84c15b994a43251d5a3c1
change-id: 20260922-nvme-intx-fixes-10b70b6520ba

Best regards,
--  
Markku Ahvenjärvi <mankku@gmail.com>



^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2026-10-05 13:10 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-23 12:20 [PATCH 0/3] hw/nvme: fix legacy INTx handling Markku Ahvenjärvi
2026-09-23 12:20 ` [PATCH 1/3] hw/nvme: prevent cq_pending underflow Markku Ahvenjärvi
2026-09-23 14:39   ` Keith Busch
2026-09-24  6:56     ` Markku Ahvenjärvi
2026-09-24 17:57       ` Keith Busch
2026-09-25  7:32         ` Markku Ahvenjärvi
2026-10-05  5:54           ` Markku Ahvenjärvi
2026-10-05 13:09             ` Keith Busch
2026-09-23 12:20 ` [PATCH 2/3] hw/nvme: fix missed CQ updates Markku Ahvenjärvi
2026-09-23 12:20 ` [PATCH 3/3] hw/nvme: clear interrupts on controller reset Markku Ahvenjärvi

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.