From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KxRGx-0001h9-BX for qemu-devel@nongnu.org; Tue, 04 Nov 2008 14:09:03 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KxRGv-0001g4-Ld for qemu-devel@nongnu.org; Tue, 04 Nov 2008 14:09:02 -0500 Received: from [199.232.76.173] (port=35985 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KxRGv-0001fr-CV for qemu-devel@nongnu.org; Tue, 04 Nov 2008 14:09:01 -0500 Received: from fmmailgate01.web.de ([217.72.192.221]:39778) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1KxRGv-0007Ek-C4 for qemu-devel@nongnu.org; Tue, 04 Nov 2008 14:09:01 -0500 Message-ID: <49109DC2.5050809@web.de> Date: Tue, 04 Nov 2008 20:08:50 +0100 From: Jan Kiszka MIME-Version: 1.0 Subject: Re: [Qemu-devel] Re: [5578] Increase default IO timeout from 10ms to 5s References: <20081104113204.GA32125@shareable.org> <20081104.092231.-1384053398.imp@bsdimp.com> <491081EB.5070905@web.de> <20081104.105533.1649789414.imp@bsdimp.com> In-Reply-To: <20081104.105533.1649789414.imp@bsdimp.com> Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enigCCC26B80016FC496A41E331D" Sender: jan.kiszka@web.de Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "M. Warner Losh" Cc: qemu-devel@nongnu.org This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enigCCC26B80016FC496A41E331D Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable M. Warner Losh wrote: > In message: <491081EB.5070905@web.de> > Jan Kiszka writes: > : M. Warner Losh wrote: > : > In message: <20081104113204.GA32125@shareable.org> > : > Jamie Lokier 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. > : > : >=20 > : > : > According to the man page it moved to kernel at 2.6.16 but the = glibc > : > : > wrapper should be ok too. > : > :=20 > : > : If there's a glibc wrapper, it cannot be reliable... > : > :=20 > : > : *Looks at glibc source* > : > :=20 > : > : That's right. The glibc pselect() wrapper has the same race cond= ition > : > : which prompted this QEMU bug. If the signal arrives after unmask= ing > : > : and before select() in the wrapper, then blocks. > : > :=20 > : > : 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. > : >=20 > : > Which ones have a good kernel implementation of it? FreeBSD's is > : > currently approximately: > : >=20 > : > if (!mask) > : > _sigprocmask(mask, &oldmask); > : > /* here */ > : > select(); > : > if (!mask) > : > _sigprocmask(oldmask, NULL); > : >=20 > : > I'm assuming that the problem is due to a signal arriving at /* her= e */. > :=20 > : I guess those things happen under some kind of preemption lock, > : otherwise it would be a really poor implementation. >=20 > 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 --------------enigCCC26B80016FC496A41E331D Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.8 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iEYEARECAAYFAkkQncMACgkQniDOoMHTA+kZbACfWL6c2k8pSDALu5yAK7jxw7c4 5OYAn22V7PRMjST1Wh0wZjgbUcecfkb6 =iVtd -----END PGP SIGNATURE----- --------------enigCCC26B80016FC496A41E331D--