Module: xenomai-jki
Branch: queues/ftrace
Commit: dde9537ecf92ea21d812c6f4369eac95dd131d51
URL:    
http://git.xenomai.org/?p=xenomai-jki.git;a=commit;h=dde9537ecf92ea21d812c6f4369eac95dd131d51

Author: Jan Kiszka <jan.kis...@siemens.com>
Date:   Thu Feb 14 19:19:01 2013 +0100

nucleus: Convert IRQ instrumentation

Move up the exit tracepoint at this chance. This avoids confusion as the
xnpod_schedule may switch to different tasks first that will run outside
the interrupt context.

We drop attach/detach instrumentation and the one of the unused
set affinity service. They are not interesting from analyzing system
dynamics.

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

---

 include/trace/xn_nucleus.h |   35 +++++++++++++++++++++++++++++++++++
 ksrc/nucleus/intr.c        |   34 ++++++++++++----------------------
 2 files changed, 47 insertions(+), 22 deletions(-)

diff --git a/include/trace/xn_nucleus.h b/include/trace/xn_nucleus.h
index 3d8aef0..f01d52f 100644
--- a/include/trace/xn_nucleus.h
+++ b/include/trace/xn_nucleus.h
@@ -378,6 +378,41 @@ DEFINE_EVENT(syscall_exit, xn_nucleus_sys_lostage_exit,
        TP_ARGS(thread, result)
 );
 
+DECLARE_EVENT_CLASS(irq_event,
+       TP_PROTO(unsigned int irq),
+       TP_ARGS(irq),
+
+       TP_STRUCT__entry(
+               __field(unsigned int,   irq)
+       ),
+
+       TP_fast_assign(
+               __entry->irq            = irq;
+       ),
+
+       TP_printk("irq=%u", __entry->irq)
+);
+
+DEFINE_EVENT(irq_event, xn_nucleus_irq_entry,
+       TP_PROTO(unsigned int irq),
+       TP_ARGS(irq)
+);
+
+DEFINE_EVENT(irq_event, xn_nucleus_irq_exit,
+       TP_PROTO(unsigned int irq),
+       TP_ARGS(irq)
+);
+
+DEFINE_EVENT(irq_event, xn_nucleus_irq_enable,
+       TP_PROTO(unsigned int irq),
+       TP_ARGS(irq)
+);
+
+DEFINE_EVENT(irq_event, xn_nucleus_irq_disable,
+       TP_PROTO(unsigned int irq),
+       TP_ARGS(irq)
+);
+
 #endif /* _TRACE_XN_NUCLEUS_H */
 
 /* This part must be outside protection */
diff --git a/ksrc/nucleus/intr.c b/ksrc/nucleus/intr.c
index 1cb05b8..a987ccd 100644
--- a/ksrc/nucleus/intr.c
+++ b/ksrc/nucleus/intr.c
@@ -37,6 +37,8 @@
 #include <nucleus/stat.h>
 #include <asm/xenomai/bits/intr.h>
 
+#include <trace/events/xn_nucleus.h>
+
 #define XNINTR_MAX_UNHANDLED   1000
 
 DEFINE_PRIVATE_XNLOCK(intrlock);
@@ -100,7 +102,7 @@ void xnintr_clock_handler(void)
                &nkclock.stat[xnsched_cpu(sched)].account);
        xnstat_counter_inc(&nkclock.stat[xnsched_cpu(sched)].hits);
 
-       trace_mark(xn_nucleus, irq_enter, "irq %u", XNARCH_TIMER_IRQ);
+       trace_xn_nucleus_irq_entry(XNARCH_TIMER_IRQ);
        trace_mark(xn_nucleus, tbase_tick, "base %s", nktbase.name);
 
        ++sched->inesting;
@@ -110,6 +112,7 @@ void xnintr_clock_handler(void)
        xntimer_tick_aperiodic();
        xnlock_put(&nklock);
 
+       trace_xn_nucleus_irq_exit(XNARCH_TIMER_IRQ);
        xnstat_exectime_switch(sched, prev);
 
        if (--sched->inesting == 0) {
@@ -127,8 +130,6 @@ void xnintr_clock_handler(void)
        if (testbits(sched->lflags, XNHTICK) &&
            xnthread_test_state(sched->curr, XNROOT))
                xnintr_host_tick(sched);
-
-       trace_mark(xn_nucleus, irq_exit, "irq %u", XNARCH_TIMER_IRQ);
 }
 
 /* Optional support for shared interrupts. */
@@ -171,7 +172,7 @@ static void xnintr_shirq_handler(unsigned irq, void *cookie)
 
        prev  = xnstat_exectime_get_current(sched);
        start = xnstat_exectime_now();
-       trace_mark(xn_nucleus, irq_enter, "irq %u", irq);
+       trace_xn_nucleus_irq_entry(irq);
 
        ++sched->inesting;
        __setbits(sched->lflags, XNINIRQ);
