qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] win32: fix main-loop busy loop on socket/fd eve


From: Marc-André Lureau
Subject: Re: [Qemu-devel] [PATCH] win32: fix main-loop busy loop on socket/fd event
Date: Wed, 04 Jan 2017 21:39:38 +0000

Hi

On Wed, Jan 4, 2017 at 10:23 PM Paolo Bonzini <address@hidden> wrote:

>
> > Paolo suggested to me on irc to call event_notifier_test_and_clear()
> > after select() >0 from aio-win32.c's aio_prepare. Unfortunately, not all
> > fds associated with ctx->notifiers are in AIO fd handlers set.
> > (qemu_set_nonblock() in util/oslib-win32.c calls qemu_fd_register()).
>
> That makes sense.  Out of curiosity, what is a practical case of a socket
> that is nonblocking but doesn't have an attached handler?
>
>
Good question, qio_channel_socket_set_blocking() calls qemu_set_nonblock().
But it seems to also use its own source handler
qio_channel_create_socket_watch(), so the AIO notifier is probably needless
here.

Another possibility (this one requires much more attention to avoid missing
> some edge case; however, it should be easy to verify if it fixes the busy
> loop) could be to move aio_notify_accept to just before setting
> ctx->notify_me.
> This would work for both aio-posix and aio-win32.
>
>
 --- a/async.c
+++ b/async.c
@@ -232,8 +232,8 @@ aio_ctx_check(GSource *source)
     AioContext *ctx = (AioContext *) source;
     QEMUBH *bh;

-    atomic_and(&ctx->notify_me, ~1);
     aio_notify_accept(ctx);
+    atomic_and(&ctx->notify_me, ~1);

That? doesn't work here.

thanks
-- 
Marc-André Lureau


reply via email to

[Prev in Thread] Current Thread [Next in Thread]