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

Author: Jan Kiszka <jan.kis...@siemens.com>
Date:   Fri Jan  4 20:32:17 2013 +0100

intr: Fix output of timer interrupts in /proc/xenomai/{irq,stat}

XNARCH_TIMER_IRQ works on the current CPU, we need to check all CPUs if
a given IRQ serves there as timer. Also, properly decode RTHAL_TIMER_IPI
when listing IRQs.

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

---

 include/asm-generic/hal.h    |    2 ++
 include/asm-generic/system.h |    1 +
 ksrc/nucleus/intr.c          |   26 ++++++++++++++++++++------
 3 files changed, 23 insertions(+), 6 deletions(-)

diff --git a/include/asm-generic/hal.h b/include/asm-generic/hal.h
index 8c667d7..b05cffa 100644
--- a/include/asm-generic/hal.h
+++ b/include/asm-generic/hal.h
@@ -62,10 +62,12 @@
 #define RTHAL_HRTIMER_IPI      IPIPE_HRTIMER_IPI
 #define RTHAL_RESCHEDULE_IPI   IPIPE_RESCHEDULE_IPI
 #define RTHAL_CRITICAL_IPI     IPIPE_CRITICAL_IPI
+#define RTHAL_PERCPU_TIMER_IRQ(cpu) per_cpu(ipipe_percpu.hrtimer_irq, cpu)
 #else /* !I-pipe core */
 #define RTHAL_HRTIMER_IPI      IPIPE_SERVICE_IPI0
 #define RTHAL_RESCHEDULE_IPI   IPIPE_SERVICE_IPI1
 #define RTHAL_CRITICAL_IPI     IPIPE_CRITICAL_IPI
+#define RTHAL_PERCPU_TIMER_IRQ(cpu) RTHAL_TIMER_IRQ
 #endif /* !I-pipe core */
 
 enum rthal_ktimer_mode { /* <!> Must follow enum clock_event_mode */
diff --git a/include/asm-generic/system.h b/include/asm-generic/system.h
index 4ab2e05..25bd83f 100644
--- a/include/asm-generic/system.h
+++ b/include/asm-generic/system.h
@@ -233,6 +233,7 @@ static inline int xnlock_dbg_release(xnlock_t *lock)
 
 #define XNARCH_NR_IRQS                 RTHAL_NR_IRQS
 #define XNARCH_TIMER_IRQ               RTHAL_TIMER_IRQ
+#define XNARCH_PERCPU_TIMER_IRQ(cpu)   RTHAL_PERCPU_TIMER_IRQ(cpu)
 #define XNARCH_TIMER_DEVICE            RTHAL_TIMER_DEVICE
 #define XNARCH_CLOCK_DEVICE            RTHAL_CLOCK_DEVICE
 
diff --git a/ksrc/nucleus/intr.c b/ksrc/nucleus/intr.c
index ba61f31..603ae22 100644
--- a/ksrc/nucleus/intr.c
+++ b/ksrc/nucleus/intr.c
@@ -893,6 +893,20 @@ void xnintr_affinity(xnintr_t *intr, xnarch_cpumask_t 
cpumask)
 }
 EXPORT_SYMBOL_GPL(xnintr_affinity);
 
+#ifdef CONFIG_XENO_OPT_VFILE
+
+#include <nucleus/vfile.h>
+
+static bool xnintr_is_timer_irq(int irq)
+{
+       int cpu;
+
+       for_each_online_cpu(cpu)
+               if (irq == XNARCH_PERCPU_TIMER_IRQ(cpu))
+                       return true;
+       return false;
+}
+
 #ifdef CONFIG_XENO_OPT_STATS
 int xnintr_query_init(xnintr_iterator_t *iterator)
 {
@@ -934,7 +948,7 @@ int xnintr_query_next(int irq, xnintr_iterator_t *iterator, 
char *name_buf)
        }
 
        if (!iterator->prev) {
-               if (irq == XNARCH_TIMER_IRQ)
+               if (xnintr_is_timer_irq(irq))
                        intr = &nkclock;
                else
                        intr = xnintr_shirq_first(irq);
@@ -975,22 +989,22 @@ int xnintr_query_next(int irq, xnintr_iterator_t 
*iterator, char *name_buf)
 }
 #endif /* CONFIG_XENO_OPT_STATS */
 
-#ifdef CONFIG_XENO_OPT_VFILE
-
-#include <nucleus/vfile.h>
-
 static inline int format_irq_proc(unsigned int irq,
                                  struct xnvfile_regular_iterator *it)
 {
        struct xnintr *intr;
        spl_t s;
 
-       if (irq == XNARCH_TIMER_IRQ) {
+       if (xnintr_is_timer_irq(irq)) {
                xnvfile_puts(it, "         [timer]");
                return 0;
        }
 
 #ifdef CONFIG_SMP
+       if (irq == RTHAL_TIMER_IPI) {
+               xnvfile_puts(it, "         [timer-ipi]");
+               return 0;
+       }
        if (irq == RTHAL_RESCHEDULE_IPI) {
                xnvfile_puts(it, "         [reschedule]");
                return 0;


_______________________________________________
Xenomai-git mailing list
Xenomai-git@xenomai.org
http://www.xenomai.org/mailman/listinfo/xenomai-git

Reply via email to