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: Thu, 31 Mar 2011 16:28:23 +0200	[thread overview]
Message-ID: <4D948F87.9010109@domain.hid> (raw)
In-Reply-To: <AANLkTinAFpi1rAsU-DbgQUPKpEev4215evzRWmYZJzWP@mail.gmail.com>

Henri Roosen wrote:
> Did some more tracing to see why the lower priority thread is
> scheduled before the higher prio thread is ended.
> 
> The highest priority task makes a system call and gets relaxed by
> xnshadow_relax. The rpi is pushed here and a Linux call with
> LO_WAKEUP_REQ is scheduled. Then I see the scheduler scheduling to the
> ROOT task. So far so good!
> 
> In the Linux domain, we run into the lostage_handler, where the
> scheduled LO_WAKEUP_REQ is executed. Here there is a call to
> xnpod_schedule() which actually causes a switch back to the primary
> domain and the lower priority Xenomai task to be scheduled in, even
> before the wanted process is woken up.
>
> Now, I am unsure what is faulty here and maybe Philippe or someone can
> answer that. Personally I would have expected the xnpod_schedule (or
> xnsched_pick_next) to know about the rpi list and not schedule a lower
> priority task than of any on that list. I was unable to find such
> code.
>

Unless I am wrong, what happens is whait is intended, at least if we
read the comment:
		case LO_WAKEUP_REQ:
			/*
			 * We need to downgrade the root thread
			 * priority whenever the APC runs over a
			 * non-shadow, so that the temporary boost we
			 * applied in xnshadow_relax() is not
			 * spuriously inherited by the latter until
			 * the relaxed shadow actually resumes in
			 * secondary mode.
			 */
			rpi_clear_local(xnshadow_thread(current));
			xnpod_schedule();

Which means that we do not want other Linux kernel code than the
real-time thread itself to inherit from this thread priority. Except
that all the code from the switch to root thread to the lostage_handler
(which means any Linux currently preempted critical section) already
inherited the priority.

-- 
					    Gilles.


  reply	other threads:[~2011-03-31 14: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
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 [this message]
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=4D948F87.9010109@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.