linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>,
	Alexey Dobriyan <adobriyan@gmail.com>,
	Geert Uytterhoeven <geert@linux-m68k.org>,
	Stephen Rothwell <sfr@canb.auug.org.au>,
	linux-next@vger.kernel.org, LKML <linux-kernel@vger.kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>
Subject: [PATCH] ftrace: handle archs that do not support irqs_disabled_flags
Date: Fri, 24 Oct 2008 09:42:59 -0400 (EDT)	[thread overview]
Message-ID: <alpine.DEB.1.10.0810240937130.3882@gandalf.stny.rr.com> (raw)
In-Reply-To: <4901D8CD.7000405@gmail.com>


Some architectures do not support a way to read the irq flags that
is set from "local_irq_save(flags)" to determine if interrupts were
disabled or enabled. Ftrace uses this information to display to the user
if the trace occurred with interrupts enabled or disabled.

Besides the fact that those archs that do not support this will fail to
compile, unless they fix it, we do not want to have the trace simply
say interrupts were not disabled or they were enabled, without knowing
the real answer.

This patch adds a 'X' in the output to let the user know that the
architecture they are running on does not support a way for the tracer
to determine if interrupts were enabled or disabled. It also lets those
same archs compile with tracing enabled.

Signed-off-by: Steven Rostedt <srostedt@redhat.com>
---
 Documentation/ftrace.txt |    3 +++
 kernel/trace/trace.c     |    7 ++++++-
 kernel/trace/trace.h     |   20 +++++++++++---------
 3 files changed, 20 insertions(+), 10 deletions(-)

Index: linux-tip.git/Documentation/ftrace.txt
===================================================================
--- linux-tip.git.orig/Documentation/ftrace.txt	2008-10-23 19:23:26.000000000 -0400
+++ linux-tip.git/Documentation/ftrace.txt	2008-10-24 09:32:42.000000000 -0400
@@ -291,6 +291,9 @@ explains which is which.
   CPU#: The CPU which the process was running on.
 
   irqs-off: 'd' interrupts are disabled. '.' otherwise.
+	    Note: If the architecture does not support a way to
+		  read the irq flags variable, an 'X' will always
+		  be printed here.
 
   need-resched: 'N' task need_resched is set, '.' otherwise.
 
