From 5ef7e2dad47bce26ce3afd0c402f6cc185e75ad6 Mon Sep 17 00:00:00 2001 From: Bjoern Brandenburg Date: Sun, 23 Jun 2013 14:51:57 +0200 Subject: Integrate ft_irq_fired() with Linux This patch hooks up Feather-Trace's ft_irq_fired() handler with Linux's interrupt handling infrastructure. --- include/linux/hardirq.h | 4 ++++ include/litmus/trace_irq.h | 14 ++++++++++++++ kernel/sched/core.c | 5 +++++ kernel/softirq.c | 3 +++ 4 files changed, 26 insertions(+) create mode 100644 include/litmus/trace_irq.h diff --git a/include/linux/hardirq.h b/include/linux/hardirq.h index c1d6555d2567..7ad5fd87d6d4 100644 --- a/include/linux/hardirq.h +++ b/include/linux/hardirq.h @@ -7,6 +7,8 @@ #include #include +#include + /* * We put the hardirq and softirq counter into the preemption * counter. The bitmask has the following meaning: @@ -154,6 +156,7 @@ extern void rcu_nmi_exit(void); account_irq_enter_time(current); \ add_preempt_count(HARDIRQ_OFFSET); \ trace_hardirq_enter(); \ + ft_irq_fired(); \ } while (0) /* @@ -184,6 +187,7 @@ extern void irq_exit(void); add_preempt_count(NMI_OFFSET + HARDIRQ_OFFSET); \ rcu_nmi_enter(); \ trace_hardirq_enter(); \ + ft_irq_fired(); \ } while (0) #define nmi_exit() \ diff --git a/include/litmus/trace_irq.h b/include/litmus/trace_irq.h new file mode 100644 index 000000000000..0d0c042ba9c3 --- /dev/null +++ b/include/litmus/trace_irq.h @@ -0,0 +1,14 @@ +#ifndef _LITMUS_TRACE_IRQ_H_ +#define _LITMUS_TRACE_IRQ_H_ + +#ifdef CONFIG_SCHED_OVERHEAD_TRACE + +void ft_irq_fired(void); + +#else + +#define ft_irq_fired() /* nothing to do */ + +#endif + +#endif diff --git a/kernel/sched/core.c b/kernel/sched/core.c index e8b335016c52..a4c8c093f6bc 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -1408,7 +1408,12 @@ void scheduler_ipi(void) if (llist_empty(&this_rq()->wake_list) && !tick_nohz_full_cpu(smp_processor_id()) && !got_nohz_idle_kick()) + { + /* If we don't call irq_enter(), we need to triggger the IRQ + * tracing manually. */ + ft_irq_fired(); return; + } /* * Not all reschedule IPI handlers call irq_enter/irq_exit, since diff --git a/kernel/softirq.c b/kernel/softirq.c index 3d6833f125d3..746010e5f523 100644 --- a/kernel/softirq.c +++ b/kernel/softirq.c @@ -226,6 +226,9 @@ asmlinkage void __do_softirq(void) */ current->flags &= ~PF_MEMALLOC; + /* Mark Feather-Trace samples as "disturbed". */ + ft_irq_fired(); + pending = local_softirq_pending(); account_irq_enter_time(current); -- cgit v1.2.2