All of lore.kernel.org
 help / color / mirror / Atom feed
From: Gilles Chanteperdrix <gilles.chanteperdrix@xenomai.org>
To: "Stoidner, Christoph" <c.stoidner@arvero.de>
Cc: "xenomai@xenomai.org" <xenomai@xenomai.org>
Subject: Re: [Xenomai] Sleeping function called from invalid context
Date: Thu, 11 Dec 2014 11:47:13 +0100	[thread overview]
Message-ID: <20141211104713.GC21808@hermes.click-hack.org> (raw)
In-Reply-To: <14309ee2cb7e45c9a01e6e1504c5bed5@EX132MBOX1A.de2.local>

On Thu, Dec 11, 2014 at 10:29:58AM +0000, Stoidner, Christoph wrote:
> >> >> RT drivers are also not installed on our system.
> >> >
> >> > Maybe I look wrong at nucleus/shadow.c, but I see only two reasons
> >> > for for xnshadow_relax being called for a secondary mode syscall:
> >> >
> >> > - a call requiring primary mode was made and the switchback flag is
> >> > set (which itself can have two reasons, either the fact that the
> >> > syscall uses it, the only one being currently rt_timer_set_mode, or
> >> > the fact that the caller runs with the SCHED_OTHER policy and does
> >> > not hold a mutex)
> >> >
> >> > - a call with the adaptive flag was made, handled in primary mode,
> >> > but returned -ENOSYS, which means the call needs to be retried in
> >> > secondary mode.
> >> >
> >>
> >> You are right. We have implemented some syscalls the require primary mode (since they could block) but should switch back to secondary. These syscalls are using attributes
> >>
> >>     __xn_exec_primary | __xn_exec_switchback
> >
> > Well then the tasks blocked with a stack trace like what you showed
> > are blocked when coming back from such syscalls. Does this happen
> > often, or are these syscall seldom used?
> 
> In this application the switchback syscalls are used rather often. 

Two things to note:

- mode switches do not go without some overhead, it is almost never
a good idea to force the switchback, since the nucleus will switch
the target thread to secondary mode when needed anyway, all that you
risk is to introduce useless mode switches, so, if you do it, you
must have a good reason for it;

- there is a risk of overflowing the nucleus queue for relax
requests, you will see a message in the kernel logs when this
happens if you enable debugging of the nucleus
(CONFIG_XENO_OPT_DEBUG_NUCLEUS).



-- 
					    Gilles.


  reply	other threads:[~2014-12-11 10:47 UTC|newest]

Thread overview: 49+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-10 18:58 [Xenomai] Sleeping function called from invalid context Stoidner, Christoph
2014-12-10 19:01 ` Gilles Chanteperdrix
2014-12-11 10:00   ` Stoidner, Christoph
2014-12-11 10:05     ` Gilles Chanteperdrix
2014-12-11 10:18       ` Stoidner, Christoph
2014-12-11 10:22         ` Gilles Chanteperdrix
2014-12-11 10:29           ` Stoidner, Christoph
2014-12-11 10:47             ` Gilles Chanteperdrix [this message]
2014-12-11 11:17               ` Stoidner, Christoph
2014-12-11 14:47                 ` Gilles Chanteperdrix
2014-12-11 15:47                   ` Stoidner, Christoph
2014-12-11 16:06                     ` Gilles Chanteperdrix
2014-12-11 16:31                       ` Stoidner, Christoph
2014-12-11 16:38                         ` Gilles Chanteperdrix
2014-12-11 19:23                           ` Stoidner, Christoph
2014-12-12 16:42                             ` Stoidner, Christoph
2014-12-15 11:42                               ` Stoidner, Christoph
2014-12-15 13:23                                 ` Gilles Chanteperdrix
2014-12-15 13:29                                   ` Stoidner, Christoph
2014-12-15 14:20                                     ` Gilles Chanteperdrix
2014-12-15 15:11                                       ` Stoidner, Christoph
2014-12-15 15:19                                         ` Gilles Chanteperdrix
2014-12-17 12:24                                           ` Stoidner, Christoph
2014-12-17 12:38                                             ` Gilles Chanteperdrix
2014-12-17 13:22                                             ` Gilles Chanteperdrix
2014-12-17 15:46                                               ` Gilles Chanteperdrix
2014-12-17 22:40                                                 ` Stoidner, Christoph
  -- strict thread matches above, loose matches on Subject: below --
2014-12-06 14:19 Stoidner, Christoph
2014-12-06 14:25 ` Gilles Chanteperdrix
2014-12-06 15:11   ` Stoidner, Christoph
2014-12-07 12:32     ` Stoidner, Christoph
2014-12-07 12:40 ` Gilles Chanteperdrix
2014-12-07 13:50   ` Stoidner, Christoph
2014-12-07 13:52     ` Gilles Chanteperdrix
2014-12-07 15:05       ` Stoidner, Christoph
2014-12-09 20:06         ` Stoidner, Christoph
2014-12-09 20:08           ` Gilles Chanteperdrix
2014-12-09 20:18             ` Stoidner, Christoph
2014-12-09 20:24               ` Gilles Chanteperdrix
2014-12-09 20:34                 ` Stoidner, Christoph
2014-12-09 20:37                   ` Gilles Chanteperdrix
2014-12-09 20:47                     ` Stoidner, Christoph
2014-12-09 20:55                       ` Gilles Chanteperdrix
2014-12-09 20:49           ` Stoidner, Christoph
2014-12-09 20:59             ` Gilles Chanteperdrix
2014-12-10 16:23               ` Stoidner, Christoph
2014-12-10 16:26                 ` Gilles Chanteperdrix
2014-12-10 18:23                   ` Stoidner, Christoph
2014-12-10 18:41                     ` Gilles Chanteperdrix

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=20141211104713.GC21808@hermes.click-hack.org \
    --to=gilles.chanteperdrix@xenomai.org \
    --cc=c.stoidner@arvero.de \
    --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.