All of lore.kernel.org
 help / color / mirror / Atom feed
* [Xenomai] [CRITICAL PATCH] ipipe: Re-read domain context after IRQ processing
@ 2013-01-18 15:38 Jan Kiszka
  2013-01-18 16:37 ` Philippe Gerum
  2013-05-10 15:27 ` Gilles Chanteperdrix
  0 siblings, 2 replies; 16+ messages in thread
From: Jan Kiszka @ 2013-01-18 15:38 UTC (permalink / raw)
  To: Philippe Gerum; +Cc: Xenomai

This fixes a nasty bug on SMP boxes: We may migrate to root in the
context of an IRQ handler, and then also to a different CPU. Therefore,
we must not use domain contexts read before the invocation but update
them afterward or use stable information like the domain reference.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---

We are still facing stalled, unkillable RT processes despite this fix,
but at least the head domain status corruption (and related warnings)
seems to be gone now.

 kernel/ipipe/core.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/kernel/ipipe/core.c b/kernel/ipipe/core.c
index 68af0b3..6aa9572 100644
--- a/kernel/ipipe/core.c
+++ b/kernel/ipipe/core.c
@@ -1173,18 +1173,19 @@ static void dispatch_irq_head(unsigned int irq) /* hw interrupts off */
 	head->irqs[irq].handler(irq, head->irqs[irq].cookie);
 	__ipipe_run_irqtail(irq);
 	hard_local_irq_disable();
+	p = ipipe_this_cpu_head_context();
 	__clear_bit(IPIPE_STALL_FLAG, &p->status);
 
 	/* Are we still running in the head domain? */
 	if (likely(__ipipe_current_context == p)) {
 		/* Did we enter this code over the head domain? */
-		if (old == p) {
+		if (old->domain == head) {
 			/* Yes, do immediate synchronization. */
 			if (__ipipe_ipending_p(p))
 				__ipipe_sync_stage();
 			return;
 		}
-		__ipipe_set_current_context(old);
+		__ipipe_set_current_context(ipipe_this_cpu_root_context());
 	}
 
 	/*
-- 
1.7.3.4


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

end of thread, other threads:[~2013-05-13  6:38 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-18 15:38 [Xenomai] [CRITICAL PATCH] ipipe: Re-read domain context after IRQ processing Jan Kiszka
2013-01-18 16:37 ` Philippe Gerum
2013-01-18 17:04   ` Jan Kiszka
2013-01-18 19:04     ` Jan Kiszka
2013-01-18 20:09       ` Jan Kiszka
2013-01-21 11:30         ` Jan Kiszka
2013-01-21 11:57           ` Gilles Chanteperdrix
2013-05-10 15:27 ` Gilles Chanteperdrix
2013-05-10 15:44   ` Gilles Chanteperdrix
2013-05-10 16:22     ` Jan Kiszka
2013-05-10 16:34       ` Gilles Chanteperdrix
2013-05-11 14:53       ` Philippe Gerum
2013-05-11 15:24         ` Gilles Chanteperdrix
2013-05-11 15:28           ` Philippe Gerum
2013-05-11 16:32             ` Gilles Chanteperdrix
2013-05-13  6:38         ` Jan Kiszka

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.