[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 11/13] virtio-net: don't run bh on vm stopped
From: |
Michael S. Tsirkin |
Subject: |
[Qemu-devel] [PULL 11/13] virtio-net: don't run bh on vm stopped |
Date: |
Tue, 2 Sep 2014 18:07:39 +0300 |
commit 783e7706937fe15523b609b545587a028a2bdd03
virtio-net: stop/start bh when appropriate
is incomplete: BH might execute within the same main loop iteration but
after vmstop, so in theory, we might trigger an assertion.
I was unable to reproduce this in practice,
but it seems clear enough that the potential is there, so worth fixing.
Cc: address@hidden
Reported-by: Stefan Hajnoczi <address@hidden>
Signed-off-by: Michael S. Tsirkin <address@hidden>
---
hw/net/virtio-net.c | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c
index 268eff9..365e266 100644
--- a/hw/net/virtio-net.c
+++ b/hw/net/virtio-net.c
@@ -1224,7 +1224,12 @@ static void virtio_net_tx_timer(void *opaque)
VirtIONetQueue *q = opaque;
VirtIONet *n = q->n;
VirtIODevice *vdev = VIRTIO_DEVICE(n);
- assert(vdev->vm_running);
+ /* This happens when device was stopped but BH wasn't. */
+ if (!vdev->vm_running) {
+ /* Make sure tx waiting is set, so we'll run when restarted. */
+ assert(q->tx_waiting);
+ return;
+ }
q->tx_waiting = 0;
@@ -1244,7 +1249,12 @@ static void virtio_net_tx_bh(void *opaque)
VirtIODevice *vdev = VIRTIO_DEVICE(n);
int32_t ret;
- assert(vdev->vm_running);
+ /* This happens when device was stopped but BH wasn't. */
+ if (!vdev->vm_running) {
+ /* Make sure tx waiting is set, so we'll run when restarted. */
+ assert(q->tx_waiting);
+ return;
+ }
q->tx_waiting = 0;
--
MST
- [Qemu-devel] [PULL 02/13] intel-iommu: introduce Intel IOMMU (VT-d) emulation, (continued)
- [Qemu-devel] [PULL 02/13] intel-iommu: introduce Intel IOMMU (VT-d) emulation, Michael S. Tsirkin, 2014/09/02
- [Qemu-devel] [PULL 03/13] intel-iommu: add DMAR table to ACPI tables, Michael S. Tsirkin, 2014/09/02
- [Qemu-devel] [PULL 04/13] intel-iommu: add Intel IOMMU emulation to q35 and add a machine option "iommu" as a switch, Michael S. Tsirkin, 2014/09/02
- [Qemu-devel] [PULL 06/13] intel-iommu: add supports for queued invalidation interface, Michael S. Tsirkin, 2014/09/02
- [Qemu-devel] [PULL 05/13] intel-iommu: fix coding style issues around in q35.c and machine.c, Michael S. Tsirkin, 2014/09/02
- [Qemu-devel] [PULL 01/13] iommu: add is_write as a parameter to the translate function of MemoryRegionIOMMUOps, Michael S. Tsirkin, 2014/09/02
- [Qemu-devel] [PULL 07/13] intel-iommu: add context-cache to cache context-entry, Michael S. Tsirkin, 2014/09/02
- [Qemu-devel] [PULL 09/13] vhost_net: cleanup start/stop condition, Michael S. Tsirkin, 2014/09/02
- [Qemu-devel] [PULL 08/13] intel-iommu: add IOTLB using hash table, Michael S. Tsirkin, 2014/09/02
- [Qemu-devel] [PULL 10/13] ioh3420: remove unused ioh3420_init() declaration, Michael S. Tsirkin, 2014/09/02
- [Qemu-devel] [PULL 11/13] virtio-net: don't run bh on vm stopped,
Michael S. Tsirkin <=
- [Qemu-devel] [PULL 12/13] pci: avoid losing config updates to MSI/MSIX cap regs, Michael S. Tsirkin, 2014/09/02
- [Qemu-devel] [PULL 13/13] vhost_net: start/stop guest notifiers properly, Michael S. Tsirkin, 2014/09/02
- Re: [Qemu-devel] [PULL 00/13] pci, pc fixes, features, Michael S. Tsirkin, 2014/09/03