lkml.org 
[lkml]   [2011]   [Jul]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH v2 5/6] trace: Add tracepoints to call function interrupt handlers
Date
Add tracepoints to call function and call function single interrupt
handlers.

This is a part of overall effort to trace all the interrupts happening
in a system. This shows how the interrupts are interacting with other
events and what time is spent in kernel space versus user space.

Signed-off-by: Vaibhav Nagarnaik <vnagarnaik@google.com>
---
include/trace/events/irq.h | 73 ++++++++++++++++++++++++++++++++++++++++++++
kernel/smp.c | 6 +++-
2 files changed, 78 insertions(+), 1 deletions(-)

diff --git a/include/trace/events/irq.h b/include/trace/events/irq.h
index a2a0a49..5e4f731 100644
--- a/include/trace/events/irq.h
+++ b/include/trace/events/irq.h
@@ -384,6 +384,79 @@ DEFINE_EVENT(reschedule_interrupt, reschedule_interrupt_exit,
TP_ARGS(ignore)
);

+DECLARE_EVENT_CLASS(call_function_ipi,
+
+ TP_PROTO(unsigned int ignore),
+
+ TP_ARGS(ignore),
+
+ TP_STRUCT__entry(
+ __field( unsigned int, ignore )
+ ),
+
+ TP_fast_assign(
+ __entry->ignore = ignore;
+ ),
+
+ TP_printk("%u", __entry->ignore)
+);
+
+/**
+ * call_function_ipi_entry - called immediately after entering the
+ * call function interrupt handler
+ *
+ * When used in combination with the call_function_ipi_exit tracepoint
+ * we can determine the call function interrupt handler runtime.
+ */
+DEFINE_EVENT(call_function_ipi, call_function_ipi_entry,
+
+ TP_PROTO(unsigned int ignore),
+
+ TP_ARGS(ignore)
+);
+
+/**
+ * call_function_ipi_exit - called just before the call function interrupt
+ * handler returns
+ *
+ * When used in combination with the call_function_ipi_entry tracepoint
+ * we can determine the call function interrupt handler runtime.
+ */
+DEFINE_EVENT(call_function_ipi, call_function_ipi_exit,
+
+ TP_PROTO(unsigned int ignore),
+
+ TP_ARGS(ignore)
+);
+
+/**
+ * call_function_single_ipi_entry - called immediately after entering the
+ * call function single interrupt handler
+ *
+ * When used in combination with the call_function_single_ipi_exit tracepoint
+ * we can determine the call function single interrupt handler runtime.
+ */
+DEFINE_EVENT(call_function_ipi, call_function_single_ipi_entry,
+
+ TP_PROTO(unsigned int ignore),
+
+ TP_ARGS(ignore)
+);
+
+/**
+ * call_function_single_ipi_exit - called just before the call function single
+ * interrupt handler returns
+ *
+ * When used in combination with the call_function_single_ipi_entry tracepoint
+ * we can determine the call function single interrupt handler runtime.
+ */
+DEFINE_EVENT(call_function_ipi, call_function_single_ipi_exit,
+
+ TP_PROTO(unsigned int ignore),
+
+ TP_ARGS(ignore)
+);
+
#endif /* _TRACE_IRQ_H */

/* This part must be outside protection */
diff --git a/kernel/smp.c b/kernel/smp.c
index fb67dfa..4ea6769 100644
--- a/kernel/smp.c
+++ b/kernel/smp.c
@@ -12,6 +12,7 @@
#include <linux/gfp.h>
#include <linux/smp.h>
#include <linux/cpu.h>
+#include <trace/events/irq.h>

#ifdef CONFIG_USE_GENERIC_SMP_HELPERS
static struct {
@@ -172,6 +173,7 @@ void generic_smp_call_function_interrupt(void)
struct call_function_data *data;
int cpu = smp_processor_id();

+ trace_call_function_ipi_entry(0);
/*
* Shouldn't receive this interrupt on a cpu that is not yet online.
*/
@@ -239,7 +241,7 @@ void generic_smp_call_function_interrupt(void)

csd_unlock(&data->csd);
}
-
+ trace_call_function_ipi_exit(0);
}

/*
@@ -252,6 +254,7 @@ void generic_smp_call_function_single_interrupt(void)
unsigned int data_flags;
LIST_HEAD(list);

+ trace_call_function_single_ipi_entry(0);
/*
* Shouldn't receive this interrupt on a cpu that is not yet online.
*/
@@ -282,6 +285,7 @@ void generic_smp_call_function_single_interrupt(void)
if (data_flags & CSD_FLAG_LOCK)
csd_unlock(data);
}
+ trace_call_function_single_ipi_exit(0);
}

static DEFINE_PER_CPU_SHARED_ALIGNED(struct call_single_data, csd_data);
--
1.7.3.1


\
 
 \ /
  Last update: 2011-07-27 21:01    [W:0.148 / U:1.408 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site