dcavalca / rpms / qemu

Forked from rpms/qemu a year ago
Clone

Blame 0007-Revert-virtio-don-t-call-device-on-vm_running.patch

e84b90
From 6b448e66c6e2e993b2c5666cbc0747e6405e80fa Mon Sep 17 00:00:00 2001
e84b90
From: "Michael S. Tsirkin" <mst@redhat.com>
e84b90
Date: Thu, 11 Sep 2014 18:42:02 +0300
e84b90
Subject: [PATCH] Revert "virtio: don't call device on !vm_running"
e84b90
e84b90
This reverts commit a1bc7b827e422e1ff065640d8ec5347c4aadfcd8.
e84b90
    virtio: don't call device on !vm_running
e84b90
It turns out that virtio net assumes that vm_running
e84b90
is updated before device status callback in many places,
e84b90
so this change leads to asserts.
e84b90
Previous commit fixes the root issue that motivated
e84b90
a1bc7b827e422e1ff065640d8ec5347c4aadfcd8 differently,
e84b90
so there's no longer a need for this change.
e84b90
e84b90
In the future, we might be able to drop checking vm_running
e84b90
completely, and check vm state directly.
e84b90
e84b90
Reported-by: Dietmar Maurer <dietmar@proxmox.com>
e84b90
Cc: qemu-stable@nongnu.org
e84b90
Acked-by: Jason Wang <jasowang@redhat.com>
e84b90
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
e84b90
(cherry picked from commit 9e8e8c48653471fa5fed447e388fdef57d4f6998)
e84b90
---
e84b90
 hw/virtio/virtio.c | 9 +--------
e84b90
 1 file changed, 1 insertion(+), 8 deletions(-)
e84b90
e84b90
diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c
e84b90
index ac22238..5c98180 100644
e84b90
--- a/hw/virtio/virtio.c
e84b90
+++ b/hw/virtio/virtio.c
e84b90
@@ -1108,10 +1108,7 @@ static void virtio_vmstate_change(void *opaque, int running, RunState state)
e84b90
     BusState *qbus = qdev_get_parent_bus(DEVICE(vdev));
e84b90
     VirtioBusClass *k = VIRTIO_BUS_GET_CLASS(qbus);
e84b90
     bool backend_run = running && (vdev->status & VIRTIO_CONFIG_S_DRIVER_OK);
e84b90
-
e84b90
-    if (running) {
e84b90
-        vdev->vm_running = running;
e84b90
-    }
e84b90
+    vdev->vm_running = running;
e84b90
 
e84b90
     if (backend_run) {
e84b90
         virtio_set_status(vdev, vdev->status);
e84b90
@@ -1124,10 +1121,6 @@ static void virtio_vmstate_change(void *opaque, int running, RunState state)
e84b90
     if (!backend_run) {
e84b90
         virtio_set_status(vdev, vdev->status);
e84b90
     }
e84b90
-
e84b90
-    if (!running) {
e84b90
-        vdev->vm_running = running;
e84b90
-    }
e84b90
 }
e84b90
 
e84b90
 void virtio_init(VirtIODevice *vdev, const char *name,