ftrace: handle archs that do not support irqs_disabled_flags
authorSteven Rostedt <rostedt@goodmis.org>
Fri, 24 Oct 2008 13:42:59 +0000 (09:42 -0400)
committerIngo Molnar <mingo@elte.hu>
Thu, 30 Oct 2008 23:03:26 +0000 (00:03 +0100)
Impact: build fix on non-lockdep architectures

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>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Documentation/ftrace.txt
kernel/trace/trace.c
kernel/trace/trace.h

index d330fe3103da9c9a3cb8f888ac7255ce48e666d4..ea5a827395dd31a6c34e91da54a6d81367be077a 100644 (file)
@@ -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 a610ca77155891f45d625fe2c5927cae4a3fa8dd..8a499e2adaec2554218051c730f77ccc784ef184 100644 (file)
@@ -656,7 +656,11 @@ tracing_generic_entry_update(struct trace_entry *entry, unsigned long flags,
        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);
@@ -1244,7 +1248,8 @@ lat_print_generic(struct trace_seq *s, struct trace_entry *entry, int cpu)
        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 6889ca48f1f1fab8d57f3afb3ab7c9d9cb884c4f..8465ad052707afe380e2fba0017c0f37fb1d5093 100644 (file)
@@ -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