aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2016-06-20 13:35:48 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2016-06-20 13:35:48 -0400
commitf780f00d723d991353b2a97a8a844ffefbc40505 (patch)
tree7054dad0c63507c257c61be9668d631d4482ae00
parent97f78c7de8ae38c007fec406d40df99ae62b36de (diff)
parent0ded5174e976e2b2a354fe38abf1ebf4492c6dc3 (diff)
Merge tag 'trace-v4.7-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace
Pull tracing fixes from Steven Rostedt: "Two fixes for the tracing system: - When trace_printk() is used with a non constant format descriptor, it adds a NULL pointer into the trace format section, and the code isn't prepared to deal with it. This bug appeared by a change that was added in v3.5. - The ftracetest (selftests section) can't handle testing histograms when histograms are not configured. Currently it shows that they fail the test, when they should state that they are unsupported. This bug was added in the 4.7 merge window with the addition of the historgram code" * tag 'trace-v4.7-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace: ftracetest: Fix hist unsupported result in hist selftests tracing: Handle NULL formats in hold_module_trace_bprintk_format()
-rw-r--r--kernel/trace/trace_printk.c7
-rw-r--r--tools/testing/selftests/ftrace/test.d/trigger/trigger-hist-mod.tc9
-rw-r--r--tools/testing/selftests/ftrace/test.d/trigger/trigger-hist.tc9
-rw-r--r--tools/testing/selftests/ftrace/test.d/trigger/trigger-multihist.tc9
4 files changed, 18 insertions, 16 deletions
diff --git a/kernel/trace/trace_printk.c b/kernel/trace/trace_printk.c
index f96f0383f6c6..ad1d6164e946 100644
--- a/kernel/trace/trace_printk.c
+++ b/kernel/trace/trace_printk.c
@@ -36,6 +36,10 @@ struct trace_bprintk_fmt {
36static inline struct trace_bprintk_fmt *lookup_format(const char *fmt) 36static inline struct trace_bprintk_fmt *lookup_format(const char *fmt)
37{ 37{
38 struct trace_bprintk_fmt *pos; 38 struct trace_bprintk_fmt *pos;
39
40 if (!fmt)
41 return ERR_PTR(-EINVAL);
42
39 list_for_each_entry(pos, &trace_bprintk_fmt_list, list) { 43 list_for_each_entry(pos, &trace_bprintk_fmt_list, list) {
40 if (!strcmp(pos->fmt, fmt)) 44 if (!strcmp(pos->fmt, fmt))
41 return pos; 45 return pos;
@@ -57,7 +61,8 @@ void hold_module_trace_bprintk_format(const char **start, const char **end)
57 for (iter = start; iter < end; iter++) { 61 for (iter = start; iter < end; iter++) {
58 struct trace_bprintk_fmt *tb_fmt = lookup_format(*iter); 62 struct trace_bprintk_fmt *tb_fmt = lookup_format(*iter);
59 if (tb_fmt) { 63 if (tb_fmt) {
60 *iter = tb_fmt->fmt; 64 if (!IS_ERR(tb_fmt))
65 *iter = tb_fmt->fmt;
61 continue; 66 continue;
62 } 67 }
63 68
diff --git a/tools/testing/selftests/ftrace/test.d/trigger/trigger-hist-mod.tc b/tools/testing/selftests/ftrace/test.d/trigger/trigger-hist-mod.tc
index c2b61c4fda11..0bf5085281f3 100644
--- a/tools/testing/selftests/ftrace/test.d/trigger/trigger-hist-mod.tc
+++ b/tools/testing/selftests/ftrace/test.d/trigger/trigger-hist-mod.tc
@@ -23,15 +23,14 @@ if [ ! -f events/sched/sched_process_fork/trigger ]; then
23 exit_unsupported 23 exit_unsupported
24fi 24fi
25 25
26reset_tracer 26if [ ! -f events/sched/sched_process_fork/hist ]; then
27do_reset
28
29FEATURE=`grep hist events/sched/sched_process_fork/trigger`
30if [ -z "$FEATURE" ]; then
31 echo "hist trigger is not supported" 27 echo "hist trigger is not supported"
32 exit_unsupported 28 exit_unsupported
33fi 29fi
34 30
31reset_tracer
32do_reset
33
35echo "Test histogram with execname modifier" 34echo "Test histogram with execname modifier"
36 35
37echo 'hist:keys=common_pid.execname' > events/sched/sched_process_fork/trigger 36echo 'hist:keys=common_pid.execname' > events/sched/sched_process_fork/trigger
diff --git a/tools/testing/selftests/ftrace/test.d/trigger/trigger-hist.tc b/tools/testing/selftests/ftrace/test.d/trigger/trigger-hist.tc
index b2902d42a537..a00184cd9c95 100644
--- a/tools/testing/selftests/ftrace/test.d/trigger/trigger-hist.tc
+++ b/tools/testing/selftests/ftrace/test.d/trigger/trigger-hist.tc
@@ -23,15 +23,14 @@ if [ ! -f events/sched/sched_process_fork/trigger ]; then
23 exit_unsupported 23 exit_unsupported
24fi 24fi
25 25
26reset_tracer 26if [ ! -f events/sched/sched_process_fork/hist ]; then
27do_reset
28
29FEATURE=`grep hist events/sched/sched_process_fork/trigger`
30if [ -z "$FEATURE" ]; then
31 echo "hist trigger is not supported" 27 echo "hist trigger is not supported"
32 exit_unsupported 28 exit_unsupported
33fi 29fi
34 30
31reset_tracer
32do_reset
33
35echo "Test histogram basic tigger" 34echo "Test histogram basic tigger"
36 35
37echo 'hist:keys=parent_pid:vals=child_pid' > events/sched/sched_process_fork/trigger 36echo 'hist:keys=parent_pid:vals=child_pid' > events/sched/sched_process_fork/trigger
diff --git a/tools/testing/selftests/ftrace/test.d/trigger/trigger-multihist.tc b/tools/testing/selftests/ftrace/test.d/trigger/trigger-multihist.tc
index 03c4a46561fc..3478b00ead57 100644
--- a/tools/testing/selftests/ftrace/test.d/trigger/trigger-multihist.tc
+++ b/tools/testing/selftests/ftrace/test.d/trigger/trigger-multihist.tc
@@ -23,15 +23,14 @@ if [ ! -f events/sched/sched_process_fork/trigger ]; then
23 exit_unsupported 23 exit_unsupported
24fi 24fi
25 25
26reset_tracer 26if [ ! -f events/sched/sched_process_fork/hist ]; then
27do_reset
28
29FEATURE=`grep hist events/sched/sched_process_fork/trigger`
30if [ -z "$FEATURE" ]; then
31 echo "hist trigger is not supported" 27 echo "hist trigger is not supported"
32 exit_unsupported 28 exit_unsupported
33fi 29fi
34 30
31reset_tracer
32do_reset
33
35reset_trigger 34reset_trigger
36 35
37echo "Test histogram multiple tiggers" 36echo "Test histogram multiple tiggers"