From: Peter Xu <peterx@redhat.com>
To: Fabiano Rosas <farosas@suse.de>
Cc: qemu-devel@nongnu.org, Prasad Pandit <ppandit@redhat.com>,
Lukas Straub <lukasstraub2@web.de>,
Juraj Marcin <jmarcin@redhat.com>
Subject: Re: [PATCH 09/10] migration/colo: Move qemu_fflush() closer to its user for fb
Date: Mon, 26 Jan 2026 16:06:53 -0500 [thread overview]
Message-ID: <aXfXbR2voiOjM4Pf@x1.local> (raw)
In-Reply-To: <871pjgifm9.fsf@suse.de>
On Fri, Jan 23, 2026 at 11:10:54AM -0300, Fabiano Rosas wrote:
> Peter Xu <peterx@redhat.com> writes:
>
> > COLO caches all device states in a buffer channel `fb'. Flush it right
> > before pushing the buffer to make sure everything needed will be flushed,
> > add a comment explaning it.
> >
> > Signed-off-by: Peter Xu <peterx@redhat.com>
> > ---
> > migration/colo.c | 4 ++--
> > 1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/migration/colo.c b/migration/colo.c
> > index f92803dd29..e2307f1907 100644
> > --- a/migration/colo.c
> > +++ b/migration/colo.c
> > @@ -472,8 +472,6 @@ static int colo_do_checkpoint_transaction(MigrationState *s,
> > qemu_savevm_state_complete_precopy_iterable(s->to_dst_file, false);
> > qemu_put_byte(s->to_dst_file, QEMU_VM_EOF);
> >
> > - qemu_fflush(fb);
> > -
> > /*
> > * We need the size of the VMstate data in Secondary side,
> > * With which we can decide how much data should be read.
> > @@ -484,6 +482,8 @@ static int colo_do_checkpoint_transaction(MigrationState *s,
> > goto out;
> > }
> >
> > + /* Flush to make sure everything lands bioc->data */
> > + qemu_fflush(fb);
> > qemu_put_buffer(s->to_dst_file, bioc->data, bioc->usage);
> > ret = qemu_fflush(s->to_dst_file);
>
> Reviewed-by: Fabiano Rosas <farosas@suse.de>
>
> Wait, aren't we wasting a memcpy here? Isn't this the same, but without
> the copy of bioc->data to s->to_dst_file->buf:
>
> qemu_fflush(fb); // ensure bioc->data is populated
> qemu_fflush(s->to_dst_file); // send buffered data from migration stream
> qemu_put_buffer_async(s->to_dst_file, bioc->data, ...); // point s->to_dst_file->iov to bioc->data
> qemu_fflush(s->to_dst_file); // send s->to_dst_file->iov contents
Good point! Same to postcopy..
I quickly measured a small VM in postcopy path, async put can shrink the
time needed (plus the flush) from 91us to 38us. Not a huge difference, but
I don't see why we don't do it either. I'll test more and add those when I
repost.
--
Peter Xu
next prev parent reply other threads:[~2026-01-26 21:07 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-21 22:33 [PATCH 00/10] migration/colo: small cleanup series Peter Xu
2026-01-21 22:33 ` [PATCH 01/10] migration: Introduce qemu_savevm_send_* helpers Peter Xu
2026-01-23 13:23 ` Fabiano Rosas
2026-01-21 22:33 ` [PATCH 02/10] migration: Use qemu_savevm_send_header() in qemu_save_device_state() Peter Xu
2026-01-23 13:23 ` Fabiano Rosas
2026-01-21 22:33 ` [PATCH 03/10] migration: Remove one migration_in_colo_state() occurance Peter Xu
2026-01-23 13:32 ` Fabiano Rosas
2026-01-26 19:23 ` Peter Xu
2026-01-21 22:33 ` [PATCH 04/10] migration/savevm: Remove SaveStateEntry.is_ram Peter Xu
2026-01-23 13:47 ` Fabiano Rosas
2026-01-26 19:44 ` Peter Xu
2026-01-26 22:00 ` Fabiano Rosas
2026-01-21 22:33 ` [PATCH 05/10] migration/colo: Unwrap qemu_savevm_live_state() Peter Xu
2026-01-23 13:48 ` Fabiano Rosas
2026-01-26 20:44 ` Peter Xu
2026-01-21 22:33 ` [PATCH 06/10] migration/colo: Remove call to send switchover start event Peter Xu
2026-01-23 13:49 ` Fabiano Rosas
2026-01-21 22:33 ` [PATCH 07/10] colo: Forbid VM resume during checkpointing Peter Xu
2026-01-23 13:49 ` Fabiano Rosas
2026-01-21 22:33 ` [PATCH 08/10] migration/colo: Use the RAM iterable helper directly Peter Xu
2026-01-23 14:00 ` Fabiano Rosas
2026-01-21 22:33 ` [PATCH 09/10] migration/colo: Move qemu_fflush() closer to its user for fb Peter Xu
2026-01-23 14:10 ` Fabiano Rosas
2026-01-26 21:06 ` Peter Xu [this message]
2026-01-21 22:33 ` [PATCH 10/10] migration: Drop iterable_only in qemu_savevm_state_complete_precopy Peter Xu
2026-01-23 14:11 ` Fabiano Rosas
2026-01-25 19:29 ` [PATCH 00/10] migration/colo: small cleanup series Lukas Straub
2026-01-26 17:23 ` Peter Xu
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=aXfXbR2voiOjM4Pf@x1.local \
--to=peterx@redhat.com \
--cc=farosas@suse.de \
--cc=jmarcin@redhat.com \
--cc=lukasstraub2@web.de \
--cc=ppandit@redhat.com \
--cc=qemu-devel@nongnu.org \
/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.