summaryrefslogtreecommitdiffstats
path: root/kernel/trace
diff options
context:
space:
mode:
authorSteven Rostedt (VMware) <rostedt@goodmis.org>2017-04-20 11:34:06 -0400
committerSteven Rostedt (VMware) <rostedt@goodmis.org>2017-04-20 22:06:48 -0400
commitcab5037950821caa1301df0223de657c6ee202a8 (patch)
tree6e4dc12193f78073a237f5cd93cd9b787ae101e6 /kernel/trace
parentd2afd57a4b96f3824220bbb8c067558ca215543f (diff)
tracing/ftrace: Enable snapshot function trigger to work with instances
Modify the snapshot probe trigger to work with instances. This way the snapshot function trigger will only affect the instance that it is added to in the set_ftrace_filter file. Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
Diffstat (limited to 'kernel/trace')
-rw-r--r--kernel/trace/trace.c44
1 files changed, 25 insertions, 19 deletions
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index 18256cd7ad2c..57e9c546bebb 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -894,23 +894,8 @@ int __trace_bputs(unsigned long ip, const char *str)
894EXPORT_SYMBOL_GPL(__trace_bputs); 894EXPORT_SYMBOL_GPL(__trace_bputs);
895 895
896#ifdef CONFIG_TRACER_SNAPSHOT 896#ifdef CONFIG_TRACER_SNAPSHOT
897/** 897static void tracing_snapshot_instance(struct trace_array *tr)
898 * trace_snapshot - take a snapshot of the current buffer.
899 *
900 * This causes a swap between the snapshot buffer and the current live
901 * tracing buffer. You can use this to take snapshots of the live
902 * trace when some condition is triggered, but continue to trace.
903 *
904 * Note, make sure to allocate the snapshot with either
905 * a tracing_snapshot_alloc(), or by doing it manually
906 * with: echo 1 > /sys/kernel/debug/tracing/snapshot
907 *
908 * If the snapshot buffer is not allocated, it will stop tracing.
909 * Basically making a permanent snapshot.
910 */
911void tracing_snapshot(void)
912{ 898{
913 struct trace_array *tr = &global_trace;
914 struct tracer *tracer = tr->current_trace; 899 struct tracer *tracer = tr->current_trace;
915 unsigned long flags; 900 unsigned long flags;
916 901
@@ -938,6 +923,27 @@ void tracing_snapshot(void)
938 update_max_tr(tr, current, smp_processor_id()); 923 update_max_tr(tr, current, smp_processor_id());
939 local_irq_restore(flags); 924 local_irq_restore(flags);
940} 925}
926
927/**
928 * trace_snapshot - take a snapshot of the current buffer.
929 *
930 * This causes a swap between the snapshot buffer and the current live
931 * tracing buffer. You can use this to take snapshots of the live
932 * trace when some condition is triggered, but continue to trace.
933 *
934 * Note, make sure to allocate the snapshot with either
935 * a tracing_snapshot_alloc(), or by doing it manually
936 * with: echo 1 > /sys/kernel/debug/tracing/snapshot
937 *
938 * If the snapshot buffer is not allocated, it will stop tracing.
939 * Basically making a permanent snapshot.
940 */
941void tracing_snapshot(void)
942{
943 struct trace_array *tr = &global_trace;
944
945 tracing_snapshot_instance(tr);
946}
941EXPORT_SYMBOL_GPL(tracing_snapshot); 947EXPORT_SYMBOL_GPL(tracing_snapshot);
942 948
943static int resize_buffer_duplicate_size(struct trace_buffer *trace_buf, 949static int resize_buffer_duplicate_size(struct trace_buffer *trace_buf,
@@ -6739,7 +6745,7 @@ ftrace_snapshot(unsigned long ip, unsigned long parent_ip,
6739 struct trace_array *tr, struct ftrace_probe_ops *ops, 6745 struct trace_array *tr, struct ftrace_probe_ops *ops,
6740 void *data) 6746 void *data)
6741{ 6747{
6742 tracing_snapshot(); 6748 tracing_snapshot_instance(tr);
6743} 6749}
6744 6750
6745static void 6751static void
@@ -6761,7 +6767,7 @@ ftrace_count_snapshot(unsigned long ip, unsigned long parent_ip,
6761 (*count)--; 6767 (*count)--;
6762 } 6768 }
6763 6769
6764 tracing_snapshot(); 6770 tracing_snapshot_instance(tr);
6765} 6771}
6766 6772
6767static int 6773static int
@@ -6868,7 +6874,7 @@ ftrace_trace_snapshot_callback(struct trace_array *tr, struct ftrace_hash *hash,
6868 ret = register_ftrace_function_probe(glob, tr, ops, count); 6874 ret = register_ftrace_function_probe(glob, tr, ops, count);
6869 6875
6870 if (ret >= 0) 6876 if (ret >= 0)
6871 alloc_snapshot(&global_trace); 6877 alloc_snapshot(tr);
6872 6878
6873 return ret < 0 ? ret : 0; 6879 return ret < 0 ? ret : 0;
6874} 6880}