[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL v2 37/55] virtio: signal after wrapping packed used_idx
|
From: |
Michael S. Tsirkin |
|
Subject: |
[PULL v2 37/55] virtio: signal after wrapping packed used_idx |
|
Date: |
Fri, 7 Jan 2022 06:04:55 -0500 |
From: Stefan Hajnoczi <stefanha@redhat.com>
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: 86044b24e865fb9596ed77a4d0f3af8b90a088a1 ("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>
---
hw/virtio/virtio.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c
index 36edb1dad5..971e59a663 100644
--- a/hw/virtio/virtio.c
+++ b/hw/virtio/virtio.c
@@ -885,6 +885,7 @@ static void virtqueue_packed_flush(VirtQueue *vq, unsigned
int count)
if (vq->used_idx >= vq->vring.num) {
vq->used_idx -= vq->vring.num;
vq->used_wrap_counter ^= 1;
+ vq->signalled_used_valid = false;
}
}
--
MST
- [PULL v2 32/55] util/oslib-posix: Don't create too many threads with small memory or little pages, (continued)
- [PULL v2 32/55] util/oslib-posix: Don't create too many threads with small memory or little pages, Michael S. Tsirkin, 2022/01/07
- [PULL v2 33/55] util/oslib-posix: Avoid creating a single thread with MADV_POPULATE_WRITE, Michael S. Tsirkin, 2022/01/07
- [PULL v2 36/55] virtio-mem: Support "prealloc=on" option, Michael S. Tsirkin, 2022/01/07
- [PULL v2 43/55] acpi: fix QEMU crash when started with SLIC table, Michael S. Tsirkin, 2022/01/07
- [PULL v2 34/55] util/oslib-posix: Support concurrent os_mem_prealloc() invocation, Michael S. Tsirkin, 2022/01/07
- [PULL v2 41/55] virtio-mem: Set "unplugged-inaccessible=auto" for the 7.0 machine on x86, Michael S. Tsirkin, 2022/01/07
- [PULL v2 35/55] util/oslib-posix: Forward SIGBUS to MCE handler under Linux, Michael S. Tsirkin, 2022/01/07
- [PULL v2 40/55] virtio-mem: Support VIRTIO_MEM_F_UNPLUGGED_INACCESSIBLE, Michael S. Tsirkin, 2022/01/07
- [PULL v2 42/55] intel-iommu: correctly check passthrough during translation, Michael S. Tsirkin, 2022/01/07
- [PULL v2 47/55] acpihp: simplify acpi_pcihp_disable_root_bus, Michael S. Tsirkin, 2022/01/07
- [PULL v2 37/55] virtio: signal after wrapping packed used_idx,
Michael S. Tsirkin <=
- [PULL v2 50/55] hw/scsi/vhost-scsi: don't leak vqs on error, Michael S. Tsirkin, 2022/01/07
- [PULL v2 39/55] linux-headers: sync VIRTIO_MEM_F_UNPLUGGED_INACCESSIBLE, Michael S. Tsirkin, 2022/01/07
- [PULL v2 44/55] tests: acpi: whitelist expected blobs before changing them, Michael S. Tsirkin, 2022/01/07
- [PULL v2 45/55] tests: acpi: add SLIC table test, Michael S. Tsirkin, 2022/01/07
- [PULL v2 53/55] tests: acpi: prepare for updated TPM related tables, Michael S. Tsirkin, 2022/01/07
- [PULL v2 46/55] tests: acpi: SLIC: update expected blobs, Michael S. Tsirkin, 2022/01/07
- [PULL v2 38/55] MAINTAINERS: Add a separate entry for acpi/VIOT tables, Michael S. Tsirkin, 2022/01/07
- [PULL v2 51/55] hw/scsi/vhost-scsi: don't double close vhostfd on error, Michael S. Tsirkin, 2022/01/07
- [PULL v2 52/55] virtio/vhost-vsock: don't double close vhostfd, remove redundant cleanup, Michael S. Tsirkin, 2022/01/07
- [PULL v2 48/55] hw/i386/pc: Add missing property descriptions, Michael S. Tsirkin, 2022/01/07