Skip to content

Commit 80f4d02

Browse files
mstsirkinmdroth
authored andcommitted
Revert "virtio: don't call device on !vm_running"
This reverts commit a1bc7b827e422e1ff065640d8ec5347c4aadfcd8. virtio: don't call device on !vm_running It turns out that virtio net assumes that vm_running is updated before device status callback in many places, so this change leads to asserts. Previous commit fixes the root issue that motivated a1bc7b827e422e1ff065640d8ec5347c4aadfcd8 differently, so there's no longer a need for this change. In the future, we might be able to drop checking vm_running completely, and check vm state directly. Reported-by: Dietmar Maurer <[email protected]> Cc: [email protected] Acked-by: Jason Wang <[email protected]> Signed-off-by: Michael S. Tsirkin <[email protected]> (cherry picked from commit 9e8e8c4) Signed-off-by: Michael Roth <[email protected]>
1 parent 074e347 commit 80f4d02

File tree

1 file changed

+1
-8
lines changed

1 file changed

+1
-8
lines changed

hw/virtio/virtio.c

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1108,10 +1108,7 @@ static void virtio_vmstate_change(void *opaque, int running, RunState state)
11081108
BusState *qbus = qdev_get_parent_bus(DEVICE(vdev));
11091109
VirtioBusClass *k = VIRTIO_BUS_GET_CLASS(qbus);
11101110
bool backend_run = running && (vdev->status & VIRTIO_CONFIG_S_DRIVER_OK);
1111-
1112-
if (running) {
1113-
vdev->vm_running = running;
1114-
}
1111+
vdev->vm_running = running;
11151112

11161113
if (backend_run) {
11171114
virtio_set_status(vdev, vdev->status);
@@ -1124,10 +1121,6 @@ static void virtio_vmstate_change(void *opaque, int running, RunState state)
11241121
if (!backend_run) {
11251122
virtio_set_status(vdev, vdev->status);
11261123
}
1127-
1128-
if (!running) {
1129-
vdev->vm_running = running;
1130-
}
11311124
}
11321125

11331126
void virtio_init(VirtIODevice *vdev, const char *name,

0 commit comments

Comments
 (0)