All of lore.kernel.org
 help / color / mirror / Atom feed
From: Gilles Chanteperdrix <gilles.chanteperdrix@xenomai.org>
To: Henri Roosen <henriroosen@domain.hid>
Cc: xenomai@xenomai.org
Subject: Re: [Xenomai-help] Priority coupling broken?
Date: Fri, 01 Apr 2011 11:44:57 +0200	[thread overview]
Message-ID: <4D959E99.4020402@domain.hid> (raw)
In-Reply-To: <AANLkTimsAJMuamJsuEZ8p=OOHEt+oSyUzDr7OAsugewh@domain.hid>

Henri Roosen wrote:
> 
> Thanks Gilles for your input. This Priority Coupling stuff is a little
> complex and input about the corner cases is always welcome and
> helpful!
> 
> I did a little more tests with xnpod_schedule() commented out on
> LO_WAKEUP_REQ. Scheduling shows as expected to me: the lower and level
> primary tasks don't interrupt the migrated thread while higher
> priority tasks do interrupt that task. I have not seen any deadlocks
> yet or ran into corner cases, but of course I don't know all.
> 
> Now, looking back in the history of shadow.c I see that
> xnpod_schedule() was introduced when the xnsched_renice_root() was
> introduced, which is now part of rpi_clear_local. In my point of view,
> the xnpod_schedule() call is only needed when the
> xnsched_renice_root() has been done, so should be moved inside the if
> of rpi_clear_local. But again, it is my point of view and don't know
> all the corner cases.
> 
> In our case the scheduled task after the switch to secondary is
> actually mostly the IDLE task, thus calling the xnsched_renice_root
> and xnpod_schedule() for doing exactly that what is in the comment. So
> my main question remains: is the call to xnpod_schedule really needed
> here after xnsched_renice_root()? And if so, why doesn't the
> xnpod_schedule not take the priorities on the rpi list into account?

The current task when entering LO_WAKEUP_REQ is not a Xenomai task, so,
rip_clear_local disables the boost. At this point we have no guarantee
that "p" will be the next task scheduled, or that the next call to
schedule will schedule another task at all, so that we will pass by
do_schedule_event.

There may be a way to avoid this, but removing xnpod_schedule() is
certainly not it. Imagine that when we enter LO_WAKEUP_REQ, current is a
Linux real-time task with a higher priority than the Xenomai task, the
root thread will be unduly boosted until the moment where that task is
suspended and the Xenomai task can be at last scheduled. This would be a
plain sort of priority inversion.

-- 
					    Gilles.


  reply	other threads:[~2011-04-01  9:44 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
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 [this message]
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=4D959E99.4020402@domain.hid \
    --to=gilles.chanteperdrix@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.