diff options
| author | 2014-11-19 21:32:12 +1100 | |
|---|---|---|
| committer | 2014-11-19 21:32:12 +1100 | |
| commit | b10778a00d40b3d9fdaaf5891e802794781ff71c (patch) | |
| tree | 6ba4cbac86eecedc3f30650e7f764ecf00c83898 /kernel/trace/trace.c | |
| parent | integrity: do zero padding of the key id (diff) | |
| parent | Linux 3.17 (diff) | |
| download | wireguard-linux-b10778a00d40b3d9fdaaf5891e802794781ff71c.tar.xz wireguard-linux-b10778a00d40b3d9fdaaf5891e802794781ff71c.zip  | |
Merge commit 'v3.17' into next
Diffstat (limited to 'kernel/trace/trace.c')
| -rw-r--r-- | kernel/trace/trace.c | 107 | 
1 files changed, 67 insertions, 40 deletions
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c index 291397e66669..8a528392b1f4 100644 --- a/kernel/trace/trace.c +++ b/kernel/trace/trace.c @@ -820,11 +820,12 @@ static struct {  	const char *name;  	int in_ns;		/* is this clock in nanoseconds? */  } trace_clocks[] = { -	{ trace_clock_local,	"local",	1 }, -	{ trace_clock_global,	"global",	1 }, -	{ trace_clock_counter,	"counter",	0 }, -	{ trace_clock_jiffies,	"uptime",	0 }, -	{ trace_clock,		"perf",		1 }, +	{ trace_clock_local,		"local",	1 }, +	{ trace_clock_global,		"global",	1 }, +	{ trace_clock_counter,		"counter",	0 }, +	{ trace_clock_jiffies,		"uptime",	0 }, +	{ trace_clock,			"perf",		1 }, +	{ ktime_get_mono_fast_ns,	"mono",		1 },  	ARCH_TRACE_CLOCKS  }; @@ -937,30 +938,6 @@ out:  	return ret;  } -ssize_t trace_seq_to_user(struct trace_seq *s, char __user *ubuf, size_t cnt) -{ -	int len; -	int ret; - -	if (!cnt) -		return 0; - -	if (s->len <= s->readpos) -		return -EBUSY; - -	len = s->len - s->readpos; -	if (cnt > len) -		cnt = len; -	ret = copy_to_user(ubuf, s->buffer + s->readpos, cnt); -	if (ret == cnt) -		return -EFAULT; - -	cnt -= ret; - -	s->readpos += cnt; -	return cnt; -} -  static ssize_t trace_seq_to_buffer(struct trace_seq *s, void *buf, size_t cnt)  {  	int len; @@ -3699,6 +3676,7 @@ static const char readme_msg[] =  #endif  #ifdef CONFIG_FUNCTION_GRAPH_TRACER  	"  set_graph_function\t- Trace the nested calls of a function (function_graph)\n" +	"  set_graph_notrace\t- Do not trace the nested calls of a function (function_graph)\n"  	"  max_graph_depth\t- Trace a limited depth of nested calls (0 is unlimited)\n"  #endif  #ifdef CONFIG_TRACER_SNAPSHOT @@ -4238,10 +4216,9 @@ tracing_set_trace_write(struct file *filp, const char __user *ubuf,  }  static ssize_t -tracing_max_lat_read(struct file *filp, char __user *ubuf, -		     size_t cnt, loff_t *ppos) +tracing_nsecs_read(unsigned long *ptr, char __user *ubuf, +		   size_t cnt, loff_t *ppos)  { -	unsigned long *ptr = filp->private_data;  	char buf[64];  	int r; @@ -4253,10 +4230,9 @@ tracing_max_lat_read(struct file *filp, char __user *ubuf,  }  static ssize_t -tracing_max_lat_write(struct file *filp, const char __user *ubuf, -		      size_t cnt, loff_t *ppos) +tracing_nsecs_write(unsigned long *ptr, const char __user *ubuf, +		    size_t cnt, loff_t *ppos)  { -	unsigned long *ptr = filp->private_data;  	unsigned long val;  	int ret; @@ -4269,6 +4245,52 @@ tracing_max_lat_write(struct file *filp, const char __user *ubuf,  	return cnt;  } +static ssize_t +tracing_thresh_read(struct file *filp, char __user *ubuf, +		    size_t cnt, loff_t *ppos) +{ +	return tracing_nsecs_read(&tracing_thresh, ubuf, cnt, ppos); +} + +static ssize_t +tracing_thresh_write(struct file *filp, const char __user *ubuf, +		     size_t cnt, loff_t *ppos) +{ +	struct trace_array *tr = filp->private_data; +	int ret; + +	mutex_lock(&trace_types_lock); +	ret = tracing_nsecs_write(&tracing_thresh, ubuf, cnt, ppos); +	if (ret < 0) +		goto out; + +	if (tr->current_trace->update_thresh) { +		ret = tr->current_trace->update_thresh(tr); +		if (ret < 0) +			goto out; +	} + +	ret = cnt; +out: +	mutex_unlock(&trace_types_lock); + +	return ret; +} + +static ssize_t +tracing_max_lat_read(struct file *filp, char __user *ubuf, +		     size_t cnt, loff_t *ppos) +{ +	return tracing_nsecs_read(filp->private_data, ubuf, cnt, ppos); +} + +static ssize_t +tracing_max_lat_write(struct file *filp, const char __user *ubuf, +		      size_t cnt, loff_t *ppos) +{ +	return tracing_nsecs_write(filp->private_data, ubuf, cnt, ppos); +} +  static int tracing_open_pipe(struct inode *inode, struct file *filp)  {  	struct trace_array *tr = inode->i_private; @@ -5170,6 +5192,13 @@ static int snapshot_raw_open(struct inode *inode, struct file *filp)  #endif /* CONFIG_TRACER_SNAPSHOT */ +static const struct file_operations tracing_thresh_fops = { +	.open		= tracing_open_generic, +	.read		= tracing_thresh_read, +	.write		= tracing_thresh_write, +	.llseek		= generic_file_llseek, +}; +  static const struct file_operations tracing_max_lat_fops = {  	.open		= tracing_open_generic,  	.read		= tracing_max_lat_read, @@ -6107,10 +6136,8 @@ destroy_trace_option_files(struct trace_option_dentry *topts)  	if (!topts)  		return; -	for (cnt = 0; topts[cnt].opt; cnt++) { -		if (topts[cnt].entry) -			debugfs_remove(topts[cnt].entry); -	} +	for (cnt = 0; topts[cnt].opt; cnt++) +		debugfs_remove(topts[cnt].entry);  	kfree(topts);  } @@ -6533,7 +6560,7 @@ static __init int tracer_init_debugfs(void)  	init_tracer_debugfs(&global_trace, d_tracer);  	trace_create_file("tracing_thresh", 0644, d_tracer, -			&tracing_thresh, &tracing_max_lat_fops); +			&global_trace, &tracing_thresh_fops);  	trace_create_file("README", 0444, d_tracer,  			NULL, &tracing_readme_fops);  | 
