All of lore.kernel.org
 help / color / mirror / Atom feed
From: Philippe Gerum <rpm@xenomai.org>
To: Henri Roosen <henriroosen@domain.hid>
Cc: xenomai@xenomai.org
Subject: Re: [Xenomai-help] Priority coupling broken?
Date: Tue, 29 Mar 2011 17:28:54 +0200	[thread overview]
Message-ID: <1301412534.2109.24.camel@domain.hid> (raw)
In-Reply-To: <AANLkTi=ptfmh+VVBB29cmsg10od0FLdxY=p-yGj3xLFb@domain.hid>

On Tue, 2011-03-29 at 16:41 +0200, Henri Roosen wrote:
> Hi,
> 
> I have several Xenomai RT threads (prio > 0) that get ready to run all
> at the same time. Priority coupling is enabled in the kernel.
> 
> If one of them (unfortunately) makes a Linux system call, I see that
> first other lower and same priority Xenomai tasks are scheduled before
> the switched task is run in the Linux domain. As I understand,
> priority coupling should prevent this.
> 
> To rule out a problem in the application, this is also tested with a
> simple application based on the rt_print example. In my opinion, with
> priority coupling enabled this should print:
> Wakeup! - I am - awake! - Me too!
> But I get:
> Wakeup! - I am - Me too! - awake!
> So task 2 gets run before task 3 completes in the Linux domain.
> 
> Please find attached the test application and the .config file.

The fine print with priority coupling is that it stops immediately
whenever the thread blocks linux-wise; this is actually why, after all
this time debugging it, I'm pondering now whether I should keep this
behavior/feature in 3.x.

Initially, this was aimed at enforcing the right scheduling sequence
with traditional RTOS APIs, specifically when it comes to create
threads, so that high priority children do run prior to low priority
parents (some legacy apps may expect this). But the fact is that this
behavior also carries a number of uncertainties, and having the thread
de-boosted when blocked by Linux is a serious one.

Anyway, please try the following:

- do not use rt_printf() to monitor the sequence, but a data array of
some sort to track the switches, and report the contents of that array
at the end of the test.

- replace gettimeofday() with sched_yield().

TIA,

> 
> Xenomai 2.5.6
> Linux 2.6.32.20
> adeos-ipipe-2.6.32.20-x86-2.7-03.patch
> 
> Thanks,
> Henri.
> _______________________________________________
> Xenomai-help mailing list
> Xenomai-help@domain.hid
> https://mail.gna.org/listinfo/xenomai-help

-- 
Philippe.




  reply	other threads:[~2011-03-29 15:28 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-29 14:41 [Xenomai-help] Priority coupling broken? Henri Roosen
2011-03-29 15:28 ` Philippe Gerum [this message]
2011-03-29 19:11   ` Gilles Chanteperdrix
2011-03-29 19:17     ` Philippe Gerum
2011-03-29 19:19       ` Gilles Chanteperdrix
2011-03-29 19:27         ` Philippe Gerum
2011-03-29 19:29           ` Gilles Chanteperdrix
2011-03-30  4:58             ` Philippe Gerum
2011-03-30  7:30               ` Henri Roosen
2011-03-30  8:15                 ` Philippe Gerum
2011-03-30 11:27                   ` Henri Roosen
2011-03-31 13:42                     ` Henri Roosen
2011-03-31 14:28                       ` Gilles Chanteperdrix
2011-03-31 14:44                         ` Henri Roosen
2011-03-31 14:50                         ` Gilles Chanteperdrix
2011-04-01  9:36                           ` Henri Roosen
2011-04-01  9:44                             ` Gilles Chanteperdrix
2011-04-01 11:20                             ` Philippe Gerum
2011-04-01 11:37                               ` Gilles Chanteperdrix
2011-04-01 13:07                                 ` Henri Roosen

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=1301412534.2109.24.camel@domain.hid \
    --to=rpm@xenomai.org \
    --cc=henriroosen@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.