[PATCH 02/13] migration: Properly wait on G_IO_IN when peeking messages

Peter Xu posted 13 patches 3 weeks, 1 day ago
Maintainers: Alex Williamson <alex@shazbot.org>, "Cédric Le Goater" <clg@redhat.com>, "Daniel P. Berrangé" <berrange@redhat.com>, Hailiang Zhang <zhanghailiang@xfusion.com>, Peter Xu <peterx@redhat.com>, Fabiano Rosas <farosas@suse.de>, Li Zhijian <lizhijian@fujitsu.com>
[PATCH 02/13] migration: Properly wait on G_IO_IN when peeking messages
Posted by Peter Xu 3 weeks, 1 day ago
migration_channel_read_peek() used to do explicit waits of a short period
when peeking message needs retry.  Replace it with explicit polls on the io
channel, exactly like what qemu_fill_buffer() does.

Signed-off-by: Peter Xu <peterx@redhat.com>
---
 migration/channel.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/migration/channel.c b/migration/channel.c
index a547b1fbfe..462cc183e1 100644
--- a/migration/channel.c
+++ b/migration/channel.c
@@ -135,12 +135,7 @@ int migration_channel_read_peek(QIOChannel *ioc,
             break;
         }
 
-        /* 1ms sleep. */
-        if (qemu_in_coroutine()) {
-            qemu_co_sleep_ns(QEMU_CLOCK_REALTIME, 1000000);
-        } else {
-            g_usleep(1000);
-        }
+        qio_channel_wait_cond(ioc, G_IO_IN);
     }
 
     return 0;
-- 
2.50.1
Re: [PATCH 02/13] migration: Properly wait on G_IO_IN when peeking messages
Posted by Daniel P. Berrangé 3 weeks ago
On Wed, Oct 22, 2025 at 03:26:01PM -0400, Peter Xu wrote:
> migration_channel_read_peek() used to do explicit waits of a short period
> when peeking message needs retry.  Replace it with explicit polls on the io
> channel, exactly like what qemu_fill_buffer() does.
> 
> Signed-off-by: Peter Xu <peterx@redhat.com>
> ---
>  migration/channel.c | 7 +------
>  1 file changed, 1 insertion(+), 6 deletions(-)

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>


With regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|


Re: [PATCH 02/13] migration: Properly wait on G_IO_IN when peeking messages
Posted by Peter Xu 2 weeks, 3 days ago
On Fri, Oct 24, 2025 at 01:02:06PM +0100, Daniel P. Berrangé wrote:
> On Wed, Oct 22, 2025 at 03:26:01PM -0400, Peter Xu wrote:
> > migration_channel_read_peek() used to do explicit waits of a short period
> > when peeking message needs retry.  Replace it with explicit polls on the io
> > channel, exactly like what qemu_fill_buffer() does.
> > 
> > Signed-off-by: Peter Xu <peterx@redhat.com>
> > ---
> >  migration/channel.c | 7 +------
> >  1 file changed, 1 insertion(+), 6 deletions(-)
> 
> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>

Thanks both for the fast reviews. I queued patches 1-2 in advance for 10.2.

-- 
Peter Xu


Re: [PATCH 02/13] migration: Properly wait on G_IO_IN when peeking messages
Posted by Vladimir Sementsov-Ogievskiy 3 weeks, 1 day ago
On 22.10.25 22:26, Peter Xu wrote:
> migration_channel_read_peek() used to do explicit waits of a short period
> when peeking message needs retry.  Replace it with explicit polls on the io
> channel, exactly like what qemu_fill_buffer() does.
> 
> Signed-off-by: Peter Xu<peterx@redhat.com>

Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>


-- 
Best regards,
Vladimir