[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] Re: [5578] Increase default IO timeout from 10ms to 5s
From: |
Jan Kiszka |
Subject: |
Re: [Qemu-devel] Re: [5578] Increase default IO timeout from 10ms to 5s |
Date: |
Wed, 05 Nov 2008 19:21:40 +0100 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686 (x86_64); de; rv:1.8.1.12) Gecko/20080226 SUSE/2.0.0.12-1.1 Thunderbird/2.0.0.12 Mnenhy/0.7.5.666 |
M. Warner Losh wrote:
> In message: <address@hidden>
> Jamie Lokier <address@hidden> 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.
From the Linux man page on [p]select:
"The reason that pselect() is needed is that if one wants to wait for
either a signal or for a file descriptor to become ready, then an atomic
test is needed to prevent race conditions. (Suppose the signal handler
sets a global flag and returns. Then a test of this global flag followed
by a call of select() could hang indefinitely if the signal arrived just
after the test but just before the call. By contrast, pselect() allows
one to first block signals, handle the signals that have come in, then
call pselect() with the desired sigmask, avoiding the race.)"
So the unmasking and possible blocking on select must be done
atomically. And that is only feasible in kernel land.
Jan
signature.asc
Description: OpenPGP digital signature
- Re: [Qemu-devel] Re: [5578] Increase default IO timeout from 10ms to 5s, (continued)
- Re: [Qemu-devel] Re: [5578] Increase default IO timeout from 10ms to 5s, andrzej zaborowski, 2008/11/04
- Re: [Qemu-devel] Re: [5578] Increase default IO timeout from 10ms to 5s, Jan Kiszka, 2008/11/04
- Re: [Qemu-devel] Re: [5578] Increase default IO timeout from 10ms to 5s, andrzej zaborowski, 2008/11/04
- Re: [Qemu-devel] Re: [5578] Increase default IO timeout from 10ms to 5s, Jamie Lokier, 2008/11/04
- Re: [Qemu-devel] Re: [5578] Increase default IO timeout from 10ms to 5s, M. Warner Losh, 2008/11/04
- Re: [Qemu-devel] Re: [5578] Increase default IO timeout from 10ms to 5s, Jan Kiszka, 2008/11/04
- Re: [Qemu-devel] Re: [5578] Increase default IO timeout from 10ms to 5s, M. Warner Losh, 2008/11/04
- Re: [Qemu-devel] Re: [5578] Increase default IO timeout from 10ms to 5s, Jan Kiszka, 2008/11/04
- Re: [Qemu-devel] Re: [5578] Increase default IO timeout from 10ms to 5s, Jamie Lokier, 2008/11/05
- Re: [Qemu-devel] Re: [5578] Increase default IO timeout from 10ms to 5s, M. Warner Losh, 2008/11/05
- Re: [Qemu-devel] Re: [5578] Increase default IO timeout from 10ms to 5s,
Jan Kiszka <=
- Re: [Qemu-devel] Re: [5578] Increase default IO timeout from 10ms to 5s, Daniel P. Berrange, 2008/11/05
- Re: [Qemu-devel] Re: [5578] Increase default IO timeout from 10ms to 5s, andrzej zaborowski, 2008/11/05
- Re: [Qemu-devel] Re: [5578] Increase default IO timeout from 10ms to 5s, Daniel P. Berrange, 2008/11/05
- Re: [Qemu-devel] Re: [5578] Increase default IO timeout from 10ms to 5s, Jamie Lokier, 2008/11/05
- Re: [Qemu-devel] Re: [5578] Increase default IO timeout from 10ms to 5s, Jamie Lokier, 2008/11/05
- Re: [Qemu-devel] Re: [5578] Increase default IO timeout from 10ms to 5s, M. Warner Losh, 2008/11/06
- Re: [Qemu-devel] Re: [5578] Increase default IO timeout from 10ms to 5s, Avi Kivity, 2008/11/04