qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [RFC PATCH] virtio: re-order vm_running and use_started checks
@ 2022-10-14 13:21 Alex Bennée
  2022-10-14 13:54 ` Christian Borntraeger
                   ` (4 more replies)
  0 siblings, 5 replies; 14+ messages in thread
From: Alex Bennée @ 2022-10-14 13:21 UTC (permalink / raw)
  To: qemu-devel; +Cc: Alex Bennée, Christian Borntraeger, Michael S. Tsirkin

During migration the virtio device state can be restored before we
restart the VM. As no devices can be running while the VM is paused it
makes sense to bail out early in that case.

This returns the order introduced in:

 9f6bcfd99f (hw/virtio: move vm_running check to virtio_device_started)

to what virtio-sock was doing longhand.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Cc: Christian Borntraeger <borntraeger@linux.ibm.com>
---
 include/hw/virtio/virtio.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/include/hw/virtio/virtio.h b/include/hw/virtio/virtio.h
index f41b4a7e64..ebb58feaac 100644
--- a/include/hw/virtio/virtio.h
+++ b/include/hw/virtio/virtio.h
@@ -385,14 +385,14 @@ static inline bool virtio_is_big_endian(VirtIODevice *vdev)
 
 static inline bool virtio_device_started(VirtIODevice *vdev, uint8_t status)
 {
-    if (vdev->use_started) {
-        return vdev->started;
-    }
-
     if (!vdev->vm_running) {
         return false;
     }
 
+    if (vdev->use_started) {
+        return vdev->started;
+    }
+
     return status & VIRTIO_CONFIG_S_DRIVER_OK;
 }
 
-- 
2.34.1



^ permalink raw reply related	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2022-11-04 17:52 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-10-14 13:21 [RFC PATCH] virtio: re-order vm_running and use_started checks Alex Bennée
2022-10-14 13:54 ` Christian Borntraeger
2022-10-17 21:00 ` Philippe Mathieu-Daudé
2022-10-26 20:26 ` Michael S. Tsirkin
2022-11-03 16:31 ` Michael S. Tsirkin
2022-11-04 15:56 ` Michael S. Tsirkin
2022-11-04 15:59   ` Christian Borntraeger
2022-11-04 16:13     ` Michael S. Tsirkin
2022-11-04 16:14     ` Michael S. Tsirkin
2022-11-04 16:51       ` Christian Borntraeger
2022-11-04 16:58         ` Christian Borntraeger
2022-11-04 17:51           ` Michael S. Tsirkin
2022-11-04 16:31   ` Alex Bennée
2022-11-04 17:46     ` Michael S. Tsirkin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).