All of lore.kernel.org
 help / color / mirror / Atom feed
From: Anthony Liguori <aliguori@us.ibm.com>
To: Paolo Bonzini <pbonzini@redhat.com>, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 1.3] aio: avoid livelock behavior for Win32
Date: Mon, 26 Nov 2012 15:49:12 -0600	[thread overview]
Message-ID: <87mwy4rq5j.fsf@codemonkey.ws> (raw)
In-Reply-To: <1353682783-25624-1-git-send-email-pbonzini@redhat.com>

Paolo Bonzini <pbonzini@redhat.com> writes:

> The repeated calls to WaitForMultipleObjects may cause a livelock in aio_poll,
> where no progress is made on bottom halves.  This patch matches the behavior
> of the POSIX code.
>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>         Found by the new unit tests.

Applied. Thanks.

Regards,

Anthony Liguori

>
>  aio-win32.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/aio-win32.c b/aio-win32.c
> index a84eb71..cec4646 100644
> --- a/aio-win32.c
> +++ b/aio-win32.c
> @@ -173,7 +173,7 @@ bool aio_poll(AioContext *ctx, bool blocking)
>      }
>  
>      /* wait until next event */
> -    for (;;) {
> +    while (count > 0) {
>          int timeout = blocking ? INFINITE : 0;
>          int ret = WaitForMultipleObjects(count, events, FALSE, timeout);
>  
> @@ -209,6 +209,9 @@ bool aio_poll(AioContext *ctx, bool blocking)
>                  g_free(tmp);
>              }
>          }
> +
> +        /* Try again, but only call each handler once.  */
> +        events[ret - WAIT_OBJECT_0] = events[--count];
>      }
>  
>      return progress;
> -- 
> 1.8.0

      reply	other threads:[~2012-11-26 21:49 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-23 14:59 [Qemu-devel] [PATCH 1.3] aio: avoid livelock behavior for Win32 Paolo Bonzini
2012-11-26 21:49 ` Anthony Liguori [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=87mwy4rq5j.fsf@codemonkey.ws \
    --to=aliguori@us.ibm.com \
    --cc=pbonzini@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.