[tip:perf/core] tracing: Cleanup the convoluted softirq tracepoints

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: tip-bot for Thomas Gleixner
Date: Thursday, October 21, 2010 - 7:52 am

Commit-ID:  f4bc6bb2d562703eafc895c37e7be20906de139d
Gitweb:     http://git.kernel.org/tip/f4bc6bb2d562703eafc895c37e7be20906de139d
Author:     Thomas Gleixner <tglx@linutronix.de>
AuthorDate: Tue, 19 Oct 2010 15:00:13 +0200
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Thu, 21 Oct 2010 16:50:29 +0200

tracing: Cleanup the convoluted softirq tracepoints

With the addition of trace_softirq_raise() the softirq tracepoint got
even more convoluted. Why the tracepoints take two pointers to assign
an integer is beyond my comprehension.

But adding an extra case which treats the first pointer as an unsigned
long when the second pointer is NULL including the back and forth
type casting is just horrible.

Convert the softirq tracepoints to take a single unsigned int argument
for the softirq vector number and fix the call sites.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
LKML-Reference: <alpine.LFD.2.00.1010191428560.6815@localhost6.localdomain6>
Acked-by: Peter Zijlstra <peterz@infradead.org>
Acked-by: mathieu.desnoyers@efficios.com
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Steven Rostedt <rostedt@goodmis.org>

---
 include/linux/interrupt.h  |    2 +-
 include/trace/events/irq.h |   54 ++++++++++++++++---------------------------
 kernel/softirq.c           |   16 +++++++-----
 3 files changed, 30 insertions(+), 42 deletions(-)

diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h
index 531495d..0ac1949 100644
--- a/include/linux/interrupt.h
+++ b/include/linux/interrupt.h
@@ -410,7 +410,7 @@ extern void open_softirq(int nr, void (*action)(struct softirq_action *));
 extern void softirq_init(void);
 static inline void __raise_softirq_irqoff(unsigned int nr)
 {
-	trace_softirq_raise((struct softirq_action *)(unsigned long)nr, NULL);
+	trace_softirq_raise(nr);
 	or_softirq_pending(1UL << nr);
 }
 