@@ -215,14 +216,13 @@ static void xnintr_shirq_handler(unsigned irq, void 
*cookie)
        else if (!(s & XN_ISR_NOENABLE))
                xnarch_end_irq(irq);
 
+       trace_xn_nucleus_irq_exit(irq);
        xnstat_exectime_switch(sched, prev);
 
        if (--sched->inesting == 0) {
                __clrbits(sched->lflags, XNINIRQ);
                xnpod_schedule();
        }
-
-       trace_mark(xn_nucleus, irq_exit, "irq %u", irq);
 }
 
 /*
@@ -241,7 +241,7 @@ static void xnintr_edge_shirq_handler(unsigned irq, void 
*cookie)
 
        prev  = xnstat_exectime_get_current(sched);
        start = xnstat_exectime_now();
-       trace_mark(xn_nucleus, irq_enter, "irq %u", irq);
+       trace_xn_nucleus_irq_entry(irq);
 
        ++sched->inesting;
        __setbits(sched->lflags, XNINIRQ);
@@ -299,14 +299,13 @@ static void xnintr_edge_shirq_handler(unsigned irq, void 
*cookie)
        else if (!(s & XN_ISR_NOENABLE))
                xnarch_end_irq(irq);
 
+       trace_xn_nucleus_irq_exit(irq);
        xnstat_exectime_switch(sched, prev);
 
        if (--sched->inesting == 0) {
                __clrbits(sched->lflags, XNINIRQ);
                xnpod_schedule();
        }
-
-       trace_mark(xn_nucleus, irq_exit, "irq %u", irq);
 }
 
 static inline int xnintr_irq_attach(xnintr_t *intr)
@@ -442,7 +441,7 @@ static void xnintr_irq_handler(unsigned irq, void *cookie)
 
        prev  = xnstat_exectime_get_current(sched);
        start = xnstat_exectime_now();
-       trace_mark(xn_nucleus, irq_enter, "irq %u", irq);
+       trace_xn_nucleus_irq_entry(irq);
 
        ++sched->inesting;
        __setbits(sched->lflags, XNINIRQ);
@@ -491,14 +490,13 @@ static void xnintr_irq_handler(unsigned irq, void *cookie)
        else if (!(s & XN_ISR_NOENABLE))
                xnarch_end_irq(irq);
 
+       trace_xn_nucleus_irq_exit(irq);
        xnstat_exectime_switch(sched, prev);
 
        if (--sched->inesting == 0) {
                __clrbits(sched->lflags, XNINIRQ);
                xnpod_schedule();
        }
-
-       trace_mark(xn_nucleus, irq_exit, "irq %u", irq);
 }
 
 int __init xnintr_mount(void)
@@ -711,9 +709,6 @@ int xnintr_attach(xnintr_t *intr, void *cookie)
        int ret;
        spl_t s;
 
-       trace_mark(xn_nucleus, irq_attach, "irq %u name %s",
-                  intr->irq, intr->name);
-
        intr->cookie = cookie;
        memset(&intr->stat, 0, sizeof(intr->stat));
 
@@ -777,8 +772,6 @@ int xnintr_detach(xnintr_t *intr)
        int ret;
        spl_t s;
 
-       trace_mark(xn_nucleus, irq_detach, "irq %u", intr->irq);
-
        xnlock_get_irqsave(&intrlock, s);
 
        if (!__testbits(intr->flags, XN_ISR_ATTACHED)) {
@@ -827,7 +820,7 @@ EXPORT_SYMBOL_GPL(xnintr_detach);
 
 int xnintr_enable(xnintr_t *intr)
 {
-       trace_mark(xn_nucleus, irq_enable, "irq %u", intr->irq);
+       trace_xn_nucleus_irq_enable(intr->irq);
 
        return xnarch_enable_irq(intr->irq);
 }
@@ -859,7 +852,7 @@ EXPORT_SYMBOL_GPL(xnintr_enable);
 
 int xnintr_disable(xnintr_t *intr)
 {
-       trace_mark(xn_nucleus, irq_disable, "irq %u", intr->irq);
+       trace_xn_nucleus_irq_disable(intr->irq);
 
        return xnarch_disable_irq(intr->irq);
 }
@@ -886,9 +879,6 @@ EXPORT_SYMBOL_GPL(xnintr_disable);
 
 void xnintr_affinity(xnintr_t *intr, xnarch_cpumask_t cpumask)
 {
-       trace_mark(xn_nucleus, irq_affinity, "irq %u %lu",
-                  intr->irq, *(unsigned long *)&cpumask);
-
        xnarch_set_irq_affinity(intr->irq, cpumask);
 }
 EXPORT_SYMBOL_GPL(xnintr_affinity);


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

Reply via email to