diff options
| author | Steven Rostedt (Red Hat) <rostedt@goodmis.org> | 2014-01-10 11:13:54 -0500 |
|---|---|---|
| committer | Steven Rostedt <rostedt@goodmis.org> | 2014-02-20 12:13:07 -0500 |
| commit | 8c1a49aedb73fb2f15aaa32ad9e2e1c4289f45cb (patch) | |
| tree | 1ae4773af23122b0e7b2d37a2c5818e2985bcf16 /kernel | |
| parent | 6d0abeca3242a88cab8232e4acd7e2bf088f3bc2 (diff) | |
tracing: Pass trace_array to set_flag callback
As options (flags) may affect instances instead of being global
the set_flag() callbacks need to receive the trace_array descriptor
of the instance they will be modifying.
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Diffstat (limited to 'kernel')
| -rw-r--r-- | kernel/trace/blktrace.c | 3 | ||||
| -rw-r--r-- | kernel/trace/trace.c | 18 | ||||
| -rw-r--r-- | kernel/trace/trace.h | 3 | ||||
| -rw-r--r-- | kernel/trace/trace_functions.c | 3 | ||||
| -rw-r--r-- | kernel/trace/trace_functions_graph.c | 3 | ||||
| -rw-r--r-- | kernel/trace/trace_irqsoff.c | 6 | ||||
| -rw-r--r-- | kernel/trace/trace_nop.c | 2 | ||||
| -rw-r--r-- | kernel/trace/trace_sched_wakeup.c | 6 |
8 files changed, 27 insertions, 17 deletions
diff --git a/kernel/trace/blktrace.c b/kernel/trace/blktrace.c index b418cb0d7242..0d758ca61933 100644 --- a/kernel/trace/blktrace.c +++ b/kernel/trace/blktrace.c | |||
| @@ -1427,7 +1427,8 @@ static enum print_line_t blk_tracer_print_line(struct trace_iterator *iter) | |||
| 1427 | return print_one_line(iter, true); | 1427 | return print_one_line(iter, true); |
| 1428 | } | 1428 | } |
| 1429 | 1429 | ||
| 1430 | static int blk_tracer_set_flag(u32 old_flags, u32 bit, int set) | 1430 | static int |
| 1431 | blk_tracer_set_flag(struct trace_array *tr, u32 old_flags, u32 bit, int set) | ||
| 1431 | { | 1432 | { |
| 1432 | /* don't output context-info for blk_classic output */ | 1433 | /* don't output context-info for blk_classic output */ |
| 1433 | if (bit == TRACE_BLK_OPT_CLASSIC) { | 1434 | if (bit == TRACE_BLK_OPT_CLASSIC) { |
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c index 815c878f409b..d7dfc7efc4bf 100644 --- a/kernel/trace/trace.c +++ b/kernel/trace/trace.c | |||
| @@ -73,7 +73,8 @@ static struct tracer_flags dummy_tracer_flags = { | |||
| 73 | .opts = dummy_tracer_opt | 73 | .opts = dummy_tracer_opt |
| 74 | }; | 74 | }; |
| 75 | 75 | ||
| 76 | static int dummy_set_flag(u32 old_flags, u32 bit, int set) | 76 | static int |
| 77 | dummy_set_flag(struct trace_array *tr, u32 old_flags, u32 bit, int set) | ||
| 77 | { | 78 | { |
| 78 | return 0; | 79 | return 0; |
| 79 | } | 80 | } |
| @@ -3339,13 +3340,14 @@ static int tracing_trace_options_show(struct seq_file *m, void *v) | |||
| 3339 | return 0; | 3340 | return 0; |
| 3340 | } | 3341 | } |
| 3341 | 3342 | ||
| 3342 | static int __set_tracer_option(struct tracer *trace, | 3343 | static int __set_tracer_option(struct trace_array *tr, |
| 3343 | struct tracer_flags *tracer_flags, | 3344 | struct tracer_flags *tracer_flags, |
| 3344 | struct tracer_opt *opts, int neg) | 3345 | struct tracer_opt *opts, int neg) |
| 3345 | { | 3346 | { |
| 3347 | struct tracer *trace = tr->current_trace; | ||
| 3346 | int ret; | 3348 | int ret; |
| 3347 | 3349 | ||
| 3348 | ret = trace->set_flag(tracer_flags->val, opts->bit, !neg); | 3350 | ret = trace->set_flag(tr, tracer_flags->val, opts->bit, !neg); |
| 3349 | if (ret) | 3351 | if (ret) |
| 3350 | return ret; | 3352 | return ret; |
| 3351 | 3353 | ||
| @@ -3357,8 +3359,9 @@ static int __set_tracer_option(struct tracer *trace, | |||
| 3357 | } | 3359 | } |
| 3358 | 3360 | ||
| 3359 | /* Try to assign a tracer specific option */ | 3361 | /* Try to assign a tracer specific option */ |
| 3360 | static int set_tracer_option(struct tracer *trace, char *cmp, int neg) | 3362 | static int set_tracer_option(struct trace_array *tr, char *cmp, int neg) |
| 3361 | { | 3363 | { |
| 3364 | struct tracer *trace = tr->current_trace; | ||
| 3362 | struct tracer_flags *tracer_flags = trace->flags; | 3365 | struct tracer_flags *tracer_flags = trace->flags; |
| 3363 | struct tracer_opt *opts = NULL; | 3366 | struct tracer_opt *opts = NULL; |
| 3364 | int i; | 3367 | int i; |
| @@ -3367,8 +3370,7 @@ static int set_tracer_option(struct tracer *trace, char *cmp, int neg) | |||
| 3367 | opts = &tracer_flags->opts[i]; | 3370 | opts = &tracer_flags->opts[i]; |
| 3368 | 3371 | ||
| 3369 | if (strcmp(cmp, opts->name) == 0) | 3372 | if (strcmp(cmp, opts->name) == 0) |
| 3370 | return __set_tracer_option(trace, trace->flags, | 3373 | return __set_tracer_option(tr, trace->flags, opts, neg); |
| 3371 | opts, neg); | ||
| 3372 | } | 3374 | } |
| 3373 | 3375 | ||
| 3374 | return -EINVAL; | 3376 | return -EINVAL; |
| @@ -3440,7 +3442,7 @@ static int trace_set_options(struct trace_array *tr, char *option) | |||
| 3440 | 3442 | ||
| 3441 | /* If no option could be set, test the specific tracer options */ | 3443 | /* If no option could be set, test the specific tracer options */ |
| 3442 | if (!trace_options[i]) | 3444 | if (!trace_options[i]) |
| 3443 | ret = set_tracer_option(tr->current_trace, cmp, neg); | 3445 | ret = set_tracer_option(tr, cmp, neg); |
| 3444 | 3446 | ||
| 3445 | mutex_unlock(&trace_types_lock); | 3447 | mutex_unlock(&trace_types_lock); |
| 3446 | 3448 | ||
| @@ -5689,7 +5691,7 @@ trace_options_write(struct file *filp, const char __user *ubuf, size_t cnt, | |||
| 5689 | 5691 | ||
| 5690 | if (!!(topt->flags->val & topt->opt->bit) != val) { | 5692 | if (!!(topt->flags->val & topt->opt->bit) != val) { |
| 5691 | mutex_lock(&trace_types_lock); | 5693 | mutex_lock(&trace_types_lock); |
| 5692 | ret = __set_tracer_option(topt->tr->current_trace, topt->flags, | 5694 | ret = __set_tracer_option(topt->tr, topt->flags, |
| 5693 | topt->opt, !val); | 5695 | topt->opt, !val); |
| 5694 | mutex_unlock(&trace_types_lock); | 5696 | mutex_unlock(&trace_types_lock); |
| 5695 | if (ret) | 5697 | if (ret) |
diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h index 02b592f2d4b7..649a23d421c1 100644 --- a/kernel/trace/trace.h +++ b/kernel/trace/trace.h | |||
| @@ -355,7 +355,8 @@ struct tracer { | |||
| 355 | void (*print_header)(struct seq_file *m); | 355 | void (*print_header)(struct seq_file *m); |
| 356 | enum print_line_t (*print_line)(struct trace_iterator *iter); | 356 | enum print_line_t (*print_line)(struct trace_iterator *iter); |
| 357 | /* If you handled the flag setting, return 0 */ | 357 | /* If you handled the flag setting, return 0 */ |
| 358 | int (*set_flag)(u32 old_flags, u32 bit, int set); | 358 | int (*set_flag)(struct trace_array *tr, |
| 359 | u32 old_flags, u32 bit, int set); | ||
| 359 | /* Return 0 if OK with change, else return non-zero */ | 360 | /* Return 0 if OK with change, else return non-zero */ |
| 360 | int (*flag_changed)(struct tracer *tracer, | 361 | int (*flag_changed)(struct tracer *tracer, |
| 361 | u32 mask, int set); | 362 | u32 mask, int set); |
diff --git a/kernel/trace/trace_functions.c b/kernel/trace/trace_functions.c index 38fe1483c508..85e517e84f50 100644 --- a/kernel/trace/trace_functions.c +++ b/kernel/trace/trace_functions.c | |||
| @@ -175,7 +175,8 @@ static void tracing_stop_function_trace(void) | |||
| 175 | unregister_ftrace_function(&trace_ops); | 175 | unregister_ftrace_function(&trace_ops); |
| 176 | } | 176 | } |
| 177 | 177 | ||
| 178 | static int func_set_flag(u32 old_flags, u32 bit, int set) | 178 | static int |
| 179 | func_set_flag(struct trace_array *tr, u32 old_flags, u32 bit, int set) | ||
| 179 | { | 180 | { |
| 180 | switch (bit) { | 181 | switch (bit) { |
| 181 | case TRACE_FUNC_OPT_STACK: | 182 | case TRACE_FUNC_OPT_STACK: |
diff --git a/kernel/trace/trace_functions_graph.c b/kernel/trace/trace_functions_graph.c index 0b99120d395c..deff11200261 100644 --- a/kernel/trace/trace_functions_graph.c +++ b/kernel/trace/trace_functions_graph.c | |||
| @@ -1476,7 +1476,8 @@ void graph_trace_close(struct trace_iterator *iter) | |||
| 1476 | } | 1476 | } |
| 1477 | } | 1477 | } |
| 1478 | 1478 | ||
| 1479 | static int func_graph_set_flag(u32 old_flags, u32 bit, int set) | 1479 | static int |
| 1480 | func_graph_set_flag(struct trace_array *tr, u32 old_flags, u32 bit, int set) | ||
| 1480 | { | 1481 | { |
| 1481 | if (bit == TRACE_GRAPH_PRINT_IRQS) | 1482 | if (bit == TRACE_GRAPH_PRINT_IRQS) |
| 1482 | ftrace_graph_skip_irqs = !set; | 1483 | ftrace_graph_skip_irqs = !set; |
diff --git a/kernel/trace/trace_irqsoff.c b/kernel/trace/trace_irqsoff.c index 2aefbee93a6d..fd99b0c183ac 100644 --- a/kernel/trace/trace_irqsoff.c +++ b/kernel/trace/trace_irqsoff.c | |||
| @@ -160,7 +160,8 @@ static struct ftrace_ops trace_ops __read_mostly = | |||
| 160 | #endif /* CONFIG_FUNCTION_TRACER */ | 160 | #endif /* CONFIG_FUNCTION_TRACER */ |
| 161 | 161 | ||
| 162 | #ifdef CONFIG_FUNCTION_GRAPH_TRACER | 162 | #ifdef CONFIG_FUNCTION_GRAPH_TRACER |
| 163 | static int irqsoff_set_flag(u32 old_flags, u32 bit, int set) | 163 | static int |
| 164 | irqsoff_set_flag(struct trace_array *tr, u32 old_flags, u32 bit, int set) | ||
| 164 | { | 165 | { |
| 165 | int cpu; | 166 | int cpu; |
| 166 | 167 | ||
| @@ -266,7 +267,8 @@ __trace_function(struct trace_array *tr, | |||
| 266 | #else | 267 | #else |
| 267 | #define __trace_function trace_function | 268 | #define __trace_function trace_function |
| 268 | 269 | ||
| 269 | static int irqsoff_set_flag(u32 old_flags, u32 bit, int set) | 270 | static int |
| 271 | irqsoff_set_flag(struct trace_array *tr, u32 old_flags, u32 bit, int set) | ||
| 270 | { | 272 | { |
| 271 | return -EINVAL; | 273 | return -EINVAL; |
| 272 | } | 274 | } |
diff --git a/kernel/trace/trace_nop.c b/kernel/trace/trace_nop.c index 394f94417e2f..f3984098c0d7 100644 --- a/kernel/trace/trace_nop.c +++ b/kernel/trace/trace_nop.c | |||
| @@ -62,7 +62,7 @@ static void nop_trace_reset(struct trace_array *tr) | |||
| 62 | * If you don't implement it, then the flag setting will be | 62 | * If you don't implement it, then the flag setting will be |
| 63 | * automatically accepted. | 63 | * automatically accepted. |
| 64 | */ | 64 | */ |
| 65 | static int nop_set_flag(u32 old_flags, u32 bit, int set) | 65 | static int nop_set_flag(struct trace_array *tr, u32 old_flags, u32 bit, int set) |
| 66 | { | 66 | { |
| 67 | /* | 67 | /* |
| 68 | * Note that you don't need to update nop_flags.val yourself. | 68 | * Note that you don't need to update nop_flags.val yourself. |
diff --git a/kernel/trace/trace_sched_wakeup.c b/kernel/trace/trace_sched_wakeup.c index 6e32635e5e57..f0bbdc261028 100644 --- a/kernel/trace/trace_sched_wakeup.c +++ b/kernel/trace/trace_sched_wakeup.c | |||
| @@ -209,7 +209,8 @@ static void stop_func_tracer(int graph) | |||
| 209 | } | 209 | } |
| 210 | 210 | ||
| 211 | #ifdef CONFIG_FUNCTION_GRAPH_TRACER | 211 | #ifdef CONFIG_FUNCTION_GRAPH_TRACER |
| 212 | static int wakeup_set_flag(u32 old_flags, u32 bit, int set) | 212 | static int |
| 213 | wakeup_set_flag(struct trace_array *tr, u32 old_flags, u32 bit, int set) | ||
| 213 | { | 214 | { |
| 214 | 215 | ||
| 215 | if (!(bit & TRACE_DISPLAY_GRAPH)) | 216 | if (!(bit & TRACE_DISPLAY_GRAPH)) |
| @@ -311,7 +312,8 @@ __trace_function(struct trace_array *tr, | |||
| 311 | #else | 312 | #else |
| 312 | #define __trace_function trace_function | 313 | #define __trace_function trace_function |
| 313 | 314 | ||
| 314 | static int wakeup_set_flag(u32 old_flags, u32 bit, int set) | 315 | static int |
| 316 | wakeup_set_flag(struct trace_array *tr, u32 old_flags, u32 bit, int set) | ||
| 315 | { | 317 | { |
| 316 | return -EINVAL; | 318 | return -EINVAL; |
| 317 | } | 319 | } |
