diff options
author | Steven Rostedt (Red Hat) <rostedt@goodmis.org> | 2013-03-09 00:56:08 -0500 |
---|---|---|
committer | Steven Rostedt <rostedt@goodmis.org> | 2013-03-15 00:35:57 -0400 |
commit | 1b22e382ab40b0e3ee5abb3e310dffb16fee22aa (patch) | |
tree | 2e6ca7c130fb6420ba955072275218c7ec287511 /kernel/trace | |
parent | ca268da6e415448a43138e1abc5d5f057af319d7 (diff) |
tracing: Let tracing_snapshot() be used by modules but not NMI
Add EXPORT_SYMBOL_GPL() to let the tracing_snapshot() functions be
called from modules.
Also add a test to see if the snapshot was called from NMI context
and just warn in the tracing buffer if so, and return.
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Diffstat (limited to 'kernel/trace')
-rw-r--r-- | kernel/trace/trace.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c index d372c6504c99..5c53e4092269 100644 --- a/kernel/trace/trace.c +++ b/kernel/trace/trace.c | |||
@@ -442,6 +442,12 @@ void tracing_snapshot(void) | |||
442 | struct tracer *tracer = tr->current_trace; | 442 | struct tracer *tracer = tr->current_trace; |
443 | unsigned long flags; | 443 | unsigned long flags; |
444 | 444 | ||
445 | if (in_nmi()) { | ||
446 | internal_trace_puts("*** SNAPSHOT CALLED FROM NMI CONTEXT ***\n"); | ||
447 | internal_trace_puts("*** snapshot is being ignored ***\n"); | ||
448 | return; | ||
449 | } | ||
450 | |||
445 | if (!tr->allocated_snapshot) { | 451 | if (!tr->allocated_snapshot) { |
446 | internal_trace_puts("*** SNAPSHOT NOT ALLOCATED ***\n"); | 452 | internal_trace_puts("*** SNAPSHOT NOT ALLOCATED ***\n"); |
447 | internal_trace_puts("*** stopping trace here! ***\n"); | 453 | internal_trace_puts("*** stopping trace here! ***\n"); |
@@ -460,6 +466,7 @@ void tracing_snapshot(void) | |||
460 | update_max_tr(tr, current, smp_processor_id()); | 466 | update_max_tr(tr, current, smp_processor_id()); |
461 | local_irq_restore(flags); | 467 | local_irq_restore(flags); |
462 | } | 468 | } |
469 | EXPORT_SYMBOL_GPL(tracing_snapshot); | ||
463 | 470 | ||
464 | static int resize_buffer_duplicate_size(struct trace_buffer *trace_buf, | 471 | static int resize_buffer_duplicate_size(struct trace_buffer *trace_buf, |
465 | struct trace_buffer *size_buf, int cpu_id); | 472 | struct trace_buffer *size_buf, int cpu_id); |
@@ -493,16 +500,19 @@ void tracing_snapshot_alloc(void) | |||
493 | 500 | ||
494 | tracing_snapshot(); | 501 | tracing_snapshot(); |
495 | } | 502 | } |
503 | EXPORT_SYMBOL_GPL(tracing_snapshot_alloc); | ||
496 | #else | 504 | #else |
497 | void tracing_snapshot(void) | 505 | void tracing_snapshot(void) |
498 | { | 506 | { |
499 | WARN_ONCE(1, "Snapshot feature not enabled, but internal snapshot used"); | 507 | WARN_ONCE(1, "Snapshot feature not enabled, but internal snapshot used"); |
500 | } | 508 | } |
509 | EXPORT_SYMBOL_GPL(tracing_snapshot); | ||
501 | void tracing_snapshot_alloc(void) | 510 | void tracing_snapshot_alloc(void) |
502 | { | 511 | { |
503 | /* Give warning */ | 512 | /* Give warning */ |
504 | tracing_snapshot(); | 513 | tracing_snapshot(); |
505 | } | 514 | } |
515 | EXPORT_SYMBOL_GPL(tracing_snapshot_alloc); | ||
506 | #endif /* CONFIG_TRACER_SNAPSHOT */ | 516 | #endif /* CONFIG_TRACER_SNAPSHOT */ |
507 | 517 | ||
508 | /** | 518 | /** |