[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL v2 11/14] vhost-scsi: The vhost backend should be sto
From: |
Michael S. Tsirkin |
Subject: |
[Qemu-devel] [PULL v2 11/14] vhost-scsi: The vhost backend should be stopped when the VM is not running |
Date: |
Mon, 3 Jun 2019 14:09:01 -0400 |
From: Nir Weiner <address@hidden>
vhost-scsi doesn’t takes into account whether the VM is running or not in
order to decide if it should start/stop vhost backend.
This would lead to vhost backend still being active when VM's RunState
suddenly change to stopped.
An example of when this issue is encountered is when Live-Migration Pre-Copy
phase completes. As in this case, VM state will be changed to stopped (while
vhost backend is still active), which will result in
virtio_vmstate_change() -> virtio_set_status() -> vhost_scsi_set_status()
executed but vhost_scsi_set_status() will just return without stopping
vhost backend.
To handle this, change code to consider that vhost processing should be
stopped when VM is not running. Similar to how it is done in vhost-vsock
device at vhost_vsock_set_status().
Fixes: 5e9be92d7752 ("vhost-scsi: new device supporting the tcm_vhost Linux
kernel module”)
Reviewed-by: Bijan Mottahedeh <address@hidden>
Reviewed-by: Liran Alon <address@hidden>
Signed-off-by: Nir Weiner <address@hidden>
Message-Id: <address@hidden>
Reviewed-by: Michael S. Tsirkin <address@hidden>
Signed-off-by: Michael S. Tsirkin <address@hidden>
Reviewed-by: Stefan Hajnoczi <address@hidden>
---
hw/scsi/vhost-scsi.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/hw/scsi/vhost-scsi.c b/hw/scsi/vhost-scsi.c
index 61e2e57da9..ca42cff1b9 100644
--- a/hw/scsi/vhost-scsi.c
+++ b/hw/scsi/vhost-scsi.c
@@ -114,6 +114,10 @@ static void vhost_scsi_set_status(VirtIODevice *vdev,
uint8_t val)
VHostSCSICommon *vsc = VHOST_SCSI_COMMON(s);
bool start = (val & VIRTIO_CONFIG_S_DRIVER_OK);
+ if (!vdev->vm_running) {
+ start = false;
+ }
+
if (vsc->dev.started == start) {
return;
}
--
MST
- [Qemu-devel] [PULL v2 02/14] acpi: pci: use build_append_foo() API to construct MCFG, (continued)
- [Qemu-devel] [PULL v2 02/14] acpi: pci: use build_append_foo() API to construct MCFG, Michael S. Tsirkin, 2019/06/03
- [Qemu-devel] [PULL v2 03/14] pcie: Simplify pci_adjust_config_limit(), Michael S. Tsirkin, 2019/06/03
- [Qemu-devel] [PULL v2 04/14] pci: Make is_bridge a bool, Michael S. Tsirkin, 2019/06/03
- [Qemu-devel] [PULL v2 05/14] pci: Fold pci_get_bus_devfn() into its sole caller, Michael S. Tsirkin, 2019/06/03
- [Qemu-devel] [PULL v2 08/14] vhost: fix incorrect print type, Michael S. Tsirkin, 2019/06/03
- [Qemu-devel] [PULL v2 09/14] vhost: fix memory leak in vhost_user_scsi_realize, Michael S. Tsirkin, 2019/06/03
- [Qemu-devel] [PULL v2 07/14] vhost: remove the dead code, Michael S. Tsirkin, 2019/06/03
- [Qemu-devel] [PULL v2 06/14] docs: smbios: remove family=x from type2 entry description, Michael S. Tsirkin, 2019/06/03
- [Qemu-devel] [PULL v2 10/14] bios-tables-test: add diff allowed list, Michael S. Tsirkin, 2019/06/03
- [Qemu-devel] [PULL v2 11/14] vhost-scsi: The vhost backend should be stopped when the VM is not running,
Michael S. Tsirkin <=
- [Qemu-devel] [PULL v2 12/14] vhost-scsi: Add VMState descriptor, Michael S. Tsirkin, 2019/06/03
- [Qemu-devel] [PULL v2 13/14] vhost-scsi: Allow user to enable migration, Michael S. Tsirkin, 2019/06/03
- [Qemu-devel] [PULL v2 14/14] bios-tables-test: list all tables that differ, Michael S. Tsirkin, 2019/06/03
- Re: [Qemu-devel] [PULL v2 00/14] virtio, pci, pc: cleanups, features, Peter Maydell, 2019/06/04
- Re: [Qemu-devel] [PULL v2 00/14] virtio, pci, pc: cleanups, features, Michael S. Tsirkin, 2019/06/04
- Re: [Qemu-devel] [PULL v2 00/14] virtio, pci, pc: cleanups, features, Peter Maydell, 2019/06/04
- Re: [Qemu-devel] [PULL v2 00/14] virtio, pci, pc: cleanups, features, Michael S. Tsirkin, 2019/06/04