From: Thomas Gleixner <tglx@linutronix.de>
To: Blaise Gassend <blaise@willowgarage.com>
Cc: LKML <linux-kernel@vger.kernel.org>,
Jeremy Leibs <leibs@willowgarage.com>,
Darren Hart <dvhltc@us.ibm.com>,
Peter Zijlstra <peterz@infradead.org>
Subject: Re: ERESTARTSYS escaping from sem_wait with RTLinux patch
Date: Sat, 10 Oct 2009 19:59:06 +0200 (CEST) [thread overview]
Message-ID: <alpine.LFD.2.00.0910101931080.9428@localhost.localdomain> (raw)
In-Reply-To: <1255165747.6385.117.camel@doodleydee>
Blaise,
On Sat, 10 Oct 2009, Blaise Gassend wrote:
> 1) Where is the ERESTARTSYS being prevented from getting to user space?
>
> The only likely place I see for preventing ERESTARTSYS from escaping to
> user space is in arch/*/kernel/signal*.c. However, I don't see how the
> code there is being called if there no signal pending. Is that a path
> for ERESTARTSYS to escape from the kernel?
>
> The following comment in kernel/futex.h in futex_wait makes me wonder if
> two threads are getting marked as ERESTARTSYS. The first one to leave
> the kernel processes the signal and restarts. The second one doesn't
> have a signal to handle, so it returns to user space without getting
> into signal*.c and wreaks havoc.
>
> (...)
> /*
> * We expect signal_pending(current), but another thread may
> * have handled it for us already.
> */
> if (!abs_time)
> return -ERESTARTSYS;
> (...)
If the task is woken by a signal, then the task private flag
TIF_SIGPENDING is set, but in case of a process wide signal the signal
might have been handled by another thread of the same process before
that thread reaches the signal handling code, but then ERESTARTSYS is
handled gracefully. So you seem to trigger a code path which does not
go through do_signal.
> 2) Why would this be happening only with RT kernels?
Slightly different timing and locking semantics.
> 3) Any suggestions on the best place to patch/workaround this?
>
> My understanding is that if I was to treat ERESTARTSYS as an EAGAIN,
> most applications would be perfectly happy. Would bad things happen if I
> replaced the ERESTARTSYS in futex_wait with an EAGAIN?
No workarounds please. We really want to know what's wrong.
Two things to look at:
1) Does that happen with 2.6.31.2-rt13 as well ?
2) Add a check to the code path where ERESTARTSYS is returned:
if (!signal_pending(current))
printk(KERN_ERR ".....");
If you can see that message then we'll look further. I'll give your
script a test ride on my systems as well.
Thanks,
tglx
next prev parent reply other threads:[~2009-10-10 18:00 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-10-10 9:09 Blaise Gassend
2009-10-10 16:40 ` ERESTARTSYS escaping from sem_wait with Preempt-RT Blaise Gassend
2009-10-10 17:59 ` Thomas Gleixner [this message]
2009-10-10 19:08 ` ERESTARTSYS escaping from sem_wait with RTLinux patch Jeremy Leibs
2009-10-11 2:07 ` Jeremy Leibs
2009-10-11 5:48 ` Jeremy Leibs
2009-10-12 14:16 ` Darren Hart
[not found] ` <1255384010.10236.123.camel@lts.willowgarage.com>
[not found] ` <4AD3BD57.6080703@us.ibm.com>
[not found] ` <4AD3D6AE.2050609@us.ibm.com>
[not found] ` <4AD3FFB0.5030405@us.ibm.com>
2009-10-13 4:54 ` Darren Hart
2009-10-13 8:56 ` Blaise Gassend
2009-10-13 15:13 ` Darren Hart
2009-10-13 18:45 ` Thomas Gleixner
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=alpine.LFD.2.00.0910101931080.9428@localhost.localdomain \
--to=tglx@linutronix.de \
--cc=blaise@willowgarage.com \
--cc=dvhltc@us.ibm.com \
--cc=leibs@willowgarage.com \
--cc=linux-kernel@vger.kernel.org \
--cc=peterz@infradead.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
all inboxes | Powered by JetHome®