All of lore.kernel.org
 help / color / mirror / Atom feed
From: Gilles Chanteperdrix <gilles.chanteperdrix@xenomai.org>
To: Stephen Bryant <sbxenomai@domain.hid>
Cc: xenomai@xenomai.org
Subject: Re: [Xenomai-help] Unexpected preemption of highest priority thread
Date: Wed, 21 Jul 2010 15:06:33 +0200	[thread overview]
Message-ID: <4C46F0D9.4030906@domain.hid> (raw)
In-Reply-To: <AANLkTikJgzkkxQyM8DQqVz17ovJmPiIkdZMIFJImExIE@mail.gmail.com>

Stephen Bryant wrote:
> On 21 July 2010 12:06, Gilles Chanteperdrix
> <gilles.chanteperdrix@xenomai.org
> <mailto:gilles.chanteperdrix@xenomai.org>> wrote:
> 
>     Stephen Bryant wrote:
>     > Hi,
>     >
>     > I have some code (simplified example below) which uses
>     > 'pthread_wait_np(&Overrun)' within a while loop, using a period of
>     > 1,000,000ns (1ms) which has been set using
>     'pthread_make_periodic_np()'.
>     > This wakes the thread up less than 2,000ns late in general, sometimes
>     > 20,000ns late, and at most less than 45,000ns late.
> 
>     Since you do not tell us, I guess you are running on x86. Depending on
>     the x86 you are running, 45 us may be high.
> 
> 
> Yes, it is x86, sorry for the omission. What sort of latencies would you
> expect me to see?

If it is for instance, a core 2 duo, it should be around, say, 10 or
20us. If on the other hand, it is a geode, then 45us may be OK. The
actual results also depend on the system load, an unloaded core 2 will
have average latencies under 10us.

>     This reasoning is flawed: you may be preempted by interrupts any time.
>     Including just about at the time where you were going to exit the busy
>     loop. Unless you spin irqs off, and only reenable irqs when the job the
>     thread is supposed to be doing is done. And if you have an SMI issue,
>     even turning off the interrupts will not help.
> 
> 
> I was under the (apparently flawed) impression that Adeos was used to
> prevent interrupts preempting a running high priority task in primary
> mode, only forwarding the interrupts to Linux once the task was waiting
> / finished. I guess that it only prevents a subset of all interrupts,
> and the rest must be specifically disabled then re-enabled by the
> program, or maybe it does not intercept any interrupts?

It prevents secondary domain interrupts from being executed, but the
primary domain interrupt such as the timer interrupt are still executed,
and the secondary domain interrupts are still ticking and cause a
context switch, even if masked immediately.

>     The question is: is the SMI workaround working for your chipset? If that
>     is the case, you should get messages in the kernel logs.
> 
> 
> I've had a look at dmesg, but cannot find any references to SMI - what
> should I be looking for?

What is described in the TROUBLESHOOTING file.

-- 
					    Gilles.


  parent reply	other threads:[~2010-07-21 13:06 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-21 10:54 [Xenomai-help] Unexpected preemption of highest priority thread Stephen Bryant
2010-07-21 11:06 ` Gilles Chanteperdrix
2010-07-21 12:05   ` Stephen Bryant
2010-07-21 13:04     ` Stephen Bryant
2010-07-21 13:06     ` Gilles Chanteperdrix [this message]
2010-07-22  7:49       ` Stephen Bryant
2010-07-22  7:54         ` Gilles Chanteperdrix
2010-07-22  9:09           ` Stephen Bryant
2010-07-22 10:56             ` Gilles Chanteperdrix
2010-07-26 10:27               ` Stephen Bryant
2010-07-26 12:11                 ` Gilles Chanteperdrix
2010-07-26 12:31                   ` Stephen Bryant
2010-07-26 13:45                     ` Gilles Chanteperdrix
2010-07-27 13:20                       ` Stephen Bryant
2010-07-27 13:30                         ` 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=4C46F0D9.4030906@domain.hid \
    --to=gilles.chanteperdrix@xenomai.org \
    --cc=sbxenomai@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.