[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 36/86] virtio: re-order vm_running and use_started checks
From: |
Michael S. Tsirkin |
Subject: |
[PULL 36/86] virtio: re-order vm_running and use_started checks |
Date: |
Mon, 31 Oct 2022 08:52:26 -0400 |
From: Alex Bennée <alex.bennee@linaro.org>
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>
Message-Id: <20221014132108.2559156-1-alex.bennee@linaro.org>
Tested-by: Christian Borntraeger <borntraeger@linux.ibm.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.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;
}
--
MST
- [PULL 22/86] tests/acpi: update tables for new core count test, (continued)
- [PULL 22/86] tests/acpi: update tables for new core count test, Michael S. Tsirkin, 2022/10/31
- [PULL 18/86] hw/smbios: add core_count2 to smbios table type 4, Michael S. Tsirkin, 2022/10/31
- [PULL 30/86] hw/mem/cxl-type3: Add CXL CDAT Data Object Exchange, Michael S. Tsirkin, 2022/10/31
- [PULL 24/86] acpi: fadt: support revision 6.0 of the ACPI specification, Michael S. Tsirkin, 2022/10/31
- [PULL 32/86] tests/qtest/cxl-test: Remove temporary directories after testing, Michael S. Tsirkin, 2022/10/31
- [PULL 33/86] vhost: Change the sequence of device start, Michael S. Tsirkin, 2022/10/31
- [PULL 19/86] bios-tables-test: teach test to use smbios 3.0 tables, Michael S. Tsirkin, 2022/10/31
- [PULL 26/86] tests/acpi: virt: update ACPI MADT and FADT binaries, Michael S. Tsirkin, 2022/10/31
- [PULL 31/86] hw/pci-bridge/cxl-upstream: Add a CDAT table access DOE, Michael S. Tsirkin, 2022/10/31
- [PULL 35/86] hw/virtio/virtio-iommu-pci: Enforce the device is plugged on the root bus, Michael S. Tsirkin, 2022/10/31
- [PULL 36/86] virtio: re-order vm_running and use_started checks,
Michael S. Tsirkin <=
- [PULL 37/86] virtio: introduce __virtio_queue_reset(), Michael S. Tsirkin, 2022/10/31
- [PULL 38/86] virtio: introduce virtio_queue_reset(), Michael S. Tsirkin, 2022/10/31
- [PULL 28/86] hw/mem/cxl-type3: Add MSIX support, Michael S. Tsirkin, 2022/10/31
- [PULL 34/86] vhost-user: Support vhost_dev_start, Michael S. Tsirkin, 2022/10/31
- [PULL 39/86] virtio: introduce virtio_queue_enable(), Michael S. Tsirkin, 2022/10/31
- [PULL 40/86] virtio: core: vq reset feature negotation support, Michael S. Tsirkin, 2022/10/31
- [PULL 41/86] virtio-pci: support queue reset, Michael S. Tsirkin, 2022/10/31
- [PULL 42/86] virtio-pci: support queue enable, Michael S. Tsirkin, 2022/10/31
- [PULL 43/86] vhost: expose vhost_virtqueue_start(), Michael S. Tsirkin, 2022/10/31
- [PULL 44/86] vhost: expose vhost_virtqueue_stop(), Michael S. Tsirkin, 2022/10/31