Welcome to Soft32 Linux Forums!
FAQFAQ    SearchSearch      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

[PATCH] softirq,tracing: enable to trace softirq raise lat..

 
   Soft32 Home -> Linux -> Kernel RSS
Next:  [Resend] [PATCH] asus-laptop: add Lenovo SL Lenov..  
Author Message
Lai Jiangshan

External


Since: Nov 04, 2008
Posts: 106



(Msg. 1) Posted: Tue Dec 08, 2009 3:20 am
Post subject: [PATCH] softirq,tracing: enable to trace softirq raise latency
Archived from groups: linux>kernel (more info?)

Rebase it for the newly codes
Collect Acks(Acked-by Mathieu Desnoyers and Frederic Weisbecker)


From: Lai Jiangshan <laijs.DeleteThis@cn.fujitsu.com>

Add a tracepoint for tracing when softirq action is raised.

It and the existed tracepoints complete softirq's tracepoints:
softirq_raise, softirq_entry and softirq_exit.

And when this tracepoint is used in combination with
the softirq_entry tracepoint we can determine
the softirq raise latency.

Signed-off-by: Lai Jiangshan <laijs.DeleteThis@cn.fujitsu.com>
Acked-by: Mathieu Desnoyers <mathieu.desnoyers.DeleteThis@polymtl.ca>
Acked-by: Frederic Weisbecker <fweisbec.DeleteThis@gmail.com>
---
diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h
index 75f3f00..b368d5d 100644
--- a/include/linux/interrupt.h
+++ b/include/linux/interrupt.h
@@ -18,6 +18,7 @@
#include <asm/atomic.h>
#include <asm/ptrace.h>
#include <asm/system.h>
+#include <trace/events/irq.h>

/*
* These correspond to the IORESOURCE_IRQ_* defines in
@@ -372,7 +373,13 @@ asmlinkage void do_softirq(void);
asmlinkage void __do_softirq(void);
extern void open_softirq(int nr, void (*action)(struct softirq_action *));
extern void softirq_init(void);
-#define __raise_softirq_irqoff(nr) do { or_softirq_pending(1UL << (nr)); } while (0)
+
+static inline void __raise_softirq_irqoff(unsigned int nr)
+{
+ trace_softirq_raise(nr);
+ or_softirq_pending(1UL << nr);
+}
+
extern void raise_softirq_irqoff(unsigned int nr);
extern void raise_softirq(unsigned int nr);
extern void wakeup_softirqd(void);
diff --git a/include/trace/events/irq.h b/include/trace/events/irq.h
index 0e4cfb6..7a21fe2 100644
--- a/include/trace/events/irq.h
+++ b/include/trace/events/irq.h
@@ -5,7 +5,9 @@
#define _TRACE_IRQ_H

#include <linux/tracepoint.h>
-#include <linux/interrupt.h>
+
+struct irqaction;
+struct softirq_action;

#define softirq_name(sirq) { sirq##_SOFTIRQ, #sirq }
#define show_softirq_name(val) \
@@ -82,6 +84,32 @@ TRACE_EVENT(irq_handler_exit,
__entry->irq, __entry->ret ? "handled" : "unhandled")
);

+/**
+ * softirq_raise - called immediately when a softirq is raised
+ * @nr: softirq vector number
+ *
+ * Tracepoint for tracing when softirq action is raised.
+ * Also, when used in combination with the softirq_entry tracepoint
+ * we can determine the softirq raise latency.
+ */
+TRACE_EVENT(softirq_raise,
+
+ TP_PROTO(unsigned int nr),
+
+ TP_ARGS(nr),
+
+ TP_STRUCT__entry(
+ __field( unsigned int, vec )
+ ),
+
+ TP_fast_assign(
+ __entry->vec = nr;
+ ),
+
+ TP_printk("vec=%d [action=%s]", __entry->vec,
+ show_softirq_name(__entry->vec))
+);
+
DECLARE_EVENT_CLASS(softirq,

TP_PROTO(struct softirq_action *h, struct softirq_action *vec),
@@ -89,11 +117,11 @@ DECLARE_EVENT_CLASS(softirq,
TP_ARGS(h, vec),

TP_STRUCT__entry(
- __field( int, vec )
+ __field( unsigned int, vec )
),

TP_fast_assign(
- __entry->vec = (int)(h - vec);
+ __entry->vec = (unsigned int)(h - vec);
),

TP_printk("vec=%d [action=%s]", __entry->vec,
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo.DeleteThis@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to top
Login to vote
Ingo Molnar

External


Since: Nov 05, 2003
Posts: 3017



(Msg. 2) Posted: Thu Dec 10, 2009 3:24 am
Post subject: Re: [PATCH] softirq,tracing: enable to trace softirq raise latency [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

* Lai Jiangshan <laijs DeleteThis @cn.fujitsu.com> wrote:

> Rebase it for the newly codes
> Collect Acks(Acked-by Mathieu Desnoyers and Frederic Weisbecker)
>
>
> From: Lai Jiangshan <laijs DeleteThis @cn.fujitsu.com>
>
> Add a tracepoint for tracing when softirq action is raised.
>
> It and the existed tracepoints complete softirq's tracepoints:
> softirq_raise, softirq_entry and softirq_exit.
>
> And when this tracepoint is used in combination with
> the softirq_entry tracepoint we can determine
> the softirq raise latency.
>
> Signed-off-by: Lai Jiangshan <laijs DeleteThis @cn.fujitsu.com>
> Acked-by: Mathieu Desnoyers <mathieu.desnoyers DeleteThis @polymtl.ca>
> Acked-by: Frederic Weisbecker <fweisbec DeleteThis @gmail.com>

ok, it would be nice to expose this functionality via some sort of 'perf
trace --irqlatency' (or perhaps a separate 'perf irq record' 'perf irq
trace' tool) so that users/developers can make use of this new event and
that we can check that it works and latencies are correct, etc.

Ingo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo DeleteThis @vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to top
Login to vote
Display posts from previous:   
Related Topics:
[PATCH 0/8] sched_domain balancing via softirq V4 - This patchset moves more or less expensive load balancing out of the scheduler tick (where we run with interrupts..

[PATCH] Prevent going idle with softirq pending - The NOHZ patch contains a check for softirqs pending when a CPU goes idle. The BUG is unrelated to NOHZ, it just was..

[PATCH] bracing the loop in kernel/softirq.c - This trivial patch adds braces over a one-line loop. That makes code...well... little bit convenient for (possible)..

[PATCH RT] fix migrating softirq [cause of network hang] - Softirqs are bound to a single CPU. That is to say, that once a softirq function starts to run, it will stay on the CP...

locking issue (hardirq+softirq+user) - Hi! an user still gets NMI watchdog warning, that the machine deadlocked. The code is something like this: ..

[PATCH 1/7] Documention for trace record (trec), a light w.. - Signed-off-by: Wink Saville <wink@saville.com> --- Documentation/trec.txt | 87..
       Soft32 Home -> Linux -> Kernel All times are: Pacific Time (US & Canada) (change)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

Categories:
 Windows
  Linux
 Mac
 PDA


[ Contact us | Terms of Service/Privacy Policy ]