qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Virtio-fs] [RFC 1/2] vhost-user: Add interface for virtio-fs migrat


From: Hanna Czenczek
Subject: Re: [Virtio-fs] [RFC 1/2] vhost-user: Add interface for virtio-fs migration
Date: Fri, 17 Mar 2023 18:53:22 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.7.1

On 17.03.23 18:39, Anton Kuchin wrote:
On 13/03/2023 19:48, Hanna Czenczek wrote:
Add a virtio-fs-specific vhost-user interface to facilitate migrating
back-end-internal state.  We plan to migrate the internal state simply
as a binary blob after the streaming phase, so all we need is a way to
transfer such a blob from and to the back-end.  We do so by using a
dedicated area of shared memory through which the blob is transferred in
chunks.

This patch adds the following vhost operations (and implements them for
vhost-user):

- FS_SET_STATE_FD: The front-end passes a dedicated shared memory area
   to the back-end.  This area will be used to transfer state via the
   other two operations.
   (After the transfer FS_SET_STATE_FD detaches the shared memory area
   again.)

- FS_GET_STATE: The front-end asks the back-end to place a chunk of
   internal state into the shared memory area.

- FS_SET_STATE: The front-end puts a chunk of internal state into the
   shared memory area, and asks the back-end to fetch it.

On the source side, the back-end is expected to serialize its internal
state either when FS_SET_STATE_FD is invoked, or when FS_GET_STATE is
invoked the first time.  On subsequent FS_GET_STATE calls, it memcpy()s
parts of that serialized state into the shared memory area.

On the destination side, the back-end is expected to collect the state
blob over all FS_SET_STATE calls, and then deserialize and apply it once
FS_SET_STATE_FD detaches the shared memory area.

Signed-off-by: Hanna Czenczek <hreitz@redhat.com>
---
  include/hw/virtio/vhost-backend.h |   9 ++
  include/hw/virtio/vhost.h         |  68 +++++++++++++++
  hw/virtio/vhost-user.c            | 138 ++++++++++++++++++++++++++++++
  hw/virtio/vhost.c                 |  29 +++++++
  4 files changed, 244 insertions(+)


[...]

+static ssize_t vhost_user_fs_get_state(struct vhost_dev *dev,
+                                       uint64_t state_offset,
+                                       size_t size)
+{

Am I right to assume that vrings are supposed to be stopped to get/set state? If I am shouldn't we check it before sending message or do you believe it is
better to return error from backend in these cases?

Good point!  Yes, the vrings should be stopped.  I don’t verify this currently, but it makes sense to do so both on the qemu and the virtiofsd side.

Hanna




reply via email to

[Prev in Thread] Current Thread [Next in Thread]