diff --git a/include/trace/events/irq.h b/include/trace/events/irq.h
index 6fa7cba..1c09820 100644
--- a/include/trace/events/irq.h
+++ b/include/trace/events/irq.h
@@ -86,76 +86,62 @@ TRACE_EVENT(irq_handler_exit,
 
 DECLARE_EVENT_CLASS(softirq,
 
-	TP_PROTO(struct softirq_action *h, struct softirq_action *vec),
+	TP_PROTO(unsigned int vec_nr),
 
-	TP_ARGS(h, vec),
+	TP_ARGS(vec_nr),
 
 	TP_STRUCT__entry(
-		__field(	int,	vec			)
+		__field(	unsigned int,	vec	)
 	),
 
 	TP_fast_assign(
-		if (vec)
-			__entry->vec = (int)(h - vec);
-		else
-			__entry->vec = (int)(long)h;
+		__entry->vec = vec_nr;
 	),
 
-	TP_printk("vec=%d [action=%s]", __entry->vec,
+	TP_printk("vec=%u [action=%s]", __entry->vec,
 		  show_softirq_name(__entry->vec))
 );
 
 /**
  * softirq_entry - called immediately before the softirq handler
- * @h: pointer to struct softirq_action
- * @vec: pointer to first struct softirq_action in softirq_vec array
+ * @vec_nr:  softirq vector number
  *
- * The @h parameter, contains a pointer to the struct softirq_action
- * which has a pointer to the action handler that is called. By subtracting
- * the @vec pointer from the @h pointer, we can determine the softirq
- * number. Also, when used in combination with the softirq_exit tracepoint
- * we can determine the softirq latency.
+ * When used in combination with the softirq_exit tracepoint
+ * we can determine the softirq handler runtine.
  */
 DEFINE_EVENT(softirq, softirq_entry,
 
-	TP_PROTO(struct softirq_action *h, struct softirq_action *vec),
+	TP_PROTO(unsigned int vec_nr),
 
-	TP_ARGS(h, vec)
+	TP_ARGS(vec_nr)
 );
 
 /**
  * softirq_exit - called immediately after the softirq handler returns
- * @h: pointer to struct softirq_action
- * @vec: pointer to first struct softirq_action in softirq_vec array
+ * @vec_nr:  softirq vector number
  *
- * The @h parameter contains a pointer to the struct softirq_action
- * that has handled the softirq. By subtracting the @vec pointer from
- * the @h pointer, we can determine the softirq number. Also, when used in
- * combination with the softirq_entry tracepoint we can determine the softirq
- * latency.
+ * When used in combination with the softirq_entry tracepoint
+ * we can determine the softirq handler runtine.
  */
 DEFINE_EVENT(softirq, softirq_exit,
 
-	TP_PROTO(struct softirq_action *h, struct softirq_action *vec),
+	TP_PROTO(unsigned int vec_nr),
 
-	TP_ARGS(h, vec)
+	TP_ARGS(vec_nr)
 );
 
 /**
  * softirq_raise - called immediately when a softirq is raised
- * @h: pointer to struct softirq_action
- * @vec: pointer to first struct softirq_action in softirq_vec array
+ * @vec_nr:  softirq vector number
  *
- * The @h parameter contains a pointer to the softirq vector number which is
- * raised. @vec is NULL and it means @h includes vector number not
- * softirq_action. When used in combination with the softirq_entry tracepoint
- * we can determine the softirq raise latency.
+ * When used in combination with the softirq_entry tracepoint
+ * we can determine the softirq raise to run latency.
  */
 DEFINE_EVENT(softirq, softirq_raise,
 
-	TP_PROTO(struct softirq_action *h, struct softirq_action *vec),
+	TP_PROTO(unsigned int vec_nr),
 
-	TP_ARGS(h, vec)
+	TP_ARGS(vec_nr)
 );
 
 #endif /*  _TRACE_IRQ_H */
diff --git a/kernel/softirq.c b/kernel/softirq.c
index 07b4f1b..b3cb1dc 100644
--- a/kernel/softirq.c
+++ b/kernel/softirq.c
@@ -212,18 +212,20 @@ restart:
 
 	do {
 		if (pending & 1) {
+			unsigned int vec_nr = h - softirq_vec;
 			int prev_count = preempt_count();
-			kstat_incr_softirqs_this_cpu(h - softirq_vec);
 
-			trace_softirq_entry(h, softirq_vec);
+			kstat_incr_softirqs_this_cpu(vec_nr);
+
+			trace_softirq_entry(vec_nr);
 			h->action(h);
-			trace_softirq_exit(h, softirq_vec);
+			trace_softirq_exit(vec_nr);
 			if (unlikely(prev_count != preempt_count())) {
-				printk(KERN_ERR "huh, entered softirq %td %s %p"
+				printk(KERN_ERR "huh, entered softirq %u %s %p"
 				       "with preempt_count %08x,"
-				       " exited with %08x?\n", h - softirq_vec,
-				       softirq_to_name[h - softirq_vec],
-				       h->action, prev_count, preempt_count());
+				       " exited with %08x?\n", vec_nr,
+				       softirq_to_name[vec_nr], h->action,
+				       prev_count, preempt_count());
 				preempt_count() = prev_count;
 			}
 
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH v4 0/5] netdev: show a process of packets, Koki Sanagi, (Mon Aug 23, 2:41 am)
[PATCH v4 1/5] irq: add tracepoint to softirq_raise, Koki Sanagi, (Mon Aug 23, 2:42 am)
[PATCH v4 4/5] skb: add tracepoints to freeing skb, Koki Sanagi, (Mon Aug 23, 2:46 am)
Re: [PATCH v4 4/5] skb: add tracepoints to freeing skb, David Miller, (Mon Aug 23, 8:53 pm)
Re: [PATCH v4 0/5] netdev: show a process of packets, Steven Rostedt, (Mon Aug 30, 4:50 pm)
Re: [PATCH v4 0/5] netdev: show a process of packets, Koki Sanagi, (Thu Sep 2, 7:10 pm)
Re: [PATCH v4 0/5] netdev: show a process of packets, David Miller, (Thu Sep 2, 7:17 pm)
Re: [PATCH v4 0/5] netdev: show a process of packets, Koki Sanagi, (Thu Sep 2, 7:55 pm)
Re: [PATCH v4 0/5] netdev: show a process of packets, Frederic Weisbecker, (Thu Sep 2, 9:46 pm)
Re: [PATCH v4 0/5] netdev: show a process of packets, Koki Sanagi, (Thu Sep 2, 10:12 pm)
Re: [PATCH v4 1/5] irq: add tracepoint to softirq_raise, Frederic Weisbecker, (Fri Sep 3, 8:29 am)
Re: [PATCH v4 1/5] irq: add tracepoint to softirq_raise, Steven Rostedt, (Fri Sep 3, 8:39 am)
Re: [PATCH v4 1/5] irq: add tracepoint to softirq_raise, Frederic Weisbecker, (Fri Sep 3, 8:42 am)
Re: [PATCH v4 1/5] irq: add tracepoint to softirq_raise, Steven Rostedt, (Fri Sep 3, 8:43 am)
Re: [PATCH v4 1/5] irq: add tracepoint to softirq_raise, Frederic Weisbecker, (Fri Sep 3, 8:50 am)
Re: [PATCH v4 5/5] perf:add a script shows a process of packet, Frederic Weisbecker, (Tue Sep 7, 9:57 am)
[tip:perf/core] irq: Add tracepoint to softirq_raise, tip-bot for Lai Jian ..., (Wed Sep 8, 1:33 am)
[tip:perf/core] napi: Convert trace_napi_poll to TRACE_EVENT, tip-bot for Neil Horman, (Wed Sep 8, 1:34 am)
[tip:perf/core] skb: Add tracepoints to freeing skb, tip-bot for Koki Sanagi, (Wed Sep 8, 1:35 am)
[tip:perf/core] perf: Add a script to show packets processing, tip-bot for Koki Sanagi, (Wed Sep 8, 1:35 am)
[PATCH] irq: Fix circular headers dependency, Frederic Weisbecker, (Wed Sep 8, 5:26 am)
[tip:perf/core] irq: Fix circular headers dependency, tip-bot for Frederic ..., (Thu Sep 9, 12:54 pm)
[PATCH] tracing: Cleanup the convoluted softirq tracepoints, Thomas Gleixner, (Tue Oct 19, 6:00 am)
Re: [PATCH] tracing: Cleanup the convoluted softirq tracep ..., Mathieu Desnoyers, (Tue Oct 19, 6:22 am)
Re: [PATCH] tracing: Cleanup the convoluted softirq tracep ..., Mathieu Desnoyers, (Tue Oct 19, 7:00 am)
Re: [PATCH] tracing: Cleanup the convoluted softirq tracep ..., Mathieu Desnoyers, (Tue Oct 19, 7:28 am)
Re: [PATCH] tracing: Cleanup the convoluted softirq tracep ..., Mathieu Desnoyers, (Tue Oct 19, 3:41 pm)
Re: [PATCH] tracing: Cleanup the convoluted softirq tracep ..., Mathieu Desnoyers, (Wed Oct 20, 8:41 am)
[tip:perf/core] tracing: Cleanup the convoluted softirq tr ..., tip-bot for Thomas G ..., (Thu Oct 21, 7:52 am)
Re: [PATCH] tracing: Cleanup the convoluted softirq tracep ..., Mathieu Desnoyers, (Mon Oct 25, 3:01 pm)
Re: [PATCH] tracing: Cleanup the convoluted softirq tracep ..., Mathieu Desnoyers, (Mon Oct 25, 3:55 pm)
Re: [PATCH] tracing: Cleanup the convoluted softirq tracep ..., Mathieu Desnoyers, (Mon Oct 25, 6:14 pm)