From: "Cédric Le Goater" <clg@redhat.com>
To: Jie Song <mail@jiesong.me>, qemu-devel@nongnu.org
Cc: alex@shazbot.org, peterx@redhat.com, farosas@suse.de,
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: Mon, 30 Nov 2026 08:56:00 +0100 [thread overview]
Message-ID: <ea3e6adc-e73a-4fe6-8eb0-83286172b50d@redhat.com> (raw)
In-Reply-To: <20261120162026.31245-1-mail@jiesong.me>
On 11/20/26 17:20, Jie Song wrote:
> 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);
I will queue this change for QEMU 12.0.
Thanks,
C.
prev parent reply other threads:[~2026-11-30 7:57 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
2026-11-27 12:49 ` Peter Xu
2026-11-30 7:56 ` Cédric Le Goater [this message]
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=ea3e6adc-e73a-4fe6-8eb0-83286172b50d@redhat.com \
--to=clg@redhat.com \
--cc=alex@shazbot.org \
--cc=avihaih@nvidia.com \
--cc=farosas@suse.de \
--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.