]> git.ipfire.org Git - thirdparty/qemu.git/commit
vhost: return failure if stop virtqueue failed in vhost_dev_stop
authorHaoqian He <haoqian.he@smartx.com>
Wed, 16 Apr 2025 02:47:27 +0000 (22:47 -0400)
committerMichael S. Tsirkin <mst@redhat.com>
Wed, 14 May 2025 09:39:14 +0000 (05:39 -0400)
commit5a317017b827e338358792cd07663f8ea25f1ffe
tree20622a94b6b117dbb9b589f66b6c5c3c711b67a8
parente0f300b36da1ee794fd81aa95f56e7bc9f010d46
vhost: return failure if stop virtqueue failed in vhost_dev_stop

This patch captures the error of vhost_virtqueue_stop() in vhost_dev_stop()
and returns the error upward.

Specifically, if QEMU is disconnected from the vhost backend, some actions
in vhost_dev_stop() will fail, such as sending vhost-user messages to the
backend (GET_VRING_BASE, SET_VRING_ENABLE) and vhost_reset_status.

Considering that both set_vring_enable and vhost_reset_status require setting
the specific virtio feature bit, we can capture vhost_virtqueue_stop()'s
error to indicate that QEMU has lost connection with the backend.

This patch is the pre patch for 'vhost-user: return failure if backend crashes
when live migration', which makes the live migration aware of the loss of
connection with the vhost-user backend and aborts the live migration.

Signed-off-by: Haoqian He <haoqian.he@smartx.com>
Message-Id: <20250416024729.3289157-3-haoqian.he@smartx.com>
Tested-by: Lei Yang <leiyang@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
hw/virtio/vhost.c
include/hw/virtio/vhost.h