diff options
author | Steven Rostedt (Red Hat) <rostedt@goodmis.org> | 2013-12-21 17:39:40 -0500 |
---|---|---|
committer | Steven Rostedt <rostedt@goodmis.org> | 2014-01-02 16:17:12 -0500 |
commit | 098c879e1f2d6ee7afbfe959f6b04070065cec90 (patch) | |
tree | 22a2d64f30c82b70619786bc541ddcbe320f5d44 | |
parent | ac38fb8582d86ba887b5d07c0912dec135bf6931 (diff) |
tracing: Add generic tracing_lseek() function
Trace event triggers added a lseek that uses the ftrace_filter_lseek()
function. Unfortunately, when function tracing is not configured in
that function is not defined and the kernel fails to build.
This is the second time that function was added to a file ops and
it broke the build due to requiring special config dependencies.
Make a generic tracing_lseek() that all the tracing utilities may
use.
Also, modify the old ftrace_filter_lseek() to return 0 instead of
1 on WRONLY. Not sure why it was a 1 as that does not make sense.
This also changes the old tracing_seek() to modify the file pos
pointer on WRONLY as well.
Reported-by: kbuild test robot <fengguang.wu@intel.com>
Tested-by: Tom Zanussi <tom.zanussi@linux.intel.com>
Acked-by: Tom Zanussi <tom.zanussi@linux.intel.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
-rw-r--r-- | include/linux/ftrace.h | 2 | ||||
-rw-r--r-- | kernel/trace/ftrace.c | 25 | ||||
-rw-r--r-- | kernel/trace/trace.c | 14 | ||||
-rw-r--r-- | kernel/trace/trace.h | 2 | ||||
-rw-r--r-- | kernel/trace/trace_events_trigger.c | 2 | ||||
-rw-r--r-- | kernel/trace/trace_stack.c | 2 |
6 files changed, 19 insertions, 28 deletions
diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h index 31ea4b428360..f4233b195dab 100644 --- a/include/linux/ftrace.h +++ b/include/linux/ftrace.h | |||
@@ -570,8 +570,6 @@ static inline int | |||
570 | ftrace_regex_release(struct inode *inode, struct file *file) { return -ENODEV; } | 570 | ftrace_regex_release(struct inode *inode, struct file *file) { return -ENODEV; } |
571 | #endif /* CONFIG_DYNAMIC_FTRACE */ | 571 | #endif /* CONFIG_DYNAMIC_FTRACE */ |
572 | 572 | ||
573 | loff_t ftrace_filter_lseek(struct file *file, loff_t offset, int whence); | ||
574 | |||
575 | /* totally disable ftrace - can not re-enable after this */ | 573 | /* totally disable ftrace - can not re-enable after this */ |
576 | void ftrace_kill(void); | 574 | void ftrace_kill(void); |
577 | 575 | ||
diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c index 0e9f9eaade2f..531ffa6f5a7b 100644 --- a/kernel/trace/ftrace.c +++ b/kernel/trace/ftrace.c | |||
@@ -1082,19 +1082,6 @@ static __init void ftrace_profile_debugfs(struct dentry *d_tracer) | |||
1082 | 1082 | ||
1083 | static struct pid * const ftrace_swapper_pid = &init_struct_pid; | 1083 | static struct pid * const ftrace_swapper_pid = &init_struct_pid; |
1084 | 1084 | ||
1085 | loff_t | ||
1086 | ftrace_filter_lseek(struct file *file, loff_t offset, int whence) | ||
1087 | { | ||
1088 | loff_t ret; | ||
1089 | |||
1090 | if (file->f_mode & FMODE_READ) | ||
1091 | ret = seq_lseek(file, offset, whence); | ||
1092 | else | ||
1093 | file->f_pos = ret = 1; | ||
1094 | |||
1095 | return ret; | ||
1096 | } | ||
1097 | |||
1098 | #ifdef CONFIG_DYNAMIC_FTRACE | 1085 | #ifdef CONFIG_DYNAMIC_FTRACE |
1099 | 1086 | ||
1100 | #ifndef CONFIG_FTRACE_MCOUNT_RECORD | 1087 | #ifndef CONFIG_FTRACE_MCOUNT_RECORD |
@@ -2739,7 +2726,7 @@ static void ftrace_filter_reset(struct ftrace_hash *hash) | |||
2739 | * routine, you can use ftrace_filter_write() for the write | 2726 | * routine, you can use ftrace_filter_write() for the write |
2740 | * routine if @flag has FTRACE_ITER_FILTER set, or | 2727 | * routine if @flag has FTRACE_ITER_FILTER set, or |
2741 | * ftrace_notrace_write() if @flag has FTRACE_ITER_NOTRACE set. | 2728 | * ftrace_notrace_write() if @flag has FTRACE_ITER_NOTRACE set. |
2742 | * ftrace_filter_lseek() should be used as the lseek routine, and | 2729 | * tracing_lseek() should be used as the lseek routine, and |
2743 | * release must call ftrace_regex_release(). | 2730 | * release must call ftrace_regex_release(). |
2744 | */ | 2731 | */ |
2745 | int | 2732 | int |
@@ -3767,7 +3754,7 @@ static const struct file_operations ftrace_filter_fops = { | |||
3767 | .open = ftrace_filter_open, | 3754 | .open = ftrace_filter_open, |
3768 | .read = seq_read, | 3755 | .read = seq_read, |
3769 | .write = ftrace_filter_write, | 3756 | .write = ftrace_filter_write, |
3770 | .llseek = ftrace_filter_lseek, | 3757 | .llseek = tracing_lseek, |
3771 | .release = ftrace_regex_release, | 3758 | .release = ftrace_regex_release, |
3772 | }; | 3759 | }; |
3773 | 3760 | ||
@@ -3775,7 +3762,7 @@ static const struct file_operations ftrace_notrace_fops = { | |||
3775 | .open = ftrace_notrace_open, | 3762 | .open = ftrace_notrace_open, |
3776 | .read = seq_read, | 3763 | .read = seq_read, |
3777 | .write = ftrace_notrace_write, | 3764 | .write = ftrace_notrace_write, |
3778 | .llseek = ftrace_filter_lseek, | 3765 | .llseek = tracing_lseek, |
3779 | .release = ftrace_regex_release, | 3766 | .release = ftrace_regex_release, |
3780 | }; | 3767 | }; |
3781 | 3768 | ||
@@ -4038,7 +4025,7 @@ static const struct file_operations ftrace_graph_fops = { | |||
4038 | .open = ftrace_graph_open, | 4025 | .open = ftrace_graph_open, |
4039 | .read = seq_read, | 4026 | .read = seq_read, |
4040 | .write = ftrace_graph_write, | 4027 | .write = ftrace_graph_write, |
4041 | .llseek = ftrace_filter_lseek, | 4028 | .llseek = tracing_lseek, |
4042 | .release = ftrace_graph_release, | 4029 | .release = ftrace_graph_release, |
4043 | }; | 4030 | }; |
4044 | 4031 | ||
@@ -4046,7 +4033,7 @@ static const struct file_operations ftrace_graph_notrace_fops = { | |||
4046 | .open = ftrace_graph_notrace_open, | 4033 | .open = ftrace_graph_notrace_open, |
4047 | .read = seq_read, | 4034 | .read = seq_read, |
4048 | .write = ftrace_graph_write, | 4035 | .write = ftrace_graph_write, |
4049 | .llseek = ftrace_filter_lseek, | 4036 | .llseek = tracing_lseek, |
4050 | .release = ftrace_graph_release, | 4037 | .release = ftrace_graph_release, |
4051 | }; | 4038 | }; |
4052 | #endif /* CONFIG_FUNCTION_GRAPH_TRACER */ | 4039 | #endif /* CONFIG_FUNCTION_GRAPH_TRACER */ |
@@ -4719,7 +4706,7 @@ static const struct file_operations ftrace_pid_fops = { | |||
4719 | .open = ftrace_pid_open, | 4706 | .open = ftrace_pid_open, |
4720 | .write = ftrace_pid_write, | 4707 | .write = ftrace_pid_write, |
4721 | .read = seq_read, | 4708 | .read = seq_read, |
4722 | .llseek = ftrace_filter_lseek, | 4709 | .llseek = tracing_lseek, |
4723 | .release = ftrace_pid_release, | 4710 | .release = ftrace_pid_release, |
4724 | }; | 4711 | }; |
4725 | 4712 | ||
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c index 59bf5b56ccc0..e32a2f48dde1 100644 --- a/kernel/trace/trace.c +++ b/kernel/trace/trace.c | |||
@@ -3183,19 +3183,23 @@ tracing_write_stub(struct file *filp, const char __user *ubuf, | |||
3183 | return count; | 3183 | return count; |
3184 | } | 3184 | } |
3185 | 3185 | ||
3186 | static loff_t tracing_seek(struct file *file, loff_t offset, int origin) | 3186 | loff_t tracing_lseek(struct file *file, loff_t offset, int whence) |
3187 | { | 3187 | { |
3188 | int ret; | ||
3189 | |||
3188 | if (file->f_mode & FMODE_READ) | 3190 | if (file->f_mode & FMODE_READ) |
3189 | return seq_lseek(file, offset, origin); | 3191 | ret = seq_lseek(file, offset, whence); |
3190 | else | 3192 | else |
3191 | return 0; | 3193 | file->f_pos = ret = 0; |
3194 | |||
3195 | return ret; | ||
3192 | } | 3196 | } |
3193 | 3197 | ||
3194 | static const struct file_operations tracing_fops = { | 3198 | static const struct file_operations tracing_fops = { |
3195 | .open = tracing_open, | 3199 | .open = tracing_open, |
3196 | .read = seq_read, | 3200 | .read = seq_read, |
3197 | .write = tracing_write_stub, | 3201 | .write = tracing_write_stub, |
3198 | .llseek = tracing_seek, | 3202 | .llseek = tracing_lseek, |
3199 | .release = tracing_release, | 3203 | .release = tracing_release, |
3200 | }; | 3204 | }; |
3201 | 3205 | ||
@@ -4940,7 +4944,7 @@ static const struct file_operations snapshot_fops = { | |||
4940 | .open = tracing_snapshot_open, | 4944 | .open = tracing_snapshot_open, |
4941 | .read = seq_read, | 4945 | .read = seq_read, |
4942 | .write = tracing_snapshot_write, | 4946 | .write = tracing_snapshot_write, |
4943 | .llseek = tracing_seek, | 4947 | .llseek = tracing_lseek, |
4944 | .release = tracing_snapshot_release, | 4948 | .release = tracing_snapshot_release, |
4945 | }; | 4949 | }; |
4946 | 4950 | ||
diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h index 433bfc5dd576..0380cab0af9b 100644 --- a/kernel/trace/trace.h +++ b/kernel/trace/trace.h | |||
@@ -588,6 +588,8 @@ void tracing_start_sched_switch_record(void); | |||
588 | int register_tracer(struct tracer *type); | 588 | int register_tracer(struct tracer *type); |
589 | int is_tracing_stopped(void); | 589 | int is_tracing_stopped(void); |
590 | 590 | ||
591 | loff_t tracing_lseek(struct file *file, loff_t offset, int whence); | ||
592 | |||
591 | extern cpumask_var_t __read_mostly tracing_buffer_mask; | 593 | extern cpumask_var_t __read_mostly tracing_buffer_mask; |
592 | 594 | ||
593 | #define for_each_tracing_cpu(cpu) \ | 595 | #define for_each_tracing_cpu(cpu) \ |
diff --git a/kernel/trace/trace_events_trigger.c b/kernel/trace/trace_events_trigger.c index f5b3f780fda4..12ac8a5d4d95 100644 --- a/kernel/trace/trace_events_trigger.c +++ b/kernel/trace/trace_events_trigger.c | |||
@@ -281,7 +281,7 @@ const struct file_operations event_trigger_fops = { | |||
281 | .open = event_trigger_open, | 281 | .open = event_trigger_open, |
282 | .read = seq_read, | 282 | .read = seq_read, |
283 | .write = event_trigger_write, | 283 | .write = event_trigger_write, |
284 | .llseek = ftrace_filter_lseek, | 284 | .llseek = tracing_lseek, |
285 | .release = event_trigger_release, | 285 | .release = event_trigger_release, |
286 | }; | 286 | }; |
287 | 287 | ||
diff --git a/kernel/trace/trace_stack.c b/kernel/trace/trace_stack.c index b20428c5efe2..e6be585cf06a 100644 --- a/kernel/trace/trace_stack.c +++ b/kernel/trace/trace_stack.c | |||
@@ -382,7 +382,7 @@ static const struct file_operations stack_trace_filter_fops = { | |||
382 | .open = stack_trace_filter_open, | 382 | .open = stack_trace_filter_open, |
383 | .read = seq_read, | 383 | .read = seq_read, |
384 | .write = ftrace_filter_write, | 384 | .write = ftrace_filter_write, |
385 | .llseek = ftrace_filter_lseek, | 385 | .llseek = tracing_lseek, |
386 | .release = ftrace_regex_release, | 386 | .release = ftrace_regex_release, |
387 | }; | 387 | }; |
388 | 388 | ||