All of lore.kernel.org
 help / color / mirror / Atom feed
* [Xenomai] Mayday mechanism broken on x86-64 - simpler approach feasible?
@ 2014-12-17 16:57 Jan Kiszka
  2014-12-17 17:19 ` Philippe Gerum
  2014-12-17 17:52 ` Philippe Gerum
  0 siblings, 2 replies; 26+ messages in thread
From: Jan Kiszka @ 2014-12-17 16:57 UTC (permalink / raw)
  To: Xenomai

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).

I was playing with a different approach: Set a flag that mayday is
underway, let the interrupt context cause a fault (set ip to 0) and then
fix that up if we are in mayday mode. Seems to work fine (after fixing
some x86 ipipe issue) and would simplify the mayday logic apparently. So
I'm wondering why that approach wasn't chosen initially? IOW, what am I
missing?

Jan

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


^ permalink raw reply	[flat|nested] 26+ messages in thread

end of thread, other threads:[~2015-02-17 10:58 UTC | newest]

Thread overview: 26+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
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

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.