All of lore.kernel.org
 help / color / mirror / Atom feed
From: Philippe Gerum <rpm@xenomai.org>
To: Jan Kiszka <jan.kiszka@domain.hid>
Cc: adeos-main <adeos-main@gna.org>
Subject: Re: [Adeos-main] Stall bit setting in __ipipe_handle_exception
Date: Mon, 23 Feb 2009 13:03:57 +0100	[thread overview]
Message-ID: <49A290AD.9040909@domain.hid> (raw)
In-Reply-To: <499EA168.3000103@domain.hid>

Jan Kiszka wrote:
> Hi Philippe,
> 
> as already indicated, I'm starting to understand the ipipe bug Roman
> sees. It seems to melt down to the following path:
> 
> - exception raised over non-root domain (__rt_event_wait...)
> - root domain is stalled on entry of __ipipe_handle_exception
> - fault causing task is first relaxed, then scheduled away under Linux
> - scheduled-in Linux task was interrupted in __ipipe_divert_exception,
>   shortly before __fixup_if
> - __fixup_if finds root domain stalled and propagates this to the
>   register set of the interrupted context (user space task running on
>   its first fpu instruction, having triggered device_not_available).
> - return to user space task with irqs disable - bang!
>

Good catch.

> Two ways to approach this:
> 1. Do we actually have to stall the root domain in
>    __ipipe_handle_exception before ipipe_trap_notify? I don't see why we
>    should be better off with doing this afterwards.

We do, because the root domain may install an I-pipe event handler on exceptions
as well, and the callee may assume that the virtual interrupt state is correct.

> 2. Avoid that __ipipe_divert_exception is interruptible and can pick up
>    the stall flag from a different Linux task. But I don't know if there
>    aren't more race windows like that.
> 

Since the core of the issue is about a preemption point that may be introduced
by a thread migration to secondary, the same goes with __ipipe_syscall_root;
this is what I stumbled upon on a different trace set.

The way to fix this properly is to decouple fixup_if() from the current global
interrupt state at call time, and rather make such state context-dependent, so
that iret emulation always uses the proper state value. A typical approach would
be to record the stall bit value on the caller's stack, and feed fixup_if() with it.

> Jan
> 


-- 
Philippe.



  parent reply	other threads:[~2009-02-23 12:03 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-20 12:26 [Adeos-main] Stall bit setting in __ipipe_handle_exception Jan Kiszka
2009-02-20 12:33 ` Jan Kiszka
2009-02-23 12:03 ` Philippe Gerum [this message]
2009-02-23 12:24   ` Jan Kiszka
2009-02-23 12:50     ` 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=49A290AD.9040909@domain.hid \
    --to=rpm@xenomai.org \
    --cc=adeos-main@gna.org \
    --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.