All of lore.kernel.org
 help / color / mirror / Atom feed
From: Anthony Liguori <anthony@codemonkey.ws>
To: qemu-devel@nongnu.org
Cc: ian.jackson@eu.citrix.com
Subject: Re: [Qemu-devel] [PATCH 1/2] Use fd signal trick to break us out of select; do not sigwait
Date: Thu, 28 Aug 2008 15:16:44 -0500	[thread overview]
Message-ID: <48B707AC.8040301@codemonkey.ws> (raw)
In-Reply-To: <69b245c5aebe9d170b7641a266d5700f9c9420c0.1219763627.git.Ian.Jackson@eu.citrix.com>

Ian Jackson wrote:
> * Use of SIGUSR2 to interrupt select() does not work because signals
>   which arrive just before entry to select() do not interrupt it.
>
> * The sigwait approach to detecting aio does not work properly because
>   some versions of glibc forget to block signals on the private aio
>   thread under some hard-to-reproduce conditions.  This means that
>   blocking SIGUSR2 is ineffective; the signals can be lost and the
>   program can block in sigwait (!)
>
> So instead we use the time-honoured self-pipe trick: in the signal
> handler we write to a pipe, which we select on when we want to wait
> for the signal, and which we read from (to empty out) just before
> actually doing the `top half' processing which deals with the condition
> to which the signal relates.
>
> We use the existing fd handler infrastructure to run the desired
> completion code out of the main event loop; in the aio completion wait
> we use a cut-down version of the same arrangements.
>   

Hi Ian,

Somehow, I didn't see this until today--sorry for the delayed response.  
I personally prefer the patch I posted.  I've also got another patch on 
top of it that refactors the aio API so that multiple aio 
implementations can be used.  I notice you leave the qemu_aio_poll() in 
place in the main loop, is there a reason you left it there?

Regards,

Anthony Liguori

  parent reply	other threads:[~2008-08-28 20:17 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-26 14:21 [Qemu-devel] [PATCH 1/2] Use fd signal trick to break us out of select; do not sigwait Ian Jackson
2008-08-26 14:42 ` [Qemu-devel] [PATCH 2/2] Introduce #define QEMU_ASYNC_EVENTLOOP to simplify #ifdefs Ian Jackson
2008-08-28 20:18   ` Anthony Liguori
2008-08-29  9:31     ` Ian Jackson
2008-09-07  2:45       ` Anthony Liguori
2008-08-28 20:16 ` Anthony Liguori [this message]
2008-08-29  9:25   ` [Qemu-devel] [PATCH 1/2] Use fd signal trick to break us out of select; do not sigwait Ian Jackson

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=48B707AC.8040301@codemonkey.ws \
    --to=anthony@codemonkey.ws \
    --cc=ian.jackson@eu.citrix.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.