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] Fast-sync and auto-relaxed priority 0 threads
Date: Thu, 12 May 2011 14:50:24 +0200	[thread overview]
Message-ID: <4DCBD790.4050604@domain.hid> (raw)
In-Reply-To: <BANLkTikenoYE=42uhjRq=DeP5FT9sip-dg@domain.hid>

On 05/12/2011 02:07 PM, Henri Roosen wrote:
> Hi,
> 
> We are using the auto-relax patches on top of the latest Xenomai 2.5.6
> release. This means our priority 0 task is in secondary domain most of
> the time.
> 
> We've seen a lot of domain switching and gatekeeper activity when this
> task is acquiring a mutex which is not locked. Of course an
> auto-relaxed prio 0 thread will do domain switching more often, but in
> this case because we have fast sync enabled I would expect it doesn't
> have to make a kernel call thus no switching..
> 
> Looking into the code I've found that at rt_mutex_acquire_inner there
> is explicitly a check for secondary domain. This must have been done
> while xnsynch_fast_acquire can only be called from primary domain. Is
> that the case?? In the implementation behind xnsynch_fast_acquire I
> cannot find a reason why it cannot be called from secondary domain.
> Can anyone comment on this?
> 
> It would save a lot of overhead for our priority 0 task if we could
> have fast sync in secondary mode. All suggestions are welcome!

Yes, the automatic switch to primary mode is made on purpose. It is a
kind of priority inheritance, when a thread holds a mutex, this mutex
may be shared with a primary mode only thread, so, we do not want the
linux scheduler to take the decision of preempting this task, and create
a priority inversion.

It is hard to do this differently: if a real-time thread arrives and try
and take the mutex while the priority 0 thread is preempted by Linux
scheduler, there is not much we can do without hacking savagely the
Linux scheduler.

What we can do however, is do this only for threads with priority
inheritance.

-- 
					    Gilles.


  reply	other threads:[~2011-05-12 12:50 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-12 12:07 [Xenomai-help] Fast-sync and auto-relaxed priority 0 threads Henri Roosen
2011-05-12 12:50 ` Gilles Chanteperdrix [this message]
2011-05-12 14:44   ` 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=4DCBD790.4050604@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.