linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Namhyung Kim <namhyung@kernel.org>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: linux-kernel@vger.kernel.org, Al Viro <viro@ZenIV.linux.org.uk>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Ingo Molnar <mingo@kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [for-next][PATCH 5/7] tracing: Automatically mount tracefs on debugfs/tracing
Date: Mon, 9 Feb 2015 15:00:02 +0900	[thread overview]
Message-ID: <20150209060002.GB30788@sejong> (raw)
In-Reply-To: <20150204143755.694479564@goodmis.org>

On Wed, Feb 04, 2015 at 09:34:25AM -0500, Steven Rostedt wrote:
> From: "Steven Rostedt (Red Hat)" <rostedt@goodmis.org>
> 
> As tools currently rely on the tracing directory in debugfs, we can not
> just created a tracefs infrastructure and expect sysadmins to mount
> the new tracefs to have their old tools work.
> 
> Instead, the debugfs tracing directory is still created and the tracefs
> file system is mounted there when the debugfs filesystem is mounted.
> 
> No longer does the tracing infrastructure update the debugfs file system,
> but instead interacts with the tracefs file system. But now, it still
> appears to the user like nothing changed, except you also have the feature
> of mounting just the tracing system without needing all of debugfs!

One question.  Is it possible to have both of the old
/sys/kernel/debug/tracing and new /sys/kernel/tracing directories?


> 
> Cc: Al Viro <viro@zeniv.linux.org.uk>
> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
> ---
>  kernel/trace/trace.c | 36 +++++++++++++++++++++++++++++++++---
>  1 file changed, 33 insertions(+), 3 deletions(-)
> 
> diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
> index 6c4739bee4bb..b4aa936509d2 100644
> --- a/kernel/trace/trace.c
> +++ b/kernel/trace/trace.c
> @@ -32,6 +32,7 @@
>  #include <linux/splice.h>
>  #include <linux/kdebug.h>
>  #include <linux/string.h>
> +#include <linux/mount.h>
>  #include <linux/rwsem.h>
>  #include <linux/slab.h>
>  #include <linux/ctype.h>
> @@ -6535,6 +6536,28 @@ init_tracer_tracefs(struct trace_array *tr, struct dentry *d_tracer)
>  
>  }
>  
> +static struct vfsmount *trace_automount(void *ingore)
> +{
> +	struct vfsmount *mnt;
> +	struct file_system_type *type;
> +
> +	/*
> +	 * To maintain backward compatibility for tools that mount
> +	 * debugfs to get to the tracing facility, tracefs is automatically
> +	 * mounted to the debugfs/tracing directory.
> +	 */
> +	type = get_fs_type("tracefs");
> +	if (!type)
> +		return NULL;
> +	mnt = vfs_kern_mount(type, 0, "tracefs", NULL);
> +	put_filesystem(type);
> +	if (IS_ERR(mnt))
> +		return NULL;
> +	mntget(mnt);
> +
> +	return mnt;
> +}
> +
>  /**
>   * tracing_init_dentry - initialize top level trace array
>   *
> @@ -6546,14 +6569,21 @@ struct dentry *tracing_init_dentry(void)
>  {
>  	struct trace_array *tr = &global_trace;
>  
> +	/* The top level trace array uses  NULL as parent */
>  	if (tr->dir)
> -		return tr->dir;
> +		return NULL;
>  
>  	if (WARN_ON(!debugfs_initialized()))
>  		return ERR_PTR(-ENODEV);
>  
> -	tr->dir = debugfs_create_dir("tracing", NULL);
> -
> +	/*
> +	 * As there may still be users that expect the tracing
> +	 * files to exist in debugfs/tracing, we must automount
> +	 * the tracefs file system there, so older tools still
> +	 * work with the newer kerenl.

s/kerenl/kernel/

Thanks,
Namhyung


> +	 */
> +	tr->dir = debugfs_create_automount("tracing", NULL,
> +					   trace_automount, NULL);
>  	if (!tr->dir) {
>  		pr_warn_once("Could not create debugfs directory 'tracing'\n");
>  		return ERR_PTR(-ENOMEM);
> -- 
> 2.1.4
> 
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/

  reply	other threads:[~2015-02-09  6:01 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-04 14:34 [for-next][PATCH 0/7] tracing: Add new filesystem tracefs Steven Rostedt
2015-02-04 14:34 ` [for-next][PATCH 1/7] tracing: Only create tracer options files if directory exists Steven Rostedt
2015-02-04 14:34 ` [for-next][PATCH 2/7] tracing: Create cmdline tracer options on tracing fs init Steven Rostedt
2015-02-04 14:34 ` [for-next][PATCH 3/7] tracefs: Add new tracefs file system Steven Rostedt
2015-02-09  5:56   ` Namhyung Kim
2015-02-09 15:04     ` Steven Rostedt
2015-02-04 14:34 ` [for-next][PATCH 4/7] tracing: Convert the tracing facility over to use tracefs Steven Rostedt
2015-02-04 14:34 ` [for-next][PATCH 5/7] tracing: Automatically mount tracefs on debugfs/tracing Steven Rostedt
2015-02-09  6:00   ` Namhyung Kim [this message]
2015-02-09 15:06     ` Steven Rostedt
2015-02-04 14:34 ` [for-next][PATCH 6/7] tracefs: Add directory /sys/kernel/tracing Steven Rostedt
2015-02-04 14:34 ` [for-next][PATCH 7/7] tracing: Have mkdir and rmdir be part of tracefs Steven Rostedt
2015-02-09  6:07   ` Namhyung Kim
2015-02-09 15:07     ` Steven Rostedt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150209060002.GB30788@sejong \
    --to=namhyung@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=rostedt@goodmis.org \
    --cc=viro@ZenIV.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).