Re: [RFC][PATCH 06/18 v2] ftrace: Add rcu_unsafe_filter_functionsfile

From: Paul E. McKenney
Date: Sat Aug 31 2013 - 15:46:57 EST


On Sat, Aug 31, 2013 at 01:11:23AM -0400, Steven Rostedt wrote:
> From: "Steven Rostedt (Red Hat)" <rostedt@xxxxxxxxxxx>
>
> Since the RCU unsafe functions are no longer displayed by the
> available_filter_functions, we still need a way to see these
> functions in order to trace them. Create a new file that lists
> the functions that were declared RCU unsafe.
>
> Cc: Jiri Olsa <jolsa@xxxxxxxxxx>
> Cc: Paul E. McKenney <paulmck@xxxxxxxxxxxxxxxxxx>
> Signed-off-by: Steven Rostedt <rostedt@xxxxxxxxxxx>

Acked-by: Paul E. McKenney <paulmck@xxxxxxxxxxxxxxxxxx>

> ---
> include/linux/ftrace.h | 1 +
> kernel/trace/ftrace.c | 31 +++++++++++++++++++++++++++++++
> 2 files changed, 32 insertions(+)
>
> diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h
> index 4709264..4752764 100644
> --- a/include/linux/ftrace.h
> +++ b/include/linux/ftrace.h
> @@ -412,6 +412,7 @@ enum {
> FTRACE_ITER_HASH = (1 << 4),
> FTRACE_ITER_ENABLED = (1 << 5),
> FTRACE_ITER_NO_UNSAFE = (1 << 6),
> + FTRACE_ITER_UNSAFE_ONLY = (1 << 7),
> };
>
> void arch_ftrace_update_code(int command);
> diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
> index be87ac9..a3e4b71 100644
> --- a/kernel/trace/ftrace.c
> +++ b/kernel/trace/ftrace.c
> @@ -2647,6 +2647,9 @@ t_next(struct seq_file *m, void *v, loff_t *pos)
> ((iter->flags & FTRACE_ITER_ENABLED) &&
> !(rec->flags & FTRACE_FL_ENABLED)) ||
>
> + ((iter->flags & FTRACE_ITER_UNSAFE_ONLY) &&
> + !ftrace_lookup_ip(ftrace_unsafe_rcu, rec->ip)) ||
> +
> ((iter->flags & FTRACE_ITER_NO_UNSAFE) &&
> ftrace_lookup_ip(ftrace_unsafe_rcu, rec->ip))) {
>
> @@ -2784,6 +2787,24 @@ ftrace_avail_open(struct inode *inode, struct file *file)
> }
>
> static int
> +ftrace_rcu_unsafe_open(struct inode *inode, struct file *file)
> +{
> + struct ftrace_iterator *iter;
> +
> + if (unlikely(ftrace_disabled))
> + return -ENODEV;
> +
> + iter = __seq_open_private(file, &show_ftrace_seq_ops, sizeof(*iter));
> + if (iter) {
> + iter->pg = ftrace_pages_start;
> + iter->flags = FTRACE_ITER_UNSAFE_ONLY;
> + iter->ops = &global_ops;
> + }
> +
> + return iter ? 0 : -ENOMEM;
> +}
> +
> +static int
> ftrace_enabled_open(struct inode *inode, struct file *file)
> {
> struct ftrace_iterator *iter;
> @@ -3835,6 +3856,13 @@ static const struct file_operations ftrace_avail_fops = {
> .release = seq_release_private,
> };
>
> +static const struct file_operations ftrace_rcu_unsafe_fops = {
> + .open = ftrace_rcu_unsafe_open,
> + .read = seq_read,
> + .llseek = seq_lseek,
> + .release = seq_release_private,
> +};
> +
> static const struct file_operations ftrace_enabled_fops = {
> .open = ftrace_enabled_open,
> .read = seq_read,
> @@ -4071,6 +4099,9 @@ static __init int ftrace_init_dyn_debugfs(struct dentry *d_tracer)
> trace_create_file("available_filter_functions", 0444,
> d_tracer, NULL, &ftrace_avail_fops);
>
> + trace_create_file("rcu_unsafe_filter_functions", 0444,
> + d_tracer, NULL, &ftrace_rcu_unsafe_fops);
> +
> trace_create_file("enabled_functions", 0444,
> d_tracer, NULL, &ftrace_enabled_fops);
>
> --
> 1.7.10.4
>
>

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/