All of lore.kernel.org
 help / color / mirror / Atom feed
From: Philippe Gerum <rpm@xenomai.org>
To: Jan Kiszka <jan.kiszka@domain.hid>
Cc: Xenomai core <Xenomai-core@domain.hid>
Subject: Re: [Xenomai-core] [Xenomai-git] Jan Kiszka : nucleus: Fix race between gatekeeper and thread deletion
Date: Sat, 16 Jul 2011 10:52:59 +0200	[thread overview]
Message-ID: <1310806379.2154.418.camel@domain.hid> (raw)
In-Reply-To: <4E21483B.7050503@domain.hid>

On Sat, 2011-07-16 at 10:13 +0200, Jan Kiszka wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> On 2011-07-15 15:10, Jan Kiszka wrote:
> > But... right now it looks like we found our primary regression: 
> > "nucleus/shadow: shorten the uninterruptible path to secondary mode".
> > It opens a short windows during relax where the migrated task may be
> > active under both schedulers. We are currently evaluating a revert
> > (looks good so far), and I need to work out my theory in more
> > details.
> 
> Looks like this commit just made a long-standing flaw in Xenomai's
> interrupt handling more visible: We reschedule over the interrupt stack
> in the Xenomai interrupt handler tails, at least on x86-64. Not sure if
> other archs have interrupt stacks, the point is Xenomai's design wrongly
> assumes there are no such things.

Fortunately, no, this is not a design issue, no such assumption was ever
made, but the Xenomai core expects this to be handled on a per-arch
basis with the interrupt pipeline. As you pointed out, there is no way
to handle this via some generic Xenomai-only support.

ppc64 now has separate interrupt stacks, which is why I disabled
IRQSTACKS which became the builtin default at some point. Blackfin goes
through a Xenomai-defined irq tail handler as well, because it may not
reschedule over nested interrupt stacks. Fact is that such pending
problem with x86_64 was overlooked since day #1 by /me.

>  We were lucky so far that the values
> saved on this shared stack were apparently "compatible", means we were
> overwriting them with identical or harmless values. But that's no longer
> true when interrupts are hitting us in the xnpod_suspend_thread path of
> a relaxing shadow.
> 

Makes sense. It would be better to find a solution that does not make
the relax path uninterruptible again for a significant amount of time.
On low end platforms we support (i.e. non-x86* mainly), this causes
obvious latency spots.

> Likely the only possible fix is establishing a reschedule hook for
> Xenomai in the interrupt exit path after the original stack is restored
> - - just like Linux works. Requires changes to both ipipe and Xenomai
> unfortunately.

__ipipe_run_irqtail() is in the I-pipe core for such purpose. If
instantiated properly for x86_64, and paired with xnarch_escalate() for
that arch as well, it could be an option for running the rescheduling
procedure when safe.

> 
> Jan
> 
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v2.0.16 (GNU/Linux)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
> 
> iEYEARECAAYFAk4hSDsACgkQitSsb3rl5xSmOACfbZfcNKyO9YDvPE+R5H75d0ky
> DX0An32BrZW+lpEnxnLLCHSQ5r8itnE9
> =n6u8
> -----END PGP SIGNATURE-----

-- 
Philippe.




  reply	other threads:[~2011-07-16  8:52 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <E1QfDvt-0003TN-G7@domain.hid>
2011-07-11 18:53 ` [Xenomai-core] [Xenomai-git] Jan Kiszka : nucleus: Fix race between gatekeeper and thread deletion Gilles Chanteperdrix
2011-07-11 19:10   ` Jan Kiszka
2011-07-11 19:16     ` Jan Kiszka
2011-07-11 19:51       ` Gilles Chanteperdrix
2011-07-11 19:59         ` Jan Kiszka
2011-07-11 20:02           ` Gilles Chanteperdrix
2011-07-11 20:06             ` Jan Kiszka
2011-07-11 20:09               ` Gilles Chanteperdrix
2011-07-11 20:12                 ` Jan Kiszka
2011-07-12  6:41                   ` Gilles Chanteperdrix
2011-07-12  7:22                     ` Jan Kiszka
2011-07-12  7:49                       ` Gilles Chanteperdrix
2011-07-12 10:59                       ` Gilles Chanteperdrix
2011-07-12 11:00                         ` Jan Kiszka
2011-07-12 11:04                           ` Gilles Chanteperdrix
2011-07-12 11:06                             ` Jan Kiszka
2011-07-12 11:08                               ` Gilles Chanteperdrix
2011-07-12 11:10                                 ` Jan Kiszka
2011-07-12 11:26                                   ` Gilles Chanteperdrix
2011-07-12 11:29                                     ` Jan Kiszka
2011-07-12 11:41                                       ` Gilles Chanteperdrix
2011-07-12 11:56                                         ` Jan Kiszka
2011-07-12 11:58                                           ` Jan Kiszka
2011-07-12 12:06                                             ` Gilles Chanteperdrix
2011-07-12 12:13                                               ` Jan Kiszka
2011-07-12 12:57                                                 ` Jan Kiszka
2011-07-12 15:48                                                   ` Philippe Gerum
2011-07-12 16:18                                                     ` Jan Kiszka
2011-07-12 17:31                                                   ` Gilles Chanteperdrix
2011-07-12 17:34                                                     ` Jan Kiszka
2011-07-12 17:38                                                       ` Gilles Chanteperdrix
2011-07-12 17:43                                                         ` Jan Kiszka
2011-07-13 18:39                                                           ` Gilles Chanteperdrix
2011-07-13 19:04                                                             ` Jan Kiszka
2011-07-13 19:12                                                               ` Gilles Chanteperdrix
2011-07-14 20:57                                                                 ` Jan Kiszka
2011-07-15 12:30                                                                   ` Gilles Chanteperdrix
2011-07-15 13:10                                                                     ` Jan Kiszka
2011-07-16  8:13                                                                       ` Jan Kiszka
2011-07-16  8:52                                                                         ` Philippe Gerum [this message]
2011-07-16  9:15                                                                           ` Jan Kiszka
2011-07-16  9:56                                                                             ` Philippe Gerum
2011-07-16 17:16                                                                               ` Jan Kiszka
2011-07-13 19:35                                                             ` Philippe Gerum

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=1310806379.2154.418.camel@domain.hid \
    --to=rpm@xenomai.org \
    --cc=Xenomai-core@domain.hid \
    --cc=jan.kiszka@domain.hid \
    /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.