qemu-patch-raspberry4/hw/virtio
Stefan Hajnoczi 750539c4c4 virtio: signal after wrapping packed used_idx
Packed Virtqueues wrap used_idx instead of letting it run freely like
Split Virtqueues do. If the used ring wraps more than once there is no
way to compare vq->signalled_used and vq->used_idx in
virtio_packed_should_notify() since they are modulo vq->vring.num.

This causes the device to stop sending used buffer notifications when
when virtio_packed_should_notify() is called less than once each time
around the used ring.

It is possible to trigger this with virtio-blk's dataplane
notify_guest_bh() irq coalescing optimization. The call to
virtio_notify_irqfd() (and virtio_packed_should_notify()) is deferred to
a BH. If the guest driver is polling it can complete and submit more
requests before the BH executes, causing the used ring to wrap more than
once. The result is that the virtio-blk device ceases to raise
interrupts and I/O hangs.

Cc: Tiwei Bie <tiwei.bie@intel.com>
Cc: Jason Wang <jasowang@redhat.com>
Cc: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-Id: <20211130134510.267382-1-stefanha@redhat.com>
Fixes: 86044b24e8 ("virtio: basic packed virtqueue support")
Acked-by: Jason Wang <jasowang@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2022-01-07 19:30:13 -05:00
..
Kconfig vhost-user-rng: Add vhost-user-rng implementation 2021-10-20 04:37:55 -04:00
meson.build vhost-user-rng-pci: Add vhost-user-rng-pci implementation 2021-10-20 04:37:55 -04:00
trace-events vhost-vdpa: add support for config interrupt 2022-01-06 06:11:39 -05:00
trace.h trace: switch position of headers to what Meson requires 2020-08-21 06:18:24 -04:00
vhost-backend.c vhost-backend: stick to -errno error return convention 2022-01-07 05:19:55 -05:00
vhost-scsi-pci.c Use DECLARE_*CHECKER* macros 2020-09-09 09:27:09 -04:00
vhost-stub.c vhost-user: simplify vhost_user_init/vhost_user_cleanup 2019-03-12 21:22:31 -04:00
vhost-user-blk-pci.c Use DECLARE_*CHECKER* macros 2020-09-09 09:27:09 -04:00
vhost-user-fs-pci.c vhost-user-fs: add the "bootindex" property 2021-01-13 09:06:37 -05:00
vhost-user-fs.c virtio: introduce macro IRTIO_CONFIG_IRQ_IDX 2022-01-06 06:11:39 -05:00
vhost-user-i2c-pci.c hw/virtio: add vhost-user-i2c-pci boilerplate 2021-07-16 11:10:45 -04:00
vhost-user-i2c.c hw/virtio: add boilerplate for vhost-user-i2c device 2021-07-16 11:10:40 -04:00
vhost-user-input-pci.c Use DECLARE_*CHECKER* macros 2020-09-09 09:27:09 -04:00
vhost-user-rng-pci.c vhost-user-rng-pci: Add vhost-user-rng-pci implementation 2021-10-20 04:37:55 -04:00
vhost-user-rng.c vhost-user-rng: Add vhost-user-rng implementation 2021-10-20 04:37:55 -04:00
vhost-user-scsi-pci.c Use DECLARE_*CHECKER* macros 2020-09-09 09:27:09 -04:00
vhost-user-vsock-pci.c vhost-user-vsock-pci: force virtio version 1 2020-09-29 02:15:24 -04:00
vhost-user-vsock.c vhost-vsock: handle common features in vhost-vsock-common 2021-10-05 17:30:57 -04:00
vhost-user.c vhost-user: stick to -errno error return convention 2022-01-07 05:19:55 -05:00
vhost-vdpa.c vhost-vdpa: stick to -errno error return convention 2022-01-07 05:19:55 -05:00
vhost-vsock-common.c virtio: introduce macro IRTIO_CONFIG_IRQ_IDX 2022-01-06 06:11:39 -05:00
vhost-vsock-pci.c vhost-vsock-pci: force virtio version 1 2020-09-29 02:15:24 -04:00
vhost-vsock.c vhost-vsock: handle common features in vhost-vsock-common 2021-10-05 17:30:57 -04:00
vhost.c vhost: stick to -errno error return convention 2022-01-07 05:19:55 -05:00
virtio-9p-pci.c Use DECLARE_*CHECKER* macros 2020-09-09 09:27:09 -04:00
virtio-balloon-pci.c hw/virtio/virtio-balloon: Remove the "class" property 2021-02-05 08:52:59 -05:00
virtio-balloon.c virtio-balloon: correct used length 2021-11-29 08:49:36 -05:00
virtio-blk-pci.c Use DECLARE_*CHECKER* macros 2020-09-09 09:27:09 -04:00
virtio-bus.c virtio-bus: introduce iommu_enabled() 2021-09-04 16:35:17 -04:00
virtio-crypto-pci.c Use DECLARE_*CHECKER* macros 2020-09-09 09:27:09 -04:00
virtio-crypto.c virtio: introduce macro IRTIO_CONFIG_IRQ_IDX 2022-01-06 06:11:39 -05:00
virtio-input-host-pci.c Use DECLARE_*CHECKER* macros 2020-09-09 09:27:09 -04:00
virtio-input-pci.c Use OBJECT_DECLARE_SIMPLE_TYPE when possible 2020-09-18 14:12:32 -04:00
virtio-iommu-pci.c hw/arm/virt: Remove device tree restriction for virtio-iommu 2021-12-15 10:35:26 +00:00
virtio-iommu.c virtio-iommu: Fix the domain_range end 2021-12-15 08:08:59 +01:00
virtio-mem-pci.c qapi: Include qom-path in MEMORY_DEVICE_SIZE_CHANGE qapi events 2021-10-02 08:43:21 +02:00
virtio-mem-pci.h Use DECLARE_*CHECKER* macros 2020-09-09 09:27:09 -04:00
virtio-mem.c virtio-mem: Support "prealloc=on" option 2022-01-07 19:30:13 -05:00
virtio-mmio.c virtio-mmio: add support for configure interrupt 2022-01-07 05:19:55 -05:00
virtio-net-pci.c virtio-net: calculating proper msix vectors on init 2021-03-15 16:41:22 +08:00
virtio-pci.c virtio-pci: add support for configure interrupt 2022-01-07 05:19:55 -05:00
virtio-pci.h virtio-pci: add support for configure interrupt 2022-01-07 05:19:55 -05:00
virtio-pmem-pci.c virtio-pmem-pci: force virtio version 1 2020-09-29 02:14:30 -04:00
virtio-pmem-pci.h Use DECLARE_*CHECKER* macros 2020-09-09 09:27:09 -04:00
virtio-pmem.c virtio-pmem: fix virtio_pmem_resp assign problem 2021-03-22 10:17:53 -04:00
virtio-rng-pci.c Use DECLARE_*CHECKER* macros 2020-09-09 09:27:09 -04:00
virtio-rng.c sysemu: Let VMChangeStateHandler take boolean 'running' argument 2021-03-09 23:13:57 +01:00
virtio-scsi-pci.c Use DECLARE_*CHECKER* macros 2020-09-09 09:27:09 -04:00
virtio-serial-pci.c Use DECLARE_*CHECKER* macros 2020-09-09 09:27:09 -04:00
virtio.c virtio: signal after wrapping packed used_idx 2022-01-07 19:30:13 -05:00