diff options
author | Steven Rostedt <rostedt@goodmis.org> | 2008-10-24 09:42:59 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-10-30 19:03:26 -0400 |
commit | 9244489a7b69fe0746dc7cb3957f02e05bd1ceb0 (patch) | |
tree | f0fb4a422667f67e7e3ac587bbbc6b03fa83756a | |
parent | f3384b28a05624783b53836ccfed95ecde66a7ad (diff) |
ftrace: handle archs that do not support irqs_disabled_flags
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>
-rw-r--r-- | Documentation/ftrace.txt | 3 | ||||
-rw-r--r-- | kernel/trace/trace.c | 7 | ||||
-rw-r--r-- | kernel/trace/trace.h | 20 |
3 files changed, 20 insertions, 10 deletions
diff --git a/Documentation/ftrace.txt b/Documentation/ftrace.txt index d330fe3103da..ea5a827395dd 100644 --- a/Documentation/ftrace.txt +++ b/Documentation/ftrace.txt | |||
@@ -291,6 +291,9 @@ explains which is which. | |||
291 | CPU#: The CPU which the process was running on. | 291 | CPU#: The CPU which the process was running on. |
292 | 292 | ||
293 | irqs-off: 'd' interrupts are disabled. '.' otherwise. | 293 | irqs-off: 'd' interrupts are disabled. '.' otherwise. |
294 | Note: If the architecture does not support a way to | ||
295 | read the irq flags variable, an 'X' will always | ||
296 | be printed here. | ||
294 | 297 | ||
295 | need-resched: 'N' task need_resched is set, '.' otherwise. | 298 | need-resched: 'N' task need_resched is set, '.' otherwise. |
296 | 299 | ||
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c index a610ca771558..8a499e2adaec 100644 --- a/kernel/trace/trace.c +++ b/kernel/trace/trace.c | |||
@@ -656,7 +656,11 @@ tracing_generic_entry_update(struct trace_entry *entry, unsigned long flags, | |||
656 | entry->preempt_count = pc & 0xff; | 656 | entry->preempt_count = pc & 0xff; |
657 | entry->pid = (tsk) ? tsk->pid : 0; | 657 | entry->pid = (tsk) ? tsk->pid : 0; |
658 | entry->flags = | 658 | entry->flags = |
659 | #ifdef CONFIG_TRACE_IRQFLAGS_SUPPORT | ||
659 | (irqs_disabled_flags(flags) ? TRACE_FLAG_IRQS_OFF : 0) | | 660 | (irqs_disabled_flags(flags) ? TRACE_FLAG_IRQS_OFF : 0) | |
661 | #else | ||
662 | TRACE_FLAG_IRQS_NOSUPPORT | | ||
663 | #endif | ||
660 | ((pc & HARDIRQ_MASK) ? TRACE_FLAG_HARDIRQ : 0) | | 664 | ((pc & HARDIRQ_MASK) ? TRACE_FLAG_HARDIRQ : 0) | |
661 | ((pc & SOFTIRQ_MASK) ? TRACE_FLAG_SOFTIRQ : 0) | | 665 | ((pc & SOFTIRQ_MASK) ? TRACE_FLAG_SOFTIRQ : 0) | |
662 | (need_resched() ? TRACE_FLAG_NEED_RESCHED : 0); | 666 | (need_resched() ? TRACE_FLAG_NEED_RESCHED : 0); |
@@ -1244,7 +1248,8 @@ lat_print_generic(struct trace_seq *s, struct trace_entry *entry, int cpu) | |||
1244 | trace_seq_printf(s, "%8.8s-%-5d ", comm, entry->pid); | 1248 | trace_seq_printf(s, "%8.8s-%-5d ", comm, entry->pid); |
1245 | trace_seq_printf(s, "%3d", cpu); | 1249 | trace_seq_printf(s, "%3d", cpu); |
1246 | trace_seq_printf(s, "%c%c", | 1250 | trace_seq_printf(s, "%c%c", |
1247 | (entry->flags & TRACE_FLAG_IRQS_OFF) ? 'd' : '.', | 1251 | (entry->flags & TRACE_FLAG_IRQS_OFF) ? 'd' : |
1252 | (entry->flags & TRACE_FLAG_IRQS_NOSUPPORT) ? 'X' : '.', | ||
1248 | ((entry->flags & TRACE_FLAG_NEED_RESCHED) ? 'N' : '.')); | 1253 | ((entry->flags & TRACE_FLAG_NEED_RESCHED) ? 'N' : '.')); |
1249 | 1254 | ||
1250 | hardirq = entry->flags & TRACE_FLAG_HARDIRQ; | 1255 | hardirq = entry->flags & TRACE_FLAG_HARDIRQ; |
diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h index 6889ca48f1f1..8465ad052707 100644 --- a/kernel/trace/trace.h +++ b/kernel/trace/trace.h | |||
@@ -120,18 +120,20 @@ struct trace_boot { | |||
120 | /* | 120 | /* |
121 | * trace_flag_type is an enumeration that holds different | 121 | * trace_flag_type is an enumeration that holds different |
122 | * states when a trace occurs. These are: | 122 | * states when a trace occurs. These are: |
123 | * IRQS_OFF - interrupts were disabled | 123 | * IRQS_OFF - interrupts were disabled |
124 | * NEED_RESCED - reschedule is requested | 124 | * IRQS_NOSUPPORT - arch does not support irqs_disabled_flags |
125 | * HARDIRQ - inside an interrupt handler | 125 | * NEED_RESCED - reschedule is requested |
126 | * SOFTIRQ - inside a softirq handler | 126 | * HARDIRQ - inside an interrupt handler |
127 | * CONT - multiple entries hold the trace item | 127 | * SOFTIRQ - inside a softirq handler |
128 | * CONT - multiple entries hold the trace item | ||
128 | */ | 129 | */ |
129 | enum trace_flag_type { | 130 | enum trace_flag_type { |
130 | TRACE_FLAG_IRQS_OFF = 0x01, | 131 | TRACE_FLAG_IRQS_OFF = 0x01, |
131 | TRACE_FLAG_NEED_RESCHED = 0x02, | 132 | TRACE_FLAG_IRQS_NOSUPPORT = 0x02, |
132 | TRACE_FLAG_HARDIRQ = 0x04, | 133 | TRACE_FLAG_NEED_RESCHED = 0x04, |
133 | TRACE_FLAG_SOFTIRQ = 0x08, | 134 | TRACE_FLAG_HARDIRQ = 0x08, |
134 | TRACE_FLAG_CONT = 0x10, | 135 | TRACE_FLAG_SOFTIRQ = 0x10, |
136 | TRACE_FLAG_CONT = 0x20, | ||
135 | }; | 137 | }; |
136 | 138 | ||
137 | #define TRACE_BUF_SIZE 1024 | 139 | #define TRACE_BUF_SIZE 1024 |