From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Kxkz6-0001qU-O1 for qemu-devel@nongnu.org; Wed, 05 Nov 2008 11:11:56 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Kxkz5-0001pJ-5l for qemu-devel@nongnu.org; Wed, 05 Nov 2008 11:11:56 -0500 Received: from [199.232.76.173] (port=57960 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Kxkz4-0001p9-QU for qemu-devel@nongnu.org; Wed, 05 Nov 2008 11:11:54 -0500 Received: from bsdimp.com ([199.45.160.85]:54603 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 1Kxkz3-0002DY-SR for qemu-devel@nongnu.org; Wed, 05 Nov 2008 11:11:54 -0500 Date: Wed, 05 Nov 2008 09:10:15 -0700 (MST) Message-Id: <20081105.091015.232928302.imp@bsdimp.com> Subject: Re: [Qemu-devel] Re: [5578] Increase default IO timeout from 10ms to 5s From: "M. Warner Losh" In-Reply-To: <20081105150042.GJ13630@shareable.org> References: <20081104113204.GA32125@shareable.org> <20081104.092231.-1384053398.imp@bsdimp.com> <20081105150042.GJ13630@shareable.org> 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: jamie@shareable.org Cc: jan.kiszka@web.de, qemu-devel@nongnu.org In message: <20081105150042.GJ13630@shareable.org> Jamie Lokier writes: : M. Warner Losh wrote: : > : 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 */. : : If that's _kernel_ code and the kernel behaves like Linux, it's not a : problem because signals don't affect the control flow until returning : to userspace, meaning the select() will return EINTR. It is currently user level code, and I'm looking at moving it into the kernel, but I need to understand the race being talked about here. : If that's userspace (libc) code, then it is no good. Nobody should : ever have written crappy pselect() wrappers in userspace (i.e. Glibc), : it just causes portable software to have to keep a whitelist of : reliable pselect() platforms (i.e. not Linux) instead of just using : it. Same for crappy broken pread() and pwrite() wrappers. Why is it no good. What is the race here? Is it just the oldmask thing and multiple callers to select, or is it something else? And if it is the oldmask thing, why wouldn't multiple callers of pselect mess it up depending on what order they have. I must have missed the original description of the race and why it matters.. Warner