All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Kiszka <jan.kiszka@domain.hid>
To: Philippe Gerum <rpm@xenomai.org>
Cc: adeos-main <adeos-main@gna.org>
Subject: [Adeos-main] [PATCH] ipipe: Re-read domain data pointer after interrupt handler execution
Date: Sat, 04 Jun 2011 13:44:43 +0200	[thread overview]
Message-ID: <4DEA1AAB.60403@domain.hid> (raw)

From: Jan Kiszka <jan.kiszka@domain.hid>

This caused subtle system corruptions on SMP: The context which took the
IRQ may migrate to a different CPU during the execution of the IRQ
handler (migration to root domain -> load balancing). So we must refresh
the per-CPU domain data and not use the one obtained on entry.

Signed-off-by: Jan Kiszka <jan.kiszka@domain.hid>
---

Just for early review. I'll send 2.6.38 pull requests for these
patches, some more fixes, and access optimizations for
ipipe_percpu_domain_data::status next week after running more serious
SMP load against them.

Note that this bug affects any ipipe version I've found in git. So the
patch should be applied/backported to all versions we still support.

PS: Months of collecting oopses, more than 1 weeks of debugging.
Yeah, there were more bugs, but this was likely the toughest monster.

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

diff --git a/kernel/ipipe/core.c b/kernel/ipipe/core.c
index 9aa4800..0ed7751 100644
--- a/kernel/ipipe/core.c
+++ b/kernel/ipipe/core.c
@@ -1168,6 +1168,7 @@ void __ipipe_dispatch_wired_nocheck(struct ipipe_domain *head, unsigned irq) /*
 	head->irqs[irq].handler(irq, head->irqs[irq].cookie); /* Call the ISR. */
 	__ipipe_run_irqtail(irq);
 	barrier();
+	p = ipipe_cpudom_ptr(head);
 	__clear_bit(IPIPE_STALL_FLAG, &p->status);
 
 	if (__ipipe_current_domain == head) {
-- 
1.7.1


                 reply	other threads:[~2011-06-04 11:44 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=4DEA1AAB.60403@domain.hid \
    --to=jan.kiszka@domain.hid \
    --cc=adeos-main@gna.org \
    --cc=rpm@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.