]> git.proxmox.com Git - mirror_qemu.git/commit
s390x/pv: Add support for asynchronous teardown for reboot
authorClaudio Imbrenda <imbrenda@linux.ibm.com>
Tue, 14 Feb 2023 16:30:35 +0000 (17:30 +0100)
committerThomas Huth <thuth@redhat.com>
Mon, 27 Feb 2023 08:15:39 +0000 (09:15 +0100)
commitc3a073c6109dfa34ed4d3b5d8238b97e696aaf20
tree47c183daf1e82792700caa3a0469c58c3b288ba0
parente73a0f4075a78de9a62beeddb41c54a4090e0777
s390x/pv: Add support for asynchronous teardown for reboot

This patch adds support for the asynchronous teardown for reboot for
protected VMs.

When attempting to tear down a protected VM, try to use the new
asynchronous interface first. If that fails, fall back to the classic
synchronous one.

The asynchronous interface involves invoking the new
KVM_PV_ASYNC_DISABLE_PREPARE command for the KVM_S390_PV_COMMAND ioctl.

This will prepare the current protected VM for asynchronous teardown.
Once the protected VM is prepared for teardown, execution can continue
immediately.

Once the protected VM has been prepared, a new thread is started to
actually perform the teardown. The new thread uses the new
KVM_PV_ASYNC_DISABLE command for the KVM_S390_PV_COMMAND ioctl. The
previously prepared protected VM is torn down in the new thread.

Once KVM_PV_ASYNC_DISABLE is invoked, it is possible to use
KVM_PV_ASYNC_DISABLE_PREPARE again. If a protected VM has already been
prepared and its cleanup has not started, it will not be possible to
prepare a new VM. In that case the classic synchronous teardown has to
be performed.

The synchronous teardown will now also clean up any prepared VMs whose
asynchronous teardown has not been initiated yet.

This considerably speeds up the reboot of a protected VM; for large VMs
especially, it could take a long time to perform a reboot with the
traditional synchronous teardown, while with this patch it is almost
immediate.

Signed-off-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Message-Id: <20230214163035.44104-3-imbrenda@linux.ibm.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
hw/s390x/pv.c
hw/s390x/s390-virtio-ccw.c
include/hw/s390x/pv.h