diff options
Diffstat (limited to 'kernel/trace/trace.c')
-rw-r--r-- | kernel/trace/trace.c | 98 |
1 files changed, 62 insertions, 36 deletions
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c index bda9621638cc..8bb80fe08767 100644 --- a/kernel/trace/trace.c +++ b/kernel/trace/trace.c | |||
@@ -823,7 +823,7 @@ static struct { | |||
823 | { trace_clock_local, "local", 1 }, | 823 | { trace_clock_local, "local", 1 }, |
824 | { trace_clock_global, "global", 1 }, | 824 | { trace_clock_global, "global", 1 }, |
825 | { trace_clock_counter, "counter", 0 }, | 825 | { trace_clock_counter, "counter", 0 }, |
826 | { trace_clock_jiffies, "uptime", 1 }, | 826 | { trace_clock_jiffies, "uptime", 0 }, |
827 | { trace_clock, "perf", 1 }, | 827 | { trace_clock, "perf", 1 }, |
828 | ARCH_TRACE_CLOCKS | 828 | ARCH_TRACE_CLOCKS |
829 | }; | 829 | }; |
@@ -937,30 +937,6 @@ out: | |||
937 | return ret; | 937 | return ret; |
938 | } | 938 | } |
939 | 939 | ||
940 | ssize_t trace_seq_to_user(struct trace_seq *s, char __user *ubuf, size_t cnt) | ||
941 | { | ||
942 | int len; | ||
943 | int ret; | ||
944 | |||
945 | if (!cnt) | ||
946 | return 0; | ||
947 | |||
948 | if (s->len <= s->readpos) | ||
949 | return -EBUSY; | ||
950 | |||
951 | len = s->len - s->readpos; | ||
952 | if (cnt > len) | ||
953 | cnt = len; | ||
954 | ret = copy_to_user(ubuf, s->buffer + s->readpos, cnt); | ||
955 | if (ret == cnt) | ||
956 | return -EFAULT; | ||
957 | |||
958 | cnt -= ret; | ||
959 | |||
960 | s->readpos += cnt; | ||
961 | return cnt; | ||
962 | } | ||
963 | |||
964 | static ssize_t trace_seq_to_buffer(struct trace_seq *s, void *buf, size_t cnt) | 940 | static ssize_t trace_seq_to_buffer(struct trace_seq *s, void *buf, size_t cnt) |
965 | { | 941 | { |
966 | int len; | 942 | int len; |
@@ -3699,6 +3675,7 @@ static const char readme_msg[] = | |||
3699 | #endif | 3675 | #endif |
3700 | #ifdef CONFIG_FUNCTION_GRAPH_TRACER | 3676 | #ifdef CONFIG_FUNCTION_GRAPH_TRACER |
3701 | " set_graph_function\t- Trace the nested calls of a function (function_graph)\n" | 3677 | " set_graph_function\t- Trace the nested calls of a function (function_graph)\n" |
3678 | " set_graph_notrace\t- Do not trace the nested calls of a function (function_graph)\n" | ||
3702 | " max_graph_depth\t- Trace a limited depth of nested calls (0 is unlimited)\n" | 3679 | " max_graph_depth\t- Trace a limited depth of nested calls (0 is unlimited)\n" |
3703 | #endif | 3680 | #endif |
3704 | #ifdef CONFIG_TRACER_SNAPSHOT | 3681 | #ifdef CONFIG_TRACER_SNAPSHOT |
@@ -4238,10 +4215,9 @@ tracing_set_trace_write(struct file *filp, const char __user *ubuf, | |||
4238 | } | 4215 | } |
4239 | 4216 | ||
4240 | static ssize_t | 4217 | static ssize_t |
4241 | tracing_max_lat_read(struct file *filp, char __user *ubuf, | 4218 | tracing_nsecs_read(unsigned long *ptr, char __user *ubuf, |
4242 | size_t cnt, loff_t *ppos) | 4219 | size_t cnt, loff_t *ppos) |
4243 | { | 4220 | { |
4244 | unsigned long *ptr = filp->private_data; | ||
4245 | char buf[64]; | 4221 | char buf[64]; |
4246 | int r; | 4222 | int r; |
4247 | 4223 | ||
@@ -4253,10 +4229,9 @@ tracing_max_lat_read(struct file *filp, char __user *ubuf, | |||
4253 | } | 4229 | } |
4254 | 4230 | ||
4255 | static ssize_t | 4231 | static ssize_t |
4256 | tracing_max_lat_write(struct file *filp, const char __user *ubuf, | 4232 | tracing_nsecs_write(unsigned long *ptr, const char __user *ubuf, |
4257 | size_t cnt, loff_t *ppos) | 4233 | size_t cnt, loff_t *ppos) |
4258 | { | 4234 | { |
4259 | unsigned long *ptr = filp->private_data; | ||
4260 | unsigned long val; | 4235 | unsigned long val; |
4261 | int ret; | 4236 | int ret; |
4262 | 4237 | ||
@@ -4269,6 +4244,52 @@ tracing_max_lat_write(struct file *filp, const char __user *ubuf, | |||
4269 | return cnt; | 4244 | return cnt; |
4270 | } | 4245 | } |
4271 | 4246 | ||
4247 | static ssize_t | ||
4248 | tracing_thresh_read(struct file *filp, char __user *ubuf, | ||
4249 | size_t cnt, loff_t *ppos) | ||
4250 | { | ||
4251 | return tracing_nsecs_read(&tracing_thresh, ubuf, cnt, ppos); | ||
4252 | } | ||
4253 | |||
4254 | static ssize_t | ||
4255 | tracing_thresh_write(struct file *filp, const char __user *ubuf, | ||
4256 | size_t cnt, loff_t *ppos) | ||
4257 | { | ||
4258 | struct trace_array *tr = filp->private_data; | ||
4259 | int ret; | ||
4260 | |||
4261 | mutex_lock(&trace_types_lock); | ||
4262 | ret = tracing_nsecs_write(&tracing_thresh, ubuf, cnt, ppos); | ||
4263 | if (ret < 0) | ||
4264 | goto out; | ||
4265 | |||
4266 | if (tr->current_trace->update_thresh) { | ||
4267 | ret = tr->current_trace->update_thresh(tr); | ||
4268 | if (ret < 0) | ||
4269 | goto out; | ||
4270 | } | ||
4271 | |||
4272 | ret = cnt; | ||
4273 | out: | ||
4274 | mutex_unlock(&trace_types_lock); | ||
4275 | |||
4276 | return ret; | ||
4277 | } | ||
4278 | |||
4279 | static ssize_t | ||
4280 | tracing_max_lat_read(struct file *filp, char __user *ubuf, | ||
4281 | size_t cnt, loff_t *ppos) | ||
4282 | { | ||
4283 | return tracing_nsecs_read(filp->private_data, ubuf, cnt, ppos); | ||
4284 | } | ||
4285 | |||
4286 | static ssize_t | ||
4287 | tracing_max_lat_write(struct file *filp, const char __user *ubuf, | ||
4288 | size_t cnt, loff_t *ppos) | ||
4289 | { | ||
4290 | return tracing_nsecs_write(filp->private_data, ubuf, cnt, ppos); | ||
4291 | } | ||
4292 | |||
4272 | static int tracing_open_pipe(struct inode *inode, struct file *filp) | 4293 | static int tracing_open_pipe(struct inode *inode, struct file *filp) |
4273 | { | 4294 | { |
4274 | struct trace_array *tr = inode->i_private; | 4295 | struct trace_array *tr = inode->i_private; |
@@ -5170,6 +5191,13 @@ static int snapshot_raw_open(struct inode *inode, struct file *filp) | |||
5170 | #endif /* CONFIG_TRACER_SNAPSHOT */ | 5191 | #endif /* CONFIG_TRACER_SNAPSHOT */ |
5171 | 5192 | ||
5172 | 5193 | ||
5194 | static const struct file_operations tracing_thresh_fops = { | ||
5195 | .open = tracing_open_generic, | ||
5196 | .read = tracing_thresh_read, | ||
5197 | .write = tracing_thresh_write, | ||
5198 | .llseek = generic_file_llseek, | ||
5199 | }; | ||
5200 | |||
5173 | static const struct file_operations tracing_max_lat_fops = { | 5201 | static const struct file_operations tracing_max_lat_fops = { |
5174 | .open = tracing_open_generic, | 5202 | .open = tracing_open_generic, |
5175 | .read = tracing_max_lat_read, | 5203 | .read = tracing_max_lat_read, |
@@ -6107,10 +6135,8 @@ destroy_trace_option_files(struct trace_option_dentry *topts) | |||
6107 | if (!topts) | 6135 | if (!topts) |
6108 | return; | 6136 | return; |
6109 | 6137 | ||
6110 | for (cnt = 0; topts[cnt].opt; cnt++) { | 6138 | for (cnt = 0; topts[cnt].opt; cnt++) |
6111 | if (topts[cnt].entry) | 6139 | debugfs_remove(topts[cnt].entry); |
6112 | debugfs_remove(topts[cnt].entry); | ||
6113 | } | ||
6114 | 6140 | ||
6115 | kfree(topts); | 6141 | kfree(topts); |
6116 | } | 6142 | } |
@@ -6533,7 +6559,7 @@ static __init int tracer_init_debugfs(void) | |||
6533 | init_tracer_debugfs(&global_trace, d_tracer); | 6559 | init_tracer_debugfs(&global_trace, d_tracer); |
6534 | 6560 | ||
6535 | trace_create_file("tracing_thresh", 0644, d_tracer, | 6561 | trace_create_file("tracing_thresh", 0644, d_tracer, |
6536 | &tracing_thresh, &tracing_max_lat_fops); | 6562 | &global_trace, &tracing_thresh_fops); |
6537 | 6563 | ||
6538 | trace_create_file("README", 0444, d_tracer, | 6564 | trace_create_file("README", 0444, d_tracer, |
6539 | NULL, &tracing_readme_fops); | 6565 | NULL, &tracing_readme_fops); |