All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Kiszka <jan.kiszka@siemens.com>
To: Philippe Gerum <rpm@xenomai.org>, Xenomai <xenomai@xenomai.org>
Subject: Re: [Xenomai] Mayday mechanism broken on x86-64 - simpler approach feasible?
Date: Wed, 17 Dec 2014 19:32:07 +0100	[thread overview]
Message-ID: <5491CC27.6080909@siemens.com> (raw)
In-Reply-To: <5491CB3F.2050509@xenomai.org>

On 2014-12-17 19:28, Philippe Gerum wrote:
> On 12/17/2014 06:46 PM, Jan Kiszka wrote:
>> On 2014-12-17 18:52, Philippe Gerum wrote:
>>> On 12/17/2014 05:57 PM, Jan Kiszka wrote:
>>>> Hi,
>>>>
>>>> while porting the sigdebug test case to forge I noticed occasional
>>>> crashes of the test after it received a watchdog signal. It turned out
>>>> that the problem is in the way mayday works on x86-64:
>>>>
>>>> 1. sp/ip/ax of interrupted thread is saved
>>>> 2. ip is set to mayday page
>>>> 3. mayday page executes the mayday syscall via the syscall instruction
>>>> 4. the syscall restores state on original state on return
>>>>
>>>> That that's the theory. Unfortunately the syscall instructions
>>>> overwrites the cx register with the caller's instruction pointer. We
>>>> could save it but there is no way to restore it on syscall return
>>>> without significant changes to the Linux code in entry_64.S.
>>>>
>>>> x86-32 is fine as it uses the int80 path which does a full state
>>>> recovery - but that is not available for 64-bit (only via ia32 compat,
>>>> but that can be turned off).
>>>>
>>>
>>> The legacy system_call vector is available unconditionally to x86_64.
>>> Xenomai 3 is actually calling int80 unconditionally on mayday traps for
>>> these reasons, i.e. always available and not suffering the long-mode
>>> syscall registers issue.
>>
>> Only when setting CONFIG_IA32_EMULATION. That is typcially the case, but
>> not necessarily.
>>
> 
> I mean: the "safe" Xenomai syscall form (the one that binds a process to
> the real-time core in dual kernel mode) depends on this. Disabling int80
> is not an option in the current Xenomai implementation, mayday feature
> put aside.

Huh? Things worked fine here on X3 when trying out the effect of
disabling IA32 emulation. Or do you mean 2.6?

> 
> So this change would also break the Xenomai ABI (which is ok with x3,
> but not an option for 2.6.4).

Yes, 2.6 requires a compatible solution.

Jan

-- 
Siemens AG, Corporate Technology, CT RTC ITP SES-DE
Corporate Competence Center Embedded Linux


  reply	other threads:[~2014-12-17 18:32 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-17 16:57 [Xenomai] Mayday mechanism broken on x86-64 - simpler approach feasible? Jan Kiszka
2014-12-17 17:19 ` Philippe Gerum
2014-12-17 17:17   ` Gilles Chanteperdrix
2014-12-17 17:36     ` Jan Kiszka
2014-12-17 17:45       ` Gilles Chanteperdrix
2014-12-17 17:49         ` Jan Kiszka
2014-12-17 17:37   ` Jan Kiszka
2014-12-17 17:52 ` Philippe Gerum
2014-12-17 17:46   ` Jan Kiszka
2014-12-17 18:28     ` Philippe Gerum
2014-12-17 18:32       ` Jan Kiszka [this message]
2014-12-17 18:33         ` Jan Kiszka
2014-12-17 18:55         ` Philippe Gerum
2014-12-17 18:57           ` Jan Kiszka
2015-02-03 15:29           ` Philippe Gerum
2015-02-12 16:36             ` Jan Kiszka
2015-02-12 17:01               ` Philippe Gerum
2015-02-12 17:02               ` Jan Kiszka
2015-02-12 17:07                 ` Philippe Gerum
2015-02-12 17:16                   ` Jan Kiszka
2015-02-12 17:18                     ` Philippe Gerum
2015-02-12 17:19                       ` Jan Kiszka
2015-02-12 17:45                         ` Jan Kiszka
2015-02-16 17:37                           ` Jan Kiszka
2015-02-16 17:43                             ` Philippe Gerum
2015-02-17 10:58                               ` 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=5491CC27.6080909@siemens.com \
    --to=jan.kiszka@siemens.com \
    --cc=rpm@xenomai.org \
    --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.