linux-rt-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jan Blunck <jblunck@suse.de>
To: Linux-Kernel Mailinglist <linux-kernel@vger.kernel.org>,
	linux-rt-users@vger.kernel.org
Cc: peterz@infradead.org,
	Sven-Thorsten Dietrich <sdietrich@novell.com>,
	Michael Galbraith <MGalbraith@novell.com>,
	Jan Blunck <jblunck@suse.de>
Subject: [RFC 1/4] ftrace: Add events for tracing timer interrupts
Date: Wed,  8 Sep 2010 14:29:21 +0200	[thread overview]
Message-ID: <1283948964-6418-2-git-send-email-jblunck@suse.de> (raw)
In-Reply-To: <1283948964-6418-1-git-send-email-jblunck@suse.de>

Trace the execution of the timer interrupt. I did not find an argument that
makes any sense so traces look like this:

<idle>-0     [000] 181019.693546: timerirq_enter: unused=1
<idle>-0     [000] 181019.693553: timerirq_exit: unused=1

Signed-off-by: Jan Blunck <jblunck@suse.de>
---
 arch/x86/kernel/apic/apic.c |    4 ++++
 arch/x86/kernel/time.c      |    5 +++++
 include/trace/events/irq.h  |   38 ++++++++++++++++++++++++++++++++++++++
 3 files changed, 47 insertions(+), 0 deletions(-)

diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c
index a96489e..edd775b 100644
--- a/arch/x86/kernel/apic/apic.c
+++ b/arch/x86/kernel/apic/apic.c
@@ -35,6 +35,8 @@
 #include <linux/smp.h>
 #include <linux/mm.h>
 
+#include <trace/events/irq.h>
+
 #include <asm/perf_event.h>
 #include <asm/x86_init.h>
 #include <asm/pgalloc.h>
@@ -823,7 +825,9 @@ void __irq_entry smp_apic_timer_interrupt(struct pt_regs *regs)
 	 */
 	exit_idle();
 	irq_enter();
+	trace_timerirq_enter(1);
 	local_apic_timer_interrupt();
+	trace_timerirq_exit(1);
 	irq_exit();
 
 	set_irq_regs(old_regs);
diff --git a/arch/x86/kernel/time.c b/arch/x86/kernel/time.c
index fb5cc5e..01c2395 100644
--- a/arch/x86/kernel/time.c
+++ b/arch/x86/kernel/time.c
@@ -14,6 +14,8 @@
 #include <linux/time.h>
 #include <linux/mca.h>
 
+#include <trace/events/irq.h>
+
 #include <asm/vsyscall.h>
 #include <asm/x86_init.h>
 #include <asm/i8259.h>
@@ -63,6 +65,8 @@ static irqreturn_t timer_interrupt(int irq, void *dev_id)
 	/* Keep nmi watchdog up to date */
 	inc_irq_stat(irq0_irqs);
 
+	trace_timerirq_enter(0);
+
 	/* Optimized out for !IO_APIC and x86_64 */
 	if (timer_ack) {
 		/*
@@ -83,6 +87,7 @@ static irqreturn_t timer_interrupt(int irq, void *dev_id)
 	if (MCA_bus)
 		outb_p(inb_p(0x61)| 0x80, 0x61);
 
+	trace_timerirq_exit(0);
 	return IRQ_HANDLED;
 }
 
diff --git a/include/trace/events/irq.h b/include/trace/events/irq.h
index 0e4cfb6..c638ab0 100644
--- a/include/trace/events/irq.h
+++ b/include/trace/events/irq.h
@@ -136,6 +136,44 @@ DEFINE_EVENT(softirq, softirq_exit,
 	TP_ARGS(h, vec)
 );
 
+/**
+ * timerirq_enter
+ */
+TRACE_EVENT(timerirq_enter,
+
+	TP_PROTO(int unused),
+
+	TP_ARGS(unused),
+
+	TP_STRUCT__entry(
+		__field(u64, unused)
+		),
+
+	TP_fast_assign(
+		__entry->unused = unused;
+		),
+	TP_printk("unused=%lu", (unsigned long)__entry->unused)
+);
+
+/**
+ * timerirq_exit
+ */
+TRACE_EVENT(timerirq_exit,
+
+	TP_PROTO(int unused),
+
+	TP_ARGS(unused),
+
+	TP_STRUCT__entry(
+		__field(u64, unused)
+		),
+
+	TP_fast_assign(
+		__entry->unused = unused;
+		),
+	TP_printk("unused=%lu", (unsigned long)__entry->unused)
+);
+
 #endif /*  _TRACE_IRQ_H */
 
 /* This part must be outside protection */
-- 
1.6.4.2


  reply	other threads:[~2010-09-08 12:29 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-08 12:29 [RFC 0/4] Disable timer tick for SCHED_FIFO tasks Jan Blunck
2010-09-08 12:29 ` Jan Blunck [this message]
2010-09-08 12:38   ` [RFC 1/4] ftrace: Add events for tracing timer interrupts Peter Zijlstra
2010-09-08 13:24   ` Andi Kleen
2010-09-08 12:29 ` [RFC 2/4] ftrace: Add events for tracing tick start and stop Jan Blunck
2010-09-08 12:29 ` [RFC 3/4] Disable scheduler tick when we are running SCHED_FIFO tasks Jan Blunck
2010-09-08 12:43   ` Peter Zijlstra
2010-09-08 14:32     ` Jan Blunck
2010-09-08 12:45   ` Peter Zijlstra
2010-09-08 13:21     ` Thomas Gleixner
2010-09-08 14:28     ` Jan Blunck
2010-09-08 17:11       ` Andi Kleen
2010-09-08 13:25   ` Andi Kleen
2010-09-08 14:47     ` Jan Blunck
2010-09-08 12:29 ` [RFC 4/4] ftrace: Add argument to tick start/stop tracing Jan Blunck

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1283948964-6418-2-git-send-email-jblunck@suse.de \
    --to=jblunck@suse.de \
    --cc=MGalbraith@novell.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rt-users@vger.kernel.org \
    --cc=peterz@infradead.org \
    --cc=sdietrich@novell.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).