qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Hanna Czenczek <hreitz@redhat.com>
To: Eugenio Perez Martin <eperezma@redhat.com>
Cc: qemu-devel@nongnu.org, virtio-fs@redhat.com,
	"Michael S . Tsirkin" <mst@redhat.com>,
	Stefan Hajnoczi <stefanha@redhat.com>,
	German Maglione <gmaglione@redhat.com>
Subject: Re: [PATCH v2 3/4] vhost: Add high-level state save/load functions
Date: Fri, 21 Jul 2023 18:09:13 +0200	[thread overview]
Message-ID: <4109ebd0-ccd7-9e3c-8a32-b4db998d8e39@redhat.com> (raw)
In-Reply-To: <CAJaqyWdAjbJxFE7BTzw6zYrr9_80qsxWrvq=kXjKMDTMtYKOKg@mail.gmail.com>

On 21.07.23 17:18, Eugenio Perez Martin wrote:
> On Wed, Jul 12, 2023 at 1:17 PM Hanna Czenczek <hreitz@redhat.com> wrote:
>> vhost_save_backend_state() and vhost_load_backend_state() can be used by
>> vhost front-ends to easily save and load the back-end's state to/from
>> the migration stream.
>>
>> Because we do not know the full state size ahead of time,
>> vhost_save_backend_state() simply reads the data in 1 MB chunks, and
>> writes each chunk consecutively into the migration stream, prefixed by
>> its length.  EOF is indicated by a 0-length chunk.
>>
>> Signed-off-by: Hanna Czenczek <hreitz@redhat.com>
>> ---
>>   include/hw/virtio/vhost.h |  35 +++++++
>>   hw/virtio/vhost.c         | 204 ++++++++++++++++++++++++++++++++++++++
>>   2 files changed, 239 insertions(+)

[...]

>> +int vhost_load_backend_state(struct vhost_dev *dev, QEMUFile *f, Error **errp)
>> +{
>> +    size_t transfer_buf_size = 0;
>> +    void *transfer_buf = NULL;
>> +    g_autoptr(GError) g_err = NULL;
>> +    int pipe_fds[2], read_fd = -1, write_fd = -1, reply_fd = -1;
>> +    int ret;

[...]

>> +    ret = 0;
>> +fail:
>> +    g_free(transfer_buf);
> Nitpick, but transfer_buf could have the g_autofree parameter.

Ah, sure, thanks!

Hanna



  reply	other threads:[~2023-07-21 16:10 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-12 11:16 [PATCH v2 0/4] vhost-user: Back-end state migration Hanna Czenczek
2023-07-12 11:16 ` [PATCH v2 1/4] vhost-user.rst: Migrating back-end-internal state Hanna Czenczek
2023-07-18 15:57   ` Stefan Hajnoczi
2023-07-19 16:33     ` Hanna Czenczek
2023-07-20 11:43       ` Stefan Hajnoczi
2023-07-18 16:12   ` Stefan Hajnoczi
2023-07-20 11:32     ` [Virtio-fs] " Hanna Czenczek
2023-07-12 11:17 ` [PATCH v2 2/4] vhost-user: Interface for migration state transfer Hanna Czenczek
2023-07-18 18:32   ` Stefan Hajnoczi
2023-07-20 12:13   ` [Virtio-fs] " Hao Xu
2023-07-20 13:20     ` Hanna Czenczek
2023-07-20 15:05       ` Hao Xu
2023-07-21  8:07         ` Hanna Czenczek
2023-07-21  8:23           ` Hao Xu
2023-07-12 11:17 ` [PATCH v2 3/4] vhost: Add high-level state save/load functions Hanna Czenczek
2023-07-18 18:42   ` Stefan Hajnoczi
2023-07-20 11:42     ` Hanna Czenczek
2023-07-21 15:18   ` Eugenio Perez Martin
2023-07-21 16:09     ` Hanna Czenczek [this message]
2023-07-12 11:17 ` [PATCH v2 4/4] vhost-user-fs: Implement internal migration Hanna Czenczek
2023-07-18 18:44   ` Stefan Hajnoczi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4109ebd0-ccd7-9e3c-8a32-b4db998d8e39@redhat.com \
    --to=hreitz@redhat.com \
    --cc=eperezma@redhat.com \
    --cc=gmaglione@redhat.com \
    --cc=mst@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    --cc=virtio-fs@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).