qemu-e2k/include
Liran Alon b3e89c941a vhost-scsi: Allow user to enable migration
In order to perform a valid migration of a vhost-scsi device,
the following requirements must be met:
(1) The virtio-scsi device state needs to be saved & loaded.
(2) The vhost backend must be stopped before virtio-scsi device state
is saved:
  (2.1) Sync vhost backend state to virtio-scsi device state.
  (2.2) No further I/O requests are made by vhost backend to target
        SCSI device.
  (2.3) No further guest memory access takes place after VM is stopped.
(3) Requests in-flight to target SCSI device are completed before
    migration handover.
(4) Target SCSI device state needs to be saved & loaded into the
    destination host target SCSI device.

Previous commit ("vhost-scsi: Add VMState descriptor")
add support to save & load the device state using VMState.
This meets requirement (1).

When VM is stopped by migration thread (On Pre-Copy complete), the
following code path is executed:
migration_completion() -> vm_stop_force_state() -> vm_stop() ->
do_vm_stop().

do_vm_stop() calls first pause_all_vcpus() which pause all guest
vCPUs and then call vm_state_notify().
In case of vhost-scsi device, this will lead to the following code path
to be executed:
vm_state_notify() -> virtio_vmstate_change() ->
virtio_set_status() -> vhost_scsi_set_status() -> vhost_scsi_stop().
vhost_scsi_stop() then calls vhost_scsi_clear_endpoint() and
vhost_scsi_common_stop().

vhost_scsi_clear_endpoint() sends VHOST_SCSI_CLEAR_ENDPOINT ioctl to
vhost backend which will reach kernel's vhost_scsi_clear_endpoint()
which process all pending I/O requests and wait for them to complete
(vhost_scsi_flush()). This meets requirement (3).

vhost_scsi_common_stop() will stop the vhost backend.
As part of this stop, dirty-bitmap is synced and vhost backend state is
synced with virtio-scsi device state. As at this point guest vCPUs are
already paused, this meets requirement (2).

At this point we are left with requirement (4) which is target SCSI
device specific and therefore cannot be done by QEMU. Which is the main
reason why vhost-scsi adds a migration blocker.
However, as this can be handled either by an external orchestrator or
by using shared-storage (i.e. iSCSI), there is no reason to limit the
orchestrator from being able to explictly specify it wish to enable
migration even when VM have a vhost-scsi device.

Considering all the above, this commit allows orchestrator to explictly
specify that it is responsbile for taking care of requirement (4) and
therefore vhost-scsi should not add a migration blocker.

Reviewed-by: Nir Weiner <nir.weiner@oracle.com>
Reviewed-by: Bijan Mottahedeh <bijan.mottahedeh@oracle.com>
Signed-off-by: Liran Alon <liran.alon@oracle.com>
Message-Id: <20190416125912.44001-4-liran.alon@oracle.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
2019-06-02 21:32:06 -04:00
..
authz Clean up ill-advised or unusual header guards 2019-05-13 08:58:55 +02:00
block block: Propagate AioContext change to parents 2019-05-20 17:08:56 +02:00
chardev Clean up ill-advised or unusual header guards 2019-05-13 08:58:55 +02:00
crypto crypto: Change the qcrypto_random_bytes buffer type to void* 2019-05-22 12:38:54 -04:00
disas Normalize header guard symbol definition. 2019-05-13 08:58:55 +02:00
exec semihosting: move semihosting configuration into its own directory 2019-05-28 10:28:50 +01:00
fpu softfloat: Implement float128_to_uint32 2019-02-26 14:05:19 +00:00
hw vhost-scsi: Allow user to enable migration 2019-06-02 21:32:06 -04:00
io io: Make qio_channel_yield() interruptible 2019-02-25 15:03:19 +01:00
libdecnumber
migration migration/colo.h: Remove obsolete codes 2019-05-14 17:33:35 +01:00
monitor monitor: Clean up how monitor_disas() funnels output to monitor 2019-04-18 22:18:59 +02:00
net net: Add a network device specific self-announcement ability 2019-03-05 11:27:41 +08:00
qapi qapi: remove qmp_unregister_command() 2019-02-18 14:44:05 +01:00
qemu util: Add qemu_guest_getrandom and associated routines 2019-05-22 12:38:54 -04:00
qom cpus: Initialize pseudo-random seeds for all guest cpus 2019-05-22 12:38:54 -04:00
scsi Normalize header guard symbol definition. 2019-05-13 08:58:55 +02:00
standard-headers linux headers: update against Linux 5.2-rc1 2019-05-21 16:58:56 +02:00
sysemu semihosting: move semihosting configuration into its own directory 2019-05-28 10:28:50 +01:00
ui Normalize header guard symbol definition. 2019-05-13 08:58:55 +02:00
elf.h elf: Add RISC-V PSABI ELF header defines 2019-03-19 05:14:39 -07:00
glib-compat.h slirp: Move g_spawn_async_with_fds_qemu compatibility to slirp/ 2019-02-07 15:49:08 +02:00
qemu-common.h include: Include fprintf-fn.h only where needed 2019-04-18 22:18:59 +02:00
qemu-io.h qemu-io: Let command functions return error code 2018-06-11 16:18:45 +02:00
trace-tcg.h