From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KxQ8v-0000sl-9j for qemu-devel@nongnu.org; Tue, 04 Nov 2008 12:56:41 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KxQ8t-0000s3-SZ for qemu-devel@nongnu.org; Tue, 04 Nov 2008 12:56:40 -0500 Received: from [199.232.76.173] (port=52288 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KxQ8t-0000ru-Km for qemu-devel@nongnu.org; Tue, 04 Nov 2008 12:56:39 -0500 Received: from bsdimp.com ([199.45.160.85]:60805 helo=harmony.bsdimp.com) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1KxQ8t-0008A0-Ad for qemu-devel@nongnu.org; Tue, 04 Nov 2008 12:56:39 -0500 Date: Tue, 04 Nov 2008 10:55:33 -0700 (MST) Message-Id: <20081104.105533.1649789414.imp@bsdimp.com> Subject: Re: [Qemu-devel] Re: [5578] Increase default IO timeout from 10ms to 5s From: "M. Warner Losh" In-Reply-To: <491081EB.5070905@web.de> References: <20081104113204.GA32125@shareable.org> <20081104.092231.-1384053398.imp@bsdimp.com> <491081EB.5070905@web.de> Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: jan.kiszka@web.de Cc: qemu-devel@nongnu.org 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. : > : > : > : > 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? Warner