From 1bc2f5cceedcacb1079687908233a55a1ae681a3 Mon Sep 17 00:00:00 2001 From: "Bjoern B. Brandenburg" Date: Tue, 24 Jan 2012 09:36:12 +0100 Subject: Feather-Trace: keep track of interrupt-related interference. Increment a processor-local counter whenever an interrupt is handled. This allows Feather-Trace to include a (truncated) counter and a flag to report interference from interrupts. This could be used to filter samples that were disturbed by interrupts. --- include/linux/hardirq.h | 4 ++++ include/litmus/trace.h | 4 +++- include/litmus/trace_irq.h | 21 +++++++++++++++++++++ 3 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 include/litmus/trace_irq.h (limited to 'include') diff --git a/include/linux/hardirq.h b/include/linux/hardirq.h index ba362171e8ae..e6dd5a456bae 100644 --- a/include/linux/hardirq.h +++ b/include/linux/hardirq.h @@ -6,6 +6,8 @@ #include #include +#include + /* * We put the hardirq and softirq counter into the preemption * counter. The bitmask has the following meaning: @@ -186,6 +188,7 @@ extern void rcu_nmi_exit(void); account_system_vtime(current); \ add_preempt_count(HARDIRQ_OFFSET); \ trace_hardirq_enter(); \ + ft_irq_fired(); \ } while (0) /* @@ -216,6 +219,7 @@ extern void irq_exit(void); lockdep_off(); \ rcu_nmi_enter(); \ trace_hardirq_enter(); \ + ft_irq_fired(); \ } while (0) #define nmi_exit() \ diff --git a/include/litmus/trace.h b/include/litmus/trace.h index e2926a08c2f4..e809376d6487 100644 --- a/include/litmus/trace.h +++ b/include/litmus/trace.h @@ -20,7 +20,9 @@ struct timestamp { uint32_t seq_no; uint8_t cpu; uint8_t event; - uint8_t task_type; + uint8_t task_type:2; + uint8_t irq_flag:1; + uint8_t irq_count:5; }; /* tracing callbacks */ diff --git a/include/litmus/trace_irq.h b/include/litmus/trace_irq.h new file mode 100644 index 000000000000..f18b127a089d --- /dev/null +++ b/include/litmus/trace_irq.h @@ -0,0 +1,21 @@ +#ifndef _LITMUS_TRACE_IRQ_H_ +#define _LITMUS_TRACE_IRQ_H_ + +#ifdef CONFIG_SCHED_OVERHEAD_TRACE + +extern DEFINE_PER_CPU(atomic_t, irq_fired_count); + +static inline void ft_irq_fired(void) +{ + /* Only called with preemptions disabled. */ + atomic_inc(&__get_cpu_var(irq_fired_count)); +} + + +#else + +#define ft_irq_fired() /* nothing to do */ + +#endif + +#endif -- cgit v1.2.2