From: Gilles Chanteperdrix <gilles.chanteperdrix@xenomai.org>
To: Jan Kiszka <jan.kiszka@domain.hid>
Cc: adeos-main <adeos-main@gna.org>,
Wolfgang Mauerer <wolfgang.mauerer@domain.hid>,
xenomai-core <xenomai@xenomai.org>
Subject: Re: [Xenomai-core] [RFC][PATCH] x86: Fix root domain state restoring on exception return
Date: Sun, 24 Jan 2010 23:52:37 +0100 [thread overview]
Message-ID: <4B5CCF35.2040402@domain.hid> (raw)
In-Reply-To: <4B5B02E3.8060103@domain.hid>
Jan Kiszka wrote:
> If we enter __ipipe_handle_exception over a non-root domain and leave it
> due to migration in the event handler over root, we must not restore the
> root domain state so far saved on entry. This caused subtle pipeline
> state corruptions. Actually, we only need to save the state if we enter
> over the root domain and have to align its state to the hardware
> interrupt mask.
>
> Moreover, the x86-32 regs.eflags fix-up must happen based on the current
> root domain state to avoid more spurious corruptions.
>
> Signed-off-by: Jan Kiszka <jan.kiszka@domain.hid>
> ---
>
> This patch is so far running fine on the x86-64 boxes of our colleagues
> @Healthcare. It currently makes most sense to me, also for (untested)
> x86-32, but maybe I'm still missing a problematic scenario.
>
> arch/x86/kernel/ipipe.c | 64 ++++++++++++++++++++++++++--------------------
> 1 files changed, 36 insertions(+), 28 deletions(-)
>
> diff --git a/arch/x86/kernel/ipipe.c b/arch/x86/kernel/ipipe.c
> index 4442d96..8253993 100644
> --- a/arch/x86/kernel/ipipe.c
> +++ b/arch/x86/kernel/ipipe.c
> @@ -702,19 +702,17 @@ static int __ipipe_xlate_signo[] = {
>
> int __ipipe_handle_exception(struct pt_regs *regs, long error_code, int vector)
> {
> - unsigned long flags;
> -
> - /* Pick up the root domain state of the interrupted context. */
> - local_save_flags(flags);
> + bool restore_flags = false;
> + unsigned long flags = 0;
>
> - if (ipipe_root_domain_p) {
> + if (ipipe_root_domain_p && irqs_disabled_hw()) {
I really do not understand this hunk. It differs a lot from the current
situation. In the current situation __fixup_if really does something,
even if irqs were not masked on entry.
--
Gilles Chanteperdrix, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
next prev parent reply other threads:[~2010-01-24 22:52 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-01-23 14:08 [Xenomai-core] [RFC][PATCH] x86: Fix root domain state restoring on exception return Jan Kiszka
2010-01-24 22:52 ` Gilles Chanteperdrix [this message]
2010-01-24 23:04 ` [Xenomai-core] [Adeos-main] " Jan Kiszka
2010-01-25 6:16 ` [Xenomai-core] " Gilles Chanteperdrix
2010-01-25 7:30 ` [Xenomai-core] [Adeos-main] " Jan Kiszka
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=4B5CCF35.2040402@domain.hid \
--to=gilles.chanteperdrix@xenomai.org \
--cc=adeos-main@gna.org \
--cc=jan.kiszka@domain.hid \
--cc=wolfgang.mauerer@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.