qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Jan Kiszka <jan.kiszka@web.de>
To: "M. Warner Losh" <imp@bsdimp.com>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] Re: [5578] Increase default IO timeout from 10ms to 5s
Date: Tue, 04 Nov 2008 20:08:50 +0100	[thread overview]
Message-ID: <49109DC2.5050809@web.de> (raw)
In-Reply-To: <20081104.105533.1649789414.imp@bsdimp.com>

[-- Attachment #1: Type: text/plain, Size: 2217 bytes --]

M. Warner Losh wrote:
> In message: <491081EB.5070905@web.de>
>             Jan Kiszka <jan.kiszka@web.de> writes:
> : M. Warner Losh wrote:
> : > In message: <20081104113204.GA32125@shareable.org>
> : >             Jamie Lokier <jamie@shareable.org> writes:
> : > : andrzej zaborowski wrote:
> : > : > > My man page even warns that the Linux
> : > : > > kernel is not implementing it yet, though I don't think this still
> : > : > > applies to recent 2.6.2x kernels.
> : > : > 
> : > : > According to the man page it moved to kernel at 2.6.16 but the glibc
> : > : > wrapper should be ok too.
> : > : 
> : > : If there's a glibc wrapper, it cannot be reliable...
> : > : 
> : > : *Looks at glibc source*
> : > : 
> : > : That's right.  The glibc pselect() wrapper has the same race condition
> : > : which prompted this QEMU bug.  If the signal arrives after unmasking
> : > : and before select() in the wrapper, then blocks.
> : > : 
> : > : In other words, don't use pselect() if you might run on a kernel older
> : > : than 2.6.16, or on a host architecture which adds pselect() in a later
> : > : kernel version.  Also, I wouldn't be surprised if older versions of
> : > : some BSDs have similar dodgy wrappers.
> : > 
> : > Which ones have a good kernel implementation of it?  FreeBSD's is
> : > currently approximately:
> : > 
> : > 	if (!mask)
> : > 		_sigprocmask(mask, &oldmask);
> : > 	/* here */
> : > 	select();
> : > 	if (!mask)
> : > 		_sigprocmask(oldmask, NULL);
> : > 
> : > I'm assuming that the problem is due to a signal arriving at /* here */.
> : 
> : I guess those things happen under some kind of preemption lock,
> : otherwise it would be a really poor implementation.
> 
> Why?  There's races there anyway.  IF you have a mutex to prevent
> multiple calls, doesn't that serialize calls to select?

[ sorting my mind ] What I meant was that some care will likely be taken
to prevent signal delivery _to userspace_ between the unmasking and the
select() call. At least Linux does delivery on syscall return, so should
FreeBSD do. I guess that signals arriving around "/* here */" will
simply prevent select() to block (or even run).

Jan


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 258 bytes --]

  reply	other threads:[~2008-11-04 19:09 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-31 18:40 [Qemu-devel] [5578] Increase default IO timeout from 10ms to 5s Anthony Liguori
2008-10-31 18:52 ` Anthony Liguori
2008-11-02 19:08   ` [Qemu-devel] " Jan Kiszka
2008-11-03 20:04     ` Anthony Liguori
2008-11-03 20:36       ` Jan Kiszka
2008-11-03 21:50         ` Jan Kiszka
2008-11-03 22:00           ` Anthony Liguori
2008-11-03 22:03             ` Jan Kiszka
2008-11-04  8:07             ` andrzej zaborowski
2008-11-04  8:22               ` Jan Kiszka
2008-11-04  8:33                 ` andrzej zaborowski
2008-11-04 11:32                   ` Jamie Lokier
2008-11-04 16:22                     ` M. Warner Losh
2008-11-04 17:10                       ` Jan Kiszka
2008-11-04 17:55                         ` M. Warner Losh
2008-11-04 19:08                           ` Jan Kiszka [this message]
2008-11-05 15:00                       ` Jamie Lokier
2008-11-05 16:10                         ` M. Warner Losh
2008-11-05 18:21                           ` Jan Kiszka
2008-11-05 18:41                             ` Daniel P. Berrange
2008-11-05 20:16                             ` andrzej zaborowski
2008-11-05 20:28                               ` Daniel P. Berrange
2008-11-05 23:38                                 ` Jamie Lokier
2008-11-06  0:53                           ` Jamie Lokier
2008-11-06  5:19                             ` M. Warner Losh
2008-11-04  8:29           ` Avi Kivity
2008-10-31 19:41 ` [Qemu-devel] " Jamie Lokier
2008-10-31 20:13   ` Anthony Liguori

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=49109DC2.5050809@web.de \
    --to=jan.kiszka@web.de \
    --cc=imp@bsdimp.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).