All of lore.kernel.org
 help / color / mirror / Atom feed
From: Fabiano Rosas <farosas@suse.de>
To: Jie Song <mail@jiesong.me>, qemu-devel@nongnu.org
Cc: alex@shazbot.org, clg@redhat.com, peterx@redhat.com,
	avihaih@nvidia.com, Jie Song <songjie_yewu@cmss.chinamobile.com>
Subject: Re: [PATCH] vfio/migration: Use qemu_put_buffer_async to avoid an extra copy
Date: Thu, 26 Nov 2026 09:52:17 -0300	[thread overview]
Message-ID: <875wxjsqke.fsf@suse.de> (raw)
In-Reply-To: <20261120162026.31245-1-mail@jiesong.me>

Jie Song <mail@jiesong.me> writes:

> From: Jie Song <songjie_yewu@cmss.chinamobile.com>
>
> Replace qemu_put_buffer with qemu_put_buffer_async + qemu_fflush in
> vfio_save_block to avoid an unnecessary memcpy of device state data
> through QEMUFile's 32 KiB internal buffer.
>
> With qemu_put_buffer_async, the data_buffer pointer is added directly
> to the iov array. Since the next read overwrites the same buffer,
> flush immediately so that the channel has consumed the data before
> the buffer is reused.
>
> Signed-off-by: Jie Song <songjie_yewu@cmss.chinamobile.com>
> ---
>  hw/vfio/migration.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/hw/vfio/migration.c b/hw/vfio/migration.c
> index 69d50cebdd..e363250b79 100644
> --- a/hw/vfio/migration.c
> +++ b/hw/vfio/migration.c
> @@ -476,7 +476,8 @@ static ssize_t vfio_save_block(QEMUFile *f, VFIOMigration *migration)
>  
>      qemu_put_be64(f, VFIO_MIG_FLAG_DEV_DATA_STATE);
>      qemu_put_be64(f, data_size);
> -    qemu_put_buffer(f, migration->data_buffer, data_size);
> +    qemu_put_buffer_async(f, migration->data_buffer, data_size, false);
> +    qemu_fflush(f);
>      vfio_migration_add_bytes_transferred(data_size);
>  
>      trace_vfio_save_block(migration->vbasedev->name, data_size);

Acked-by: Fabiano Rosas <farosas@suse.de>


  reply	other threads:[~2026-11-26 12:52 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-20 16:20 [PATCH] vfio/migration: Use qemu_put_buffer_async to avoid an extra copy Jie Song
2026-11-26 12:52 ` Fabiano Rosas [this message]
2026-11-27 12:49 ` Peter Xu
2026-11-30  7:56 ` Cédric Le Goater

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=875wxjsqke.fsf@suse.de \
    --to=farosas@suse.de \
    --cc=alex@shazbot.org \
    --cc=avihaih@nvidia.com \
    --cc=clg@redhat.com \
    --cc=mail@jiesong.me \
    --cc=peterx@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=songjie_yewu@cmss.chinamobile.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.