From: Philippe Gerum <rpm@xenomai.org>
To: Gilles Chanteperdrix <gilles.chanteperdrix@xenomai.org>
Cc: Petr Cervenka <grugh@domain.hid>, xenomai-help <xenomai@xenomai.org>
Subject: Re: [Xenomai-help] rtdm_event_timedwait returns -EINTR
Date: Sat, 02 May 2009 20:31:20 +0200 [thread overview]
Message-ID: <1241289080.26544.238.camel@domain.hid> (raw)
In-Reply-To: <49FC7466.1080602@domain.hid>
On Sat, 2009-05-02 at 18:27 +0200, Gilles Chanteperdrix wrote:
> Philippe Gerum wrote:
> > On Thu, 2009-04-30 at 17:27 +0200, Gilles Chanteperdrix wrote:
> >> Philippe Gerum wrote:
> >>> On Thu, 2009-04-30 at 07:09 -0700, Thomas Lockhart wrote:
> >>>>> Hello, I have a problem with rtdm_event_timedwait() function. It
> >>>>> sometimes ends prematurely with -EINTR error code. It depends on
> >>>>> special circumstances (CPU load, resizing console window in X, ...).
> >>>> In other areas of Xenomai when one sees a EINTR return one should
> >>>> reenter the original call. Like this (?):
> >>>>
> >>>> do {
> >>>> err = rt_task_wait_period(...)
> >>>> } while (err != -EINTR);
> >>>>
> >>> Just to clarify a few points more:
> >>>
> >>> Xenomai always tells the kernel that blocking (Xenomai) syscalls
> >>> _should_ be restarted when interrupted by a Linux signal (i.e.
> >>> -ERESTARTSYS is passed down to the kernel by the Xenomai core in that
> >>> case), and the kernel will actually restart that (Xenomai) syscall if no
> >>> handler was installed for such signal, or if SA_RESTART is set in the
> >>> sigaction() flags for the signal.
> >>>
> >>> In all other cases, the syscall will not be restarted despite the
> >>> "should restart" hint passed to the Linux kernel, and -EINTR will be
> >>> eventually returned by the native API syscall (or errno == EINTR for the
> >>> POSIX skin). The way other skins (e.g. VxWorks) will propagate the
> >>> -EINTR condition on interrupted syscalls to the user program depends on
> >>> their respective API conventions, but they will propagate that
> >>> information in a way or another as well, if the syscall was not
> >>> restarted.
> >>>
> >>> Additionally, syscalls may be forcibly unblocked via rt_task_unblock(),
> >>> which will cause -EINTR to be returned to the caller as well. This is
> >>> totally unrelated to Linux signal management though.
> >> Are not there cases where the kernel/libc "jumps back" to the beginning
> >> of the syscall when asked to restart a syscall ?
> >
> > Yes, that is how a restart is done, simply by moving the instruction
> > pointer back.
> >
> >> Is not it what causes
> >> the problem with rt_event_wait ?
> >> In fact if it is the problem then it
> >> means that the user-space skins should always convert delays to an
> >> absolute expiry date, and pass this as argument to the syscall, so that
> >> blindly restarting the syscall will work as expected. However, if that
> >> is the case, it means that we have quite a few syscalls to fix...
> >>
> >
> > This is why 2.5 introduces *_until() call forms for most timed syscalls,
> > to specify absolute delays.
>
> Ok. But the one with fixed relative delays can be fixed too, doing like
> nanosleep: in case of -EINTR, copy back to user-space the next delay in
> case the syscall is restarted.
>
I'm not saying this can't be fixed, I'm just saying that this is not
mandatory to fix them to have proper behavior based on the new *_until()
forms.
--
Philippe.
next prev parent reply other threads:[~2009-05-02 18:31 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <200904301508.29432@domain.hid>
[not found] ` <200904301509.13094@domain.hid>
[not found] ` <200904301510.8382@domain.hid>
[not found] ` <200904301511.15875@domain.hid>
[not found] ` <200904301512.9035@domain.hid>
[not found] ` <200904301513.12716@domain.hid>
[not found] ` <200904301514.6099@domain.hid>
[not found] ` <200904301515.16182@domain.hid>
2009-04-30 13:16 ` [Xenomai-help] rtdm_event_timedwait returns -EINTR Petr Cervenka
2009-04-30 14:09 ` Thomas Lockhart
2009-04-30 14:55 ` Philippe Gerum
2009-04-30 15:27 ` Gilles Chanteperdrix
2009-04-30 18:37 ` Philippe Gerum
2009-05-02 16:27 ` Gilles Chanteperdrix
2009-05-02 18:31 ` Philippe Gerum [this message]
2009-05-04 8:24 ` Petr Cervenka
2009-05-04 8:41 ` Philippe Gerum
2009-04-30 22:40 ` Thomas Lockhart
2009-05-01 9:34 ` Philippe Gerum
2009-05-01 9:40 ` Philippe Gerum
2009-05-01 21:35 ` Thomas Lockhart
2009-05-01 22:07 ` Philippe Gerum
2009-05-01 23:44 ` Thomas Lockhart
[not found] <200905041613.30996@domain.hid>
[not found] ` <200905041614.26154@domain.hid>
[not found] ` <200905041615.12763@domain.hid>
[not found] ` <200905041616.11698@domain.hid>
[not found] ` <200905041617.10314@domain.hid>
[not found] ` <200905041618.6444@domain.hid>
[not found] ` <200905041619.25024@domain.hid>
[not found] ` <200905041620.27181@domain.hid>
2009-05-04 14:20 ` Petr Cervenka
2009-05-04 14:22 ` Philippe Gerum
2009-05-04 14:29 ` Philippe Gerum
2009-05-04 16:11 ` Petr Cervenka
2009-05-04 16:21 ` Gilles Chanteperdrix
2009-05-05 8:22 ` Petr Cervenka
2009-05-04 17:15 ` Philippe Gerum
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=1241289080.26544.238.camel@domain.hid \
--to=rpm@xenomai.org \
--cc=gilles.chanteperdrix@xenomai.org \
--cc=grugh@domain.hid \
--cc=xenomai@xenomai.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.