Index: linux-tip.git/kernel/trace/trace.c
===================================================================
--- linux-tip.git.orig/kernel/trace/trace.c	2008-10-23 19:24:15.000000000 -0400
+++ linux-tip.git/kernel/trace/trace.c	2008-10-24 09:31:17.000000000 -0400
@@ -677,7 +677,11 @@ tracing_generic_entry_update(struct trac
 	entry->preempt_count		= pc & 0xff;
 	entry->pid			= (tsk) ? tsk->pid : 0;
 	entry->flags =
+#ifdef CONFIG_TRACE_IRQFLAGS_SUPPORT
 		(irqs_disabled_flags(flags) ? TRACE_FLAG_IRQS_OFF : 0) |
+#else
+		TRACE_FLAG_IRQS_NOSUPPORT |
+#endif
 		((pc & HARDIRQ_MASK) ? TRACE_FLAG_HARDIRQ : 0) |
 		((pc & SOFTIRQ_MASK) ? TRACE_FLAG_SOFTIRQ : 0) |
 		(need_resched() ? TRACE_FLAG_NEED_RESCHED : 0);
@@ -1265,7 +1269,8 @@ lat_print_generic(struct trace_seq *s, s
 	trace_seq_printf(s, "%8.8s-%-5d ", comm, entry->pid);
 	trace_seq_printf(s, "%3d", cpu);
 	trace_seq_printf(s, "%c%c",
-			(entry->flags & TRACE_FLAG_IRQS_OFF) ? 'd' : '.',
+			(entry->flags & TRACE_FLAG_IRQS_OFF) ? 'd' :
+			 (entry->flags & TRACE_FLAG_IRQS_NOSUPPORT) ? 'X' : '.',
 			((entry->flags & TRACE_FLAG_NEED_RESCHED) ? 'N' : '.'));
 
 	hardirq = entry->flags & TRACE_FLAG_HARDIRQ;
Index: linux-tip.git/kernel/trace/trace.h
===================================================================
--- linux-tip.git.orig/kernel/trace/trace.h	2008-10-23 12:55:37.000000000 -0400
+++ linux-tip.git/kernel/trace/trace.h	2008-10-24 09:27:10.000000000 -0400
@@ -120,18 +120,20 @@ struct trace_boot {
 /*
  * trace_flag_type is an enumeration that holds different
  * states when a trace occurs. These are:
- *  IRQS_OFF	- interrupts were disabled
- *  NEED_RESCED - reschedule is requested
- *  HARDIRQ	- inside an interrupt handler
- *  SOFTIRQ	- inside a softirq handler
- *  CONT	- multiple entries hold the trace item
+ *  IRQS_OFF		- interrupts were disabled
+ *  IRQS_NOSUPPORT 	- arch does not support irqs_disabled_flags
+ *  NEED_RESCED		- reschedule is requested
+ *  HARDIRQ		- inside an interrupt handler
+ *  SOFTIRQ		- inside a softirq handler
+ *  CONT		- multiple entries hold the trace item
  */
 enum trace_flag_type {
 	TRACE_FLAG_IRQS_OFF		= 0x01,
-	TRACE_FLAG_NEED_RESCHED		= 0x02,
-	TRACE_FLAG_HARDIRQ		= 0x04,
-	TRACE_FLAG_SOFTIRQ		= 0x08,
-	TRACE_FLAG_CONT			= 0x10,
+	TRACE_FLAG_IRQS_NOSUPPORT	= 0x02,
+	TRACE_FLAG_NEED_RESCHED		= 0x04,
+	TRACE_FLAG_HARDIRQ		= 0x08,
+	TRACE_FLAG_SOFTIRQ		= 0x10,
+	TRACE_FLAG_CONT			= 0x20,
 };
 
 #define TRACE_BUF_SIZE		1024



  reply	other threads:[~2008-10-24 13:43 UTC|newest]

Thread overview: 53+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-23 10:36 linux-next: Tree for October 23 Stephen Rothwell
2008-10-23 12:11 ` linux-next: kernel/trace/trace.c:658: error: Alexey Dobriyan
2008-10-23 12:48   ` Frédéric Weisbecker
2008-10-23 13:15     ` Frédéric Weisbecker
2008-10-23 14:41       ` Frederic Weisbecker
2008-10-23 14:37         ` Geert Uytterhoeven
2008-10-23 14:57           ` Frédéric Weisbecker
2008-10-23 15:30             ` Geert Uytterhoeven
2008-10-23 15:33               ` Frédéric Weisbecker
2008-10-23 17:27               ` [PATCH] tracing: fix a build error on alpha and m68k Frederic Weisbecker
2008-10-23 16:24                 ` Frédéric Weisbecker
2008-10-23 16:34                 ` Alexey Dobriyan
2008-10-23 16:35                   ` Frédéric Weisbecker
2008-10-23 16:38                   ` Ingo Molnar
2008-10-23 16:51                     ` Frédéric Weisbecker
2008-10-23 16:55                       ` Ingo Molnar
2008-10-23 17:06                         ` Frédéric Weisbecker
2008-10-23 17:12                           ` Steven Rostedt
2008-10-23 17:25                             ` Frédéric Weisbecker
2008-10-24 14:16                     ` Frederic Weisbecker
2008-10-24 13:42                       ` Steven Rostedt [this message]
2008-10-24 13:54                         ` [PATCH] ftrace: handle archs that do not support irqs_disabled_flags Frédéric Weisbecker
2008-10-25  8:24                         ` Geert Uytterhoeven
2008-10-28  7:25                           ` Greg Ungerer
2008-10-23 17:14                   ` [PATCH] tracing: fix a build error on alpha and m68k Steven Rostedt
2008-10-30 21:49                   ` Alexey Dobriyan
2008-10-30 22:57                     ` Frédéric Weisbecker
2008-10-30 23:03                       ` Ingo Molnar
2008-10-31  8:50                     ` Geert Uytterhoeven
2008-10-31  9:55                       ` Ingo Molnar
2008-11-01 10:16                         ` Geert Uytterhoeven
2008-10-23 16:37                 ` Ingo Molnar
2008-10-23 12:15 ` linux-next: arch/alpha/include/asm/smp.h:48:1: error: "cpu_possible_map" redefined Alexey Dobriyan
2008-10-23 12:16   ` Alexey Dobriyan
2008-10-23 15:10     ` Rusty Russell
2008-10-23 12:22 ` linux-next: include/linux/mmzone.h:288: error: 'CONFIG_NR_CPUS' undeclared here (not in a function) Alexey Dobriyan
2008-10-23 14:38   ` Geert Uytterhoeven
2008-10-23 12:26 ` linux-next: undefined reference to 'forbid_dac' Alexey Dobriyan
2008-10-23 13:16   ` FUJITA Tomonori
2008-10-23 12:57 ` linux-next: undefined reference to `nop_trace' Alexey Dobriyan
2008-10-23 13:07 ` linux-next: arch/s390/kernel/smp.c:120: error: request for member 'bits' in something not a structure or union Alexey Dobriyan
2008-10-23 14:14 ` linux-next: x86_64 UML broken Alexey Dobriyan
2008-10-23 14:48 ` linux-next: drivers/lguest/page_tables.c:1044: error: invalid initializer Alexey Dobriyan
2008-10-24  2:08   ` Rusty Russell
2008-10-24  0:18 ` linux-next: Tree for October 23 (cx88) Randy Dunlap
2008-10-24  1:04 ` linux-next: Tree for October 23 Randy Dunlap
2008-10-26  7:19   ` [ofa-general] " Or Gerlitz
2008-10-26 18:49     ` Randy Dunlap
2008-10-24  1:14 ` [PATCH] PCI hotplug printk format Randy Dunlap
2008-10-24 17:42   ` Jesse Barnes
2008-10-24 17:49   ` Jesse Barnes
2008-10-24  1:17 ` [PATCH] nfsctl: credentials error Randy Dunlap
2008-10-24  1:17 ` [PATCH] coda: " Randy Dunlap

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=alpine.DEB.1.10.0810240937130.3882@gandalf.stny.rr.com \
    --to=rostedt@goodmis.org \
    --cc=adobriyan@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=fweisbec@gmail.com \
    --cc=geert@linux-m68k.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-next@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=sfr@canb.auug.org.au \
    /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).