Module: xenomai-rpm
Branch: for-upstream
Commit: 5ee600768743906342a350ecbca51a01ca5689b4
URL:    
http://git.xenomai.org/?p=xenomai-rpm.git;a=commit;h=5ee600768743906342a350ecbca51a01ca5689b4

Author: Philippe Gerum <r...@xenomai.org>
Date:   Mon Oct 25 13:22:19 2010 +0200

nucleus/intr: wait for all pipelines do drain before detaching an IRQ

This patch introduces a synchronization point in xnintr_detach(),
which guarantees that no CPU will attempt to execute the IRQ handler
to be detached once the barrier is passed.

---

 include/asm-generic/bits/intr.h |    7 +++++++
 include/asm-generic/hal.h       |    9 ++++++++-
 ksrc/nucleus/intr.c             |    2 ++
 3 files changed, 17 insertions(+), 1 deletions(-)

diff --git a/include/asm-generic/bits/intr.h b/include/asm-generic/bits/intr.h
index 19b35d6..e438ca6 100644
--- a/include/asm-generic/bits/intr.h
+++ b/include/asm-generic/bits/intr.h
@@ -57,6 +57,13 @@ static inline void xnarch_chain_irq (unsigned irq)
     rthal_irq_host_pend(irq);
 }
 
+static inline int xnarch_ignore_irq(unsigned irq)
+{
+       return rthal_irq_control(irq,
+                                IPIPE_WIRED_MASK|IPIPE_HANDLE_MASK| \
+                                IPIPE_STICKY_MASK, IPIPE_PASS_MASK);
+}
+
 static inline xnarch_cpumask_t xnarch_set_irq_affinity (unsigned irq,
                                                        xnarch_cpumask_t 
affinity)
 {
diff --git a/include/asm-generic/hal.h b/include/asm-generic/hal.h
index 34f8ea1..e7a8c91 100644
--- a/include/asm-generic/hal.h
+++ b/include/asm-generic/hal.h
@@ -170,7 +170,14 @@ typedef spinlock_t rthal_spinlock_t;
 #define rthal_propagate_irq(irq)       ipipe_propagate_irq(irq)
 #endif /* !__IPIPE_FEATURE_FASTPEND_IRQ */
 #define rthal_virtualize_irq(dom,irq,isr,cookie,ackfn,mode) \
-    ipipe_virtualize_irq(dom,irq,isr,cookie,ackfn,mode)
+       ipipe_virtualize_irq(dom,irq,isr,cookie,ackfn,mode)
+#ifdef __IPIPE_FEATURE_CONTROL_IRQ
+#define rthal_irq_control(irq, clrmask, setmask) \
+       ipipe_control_irq(&rthal_domain, irq, clrmask, setmask)
+#else  /* !__IPIPE_FEATURE_CONTROL_IRQ */
+#define rthal_irq_control(irq, clrmask, setmask) \
+       ({ int ret = 0; ret; })
+#endif  /* !__IPIPE_FEATURE_CONTROL_IRQ */
 #define rthal_alloc_virq()             ipipe_alloc_virq()
 #define rthal_free_virq(irq)           ipipe_free_virq(irq)
 #define rthal_trigger_irq(irq)         ipipe_trigger_irq(irq)
diff --git a/ksrc/nucleus/intr.c b/ksrc/nucleus/intr.c
index 0d6f64b..41f86bc 100644
--- a/ksrc/nucleus/intr.c
+++ b/ksrc/nucleus/intr.c
@@ -779,6 +779,8 @@ int xnintr_detach(xnintr_t *intr)
 
        trace_mark(xn_nucleus, irq_detach, "irq %u", intr->irq);
 
+       xnarch_ignore_irq(intr->irq);
+
        xnlock_get_irqsave(&intrlock, s);
 
        if (!__testbits(intr->flags, XN_ISR_ATTACHED)) {


_______________________________________________
Xenomai-git mailing list
Xenomai-git@gna.org
https://mail.gna.org/listinfo/xenomai-git

Reply via email to