qemu-e2k/hw/block
Stefan Hajnoczi bfa36802d1 virtio-blk: avoid using ioeventfd state in irqfd conditional
Requests that complete in an IOThread use irqfd to notify the guest
while requests that complete in the main loop thread use the traditional
qdev irq code path. The reason for this conditional is that the irq code
path requires the BQL:

  if (s->ioeventfd_started && !s->ioeventfd_disabled) {
      virtio_notify_irqfd(vdev, req->vq);
  } else {
      virtio_notify(vdev, req->vq);
  }

There is a corner case where the conditional invokes the irq code path
instead of the irqfd code path:

  static void virtio_blk_stop_ioeventfd(VirtIODevice *vdev)
  {
      ...
      /*
       * Set ->ioeventfd_started to false before draining so that host notifiers
       * are not detached/attached anymore.
       */
      s->ioeventfd_started = false;

      /* Wait for virtio_blk_dma_restart_bh() and in flight I/O to complete */
      blk_drain(s->conf.conf.blk);

During blk_drain() the conditional produces the wrong result because
ioeventfd_started is false.

Use qemu_in_iothread() instead of checking the ioeventfd state.

Cc: qemu-stable@nongnu.org
Buglink: https://issues.redhat.com/browse/RHEL-15394
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-ID: <20240122172625.415386-1-stefanha@redhat.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2024-02-08 09:37:33 +01:00
..
dataplane virtio-blk: move dataplane code into virtio-blk.c 2024-01-26 11:16:58 +01:00
block.c hw/block/block.c: improve confusing blk_check_size_and_read_all() error 2024-01-30 16:19:00 -05:00
cdrom.c
ecc.c hw/block: Constify VMState 2023-12-29 11:17:30 +11:00
fdc-internal.h
fdc-isa.c hw/block: Constify VMState 2023-12-29 11:17:30 +11:00
fdc-sysbus.c hw/block: Constify VMState 2023-12-29 11:17:30 +11:00
fdc.c hw/block: Constify VMState 2023-12-29 11:17:30 +11:00
hd-geometry.c hw/other: spelling fixes 2023-09-21 11:31:16 +03:00
Kconfig
m25p80_sfdp.c
m25p80_sfdp.h
m25p80.c hw/block/block.c: improve confusing blk_check_size_and_read_all() error 2024-01-30 16:19:00 -05:00
meson.build meson: Replace softmmu_ss -> system_ss 2023-06-20 10:01:30 +02:00
nand.c hw/block: Constify VMState 2023-12-29 11:17:30 +11:00
onenand.c hw/block: Constify VMState 2023-12-29 11:17:30 +11:00
pflash_cfi01.c hw/block/block.c: improve confusing blk_check_size_and_read_all() error 2024-01-30 16:19:00 -05:00
pflash_cfi02.c hw/block/block.c: improve confusing blk_check_size_and_read_all() error 2024-01-30 16:19:00 -05:00
swim.c hw/block: Constify VMState 2023-12-29 11:17:30 +11:00
tc58128.c hw/block: Deprecate the TC58128 block device 2024-01-19 12:28:59 +01:00
trace-events hw/pflash: implement update buffer for block writes 2024-01-19 12:28:59 +01:00
trace.h
vhost-user-blk.c hw/block: Constify VMState 2023-12-29 11:17:30 +11:00
virtio-blk-common.c
virtio-blk.c virtio-blk: avoid using ioeventfd state in irqfd conditional 2024-02-08 09:37:33 +01:00
xen_blkif.h
xen-block.c hw/xen: clean up xen_block_find_free_vdev() to avoid Coverity false positive 2023-11-21 11:45:06 +00:00