Skip to contentSkip to conversation

tracefs

RFC In review Greg KH 5 participants 11 messages Oct 23, 2009 – Oct 29, 2009

Subsystems (5)
lore
Share & tools
lore

Greg KH

author
#0 lore raw

RFC 1/1 tracefs

Hi all,

At LinuxCon this year, Steven and I talked about moving the debugfs usage in the tracing core to a stand-alone filesystem to give the ability to start to lock down the api so that people an count on what is going on in the tracing userspace interface.

So, on the flight to Tokyo for the kernel summit, I wrote up tracefs. Here's the first very rough cut at it below. I've run it here on my laptop, and all seems well, but I do have a few questions:
- I've made the mount point be /sys/kernel/trace/ Is that ok? Should it be /sys/kernel/tracing/? Or something else? You get to pick the mount point now, so I don't want to hear any more grumblings about the location in the future :)
- the block tracing code was not changed, as it uses /sys/kernel/debug/block/ at the moment, not the /sys/kernel/debug/tracing/ directory. To change the block tracing code, it would require us to change the userspace tools as well, which I don't know if we want to do. Thanks to Jens for straightening this all out for me, originally I thought it was a bug in the block tracing code.
- is this type of conversion to a custom virtual filesystem acceptable to the other tracing developers? Any objection to not using debugfs calls anymore? The operation is identical, but it keeps the rest of the kernel from intruding on your space now.

Again, this is a very rough cut, I know I can make this smaller, and actually make the code in the tracing core a bit simpler when calling tracefs, as it does not need to support all the different options that debugfs did.

Also, the init path for tracefs needs to be reworked, as it's a bit too complex now. This will reduce the usage of the "is this initialized" type mess that the patch below currently has.

Oh, and yes, I will split this up properly as well for a real submission :)

thanks,

greg k-h

------------

Subject: tracefs

This replaces the debugfs usage in the tracing core with a custom virtual filesystem for its use only.

 include/linux/magic.h                |    3 
 kernel/trace/Makefile                |    1 
 kernel/trace/blktrace.c              |   20 -
 kernel/trace/ftrace.c                |   43 +--
 kernel/trace/kmemtrace.c             |    1 
 kernel/trace/ring_buffer.c           |   12 
 kernel/trace/trace.c                 |   99 ++-----
 kernel/trace/trace.h                 |    5 
 kernel/trace/trace_boot.c            |    1 
 kernel/trace/trace_branch.c          |    1 
 kernel/trace/trace_events.c          |   41 +-
 kernel/trace/trace_events_filter.c   |    1 
 kernel/trace/trace_export.c          |    1 
 kernel/trace/trace_functions.c       |    1 
 kernel/trace/trace_functions_graph.c |    1 
 kernel/trace/trace_hw_branches.c     |    1 
 kernel/trace/trace_irqsoff.c         |    1 
 kernel/trace/trace_nop.c             |    1 
 kernel/trace/trace_printk.c          |   11 
 kernel/trace/trace_sched_switch.c    |    1 
 kernel/trace/trace_sched_wakeup.c    |    1 
 kernel/trace/trace_stack.c           |   11 
 kernel/trace/trace_stat.c            |   14 -
 kernel/trace/trace_sysprof.c         |    5 
 kernel/trace/tracefs.c               |  482 +++++++++++++++++++++++++++++++++++
 kernel/trace/tracefs.h               |   33 ++
 26 files changed, 621 insertions(+), 171 deletions(-)
include/linux/magic.h +2 -1
index 76285e0..75682d0 100644
@@ -8,7 +8,8 @@
 #define CODA_SUPER_MAGIC	0x73757245
 #define CRAMFS_MAGIC		0x28cd3d45	/* some random number */
 #define CRAMFS_MAGIC_WEND	0x453dcd28	/* magic number with the wrong endianess */
-#define DEBUGFS_MAGIC          0x64626720
+#define DEBUGFS_MAGIC		0x64626720
+#define TRACEFS_MAGIC		0x74726365
 #define SYSFS_MAGIC		0x62656572
 #define SECURITYFS_MAGIC	0x73636673
 #define SELINUX_MAGIC		0xf97cff8c
kernel/trace/Makefile +1 -0
index 26f03ac..afe2f04 100644
@@ -29,6 +29,7 @@ obj-$(CONFIG_TRACING) += trace.o
 obj-$(CONFIG_TRACING) += trace_output.o
 obj-$(CONFIG_TRACING) += trace_stat.o
 obj-$(CONFIG_TRACING) += trace_printk.o
+obj-$(CONFIG_TRACING) += tracefs.o
 obj-$(CONFIG_CONTEXT_SWITCH_TRACER) += trace_sched_switch.o
 obj-$(CONFIG_SYSPROF_TRACER) += trace_sysprof.o
 obj-$(CONFIG_FUNCTION_TRACER) += trace_functions.o
kernel/trace/blktrace.c +10 -10
index d9d6206..e071e4e 100644
@@ -21,7 +21,6 @@
 #include <linux/percpu.h>
 #include <linux/init.h>
 #include <linux/mutex.h>
-#include <linux/debugfs.h>
 #include <linux/smp_lock.h>
 #include <linux/time.h>
 #include <linux/uaccess.h>
@@ -29,6 +28,7 @@
 #include <trace/events/block.h>
 
 #include "trace_output.h"
+#include "tracefs.h"
 
 #ifdef CONFIG_BLK_DEV_IO_TRACE
 
@@ -269,10 +269,10 @@ static DEFINE_MUTEX(blk_tree_mutex);
 
 static void blk_trace_free(struct blk_trace *bt)
 {
-	debugfs_remove(bt->msg_file);
-	debugfs_remove(bt->dropped_file);
+	tracefs_remove(bt->msg_file);
+	tracefs_remove(bt->dropped_file);
 	relay_close(bt->rchan);
-	debugfs_remove(bt->dir);
+	tracefs_remove(bt->dir);
 	free_percpu(bt->sequence);
 	free_percpu(bt->msg_data);
 	kfree(bt);
@@ -382,7 +382,7 @@ static int blk_subbuf_start_callback(struct rchan_buf *buf, void *subbuf,
 
 static int blk_remove_buf_file_callback(struct dentry *dentry)
 {
-	debugfs_remove(dentry);
+	tracefs_remove(dentry);
 
 	return 0;
 }
@@ -393,7 +393,7 @@ static struct dentry *blk_create_buf_file_callback(const char *filename,
 						   struct rchan_buf *buf,
 						   int *is_global)
 {
-	return debugfs_create_file(filename, mode, parent, buf,
+	return tracefs_create_file(filename, mode, parent, buf,
 					&relay_file_operations);
 }
 
@@ -462,7 +462,7 @@ int do_blk_trace_setup(struct request_queue *q, char *name, dev_t dev,
 
 	mutex_lock(&blk_tree_mutex);
 	if (!blk_tree_root) {
-		blk_tree_root = debugfs_create_dir("block", NULL);
+		blk_tree_root = tracefs_create_dir("block", NULL);
 		if (!blk_tree_root) {
 			mutex_unlock(&blk_tree_mutex);
 			goto err;
@@ -470,7 +470,7 @@ int do_blk_trace_setup(struct request_queue *q, char *name, dev_t dev,
 	}
 	mutex_unlock(&blk_tree_mutex);
 
-	dir = debugfs_create_dir(buts->name, blk_tree_root);
+	dir = tracefs_create_dir(buts->name, blk_tree_root);
 
 	if (!dir)
 		goto err;
@@ -480,12 +480,12 @@ int do_blk_trace_setup(struct request_queue *q, char *name, dev_t dev,
 	atomic_set(&bt->dropped, 0);
 
 	ret = -EIO;
-	bt->dropped_file = debugfs_create_file("dropped", 0444, dir, bt,
+	bt->dropped_file = tracefs_create_file("dropped", 0444, dir, bt,
 					       &blk_dropped_fops);
 	if (!bt->dropped_file)
 		goto err;
 
-	bt->msg_file = debugfs_create_file("msg", 0222, dir, bt, &blk_msg_fops);
+	bt->msg_file = tracefs_create_file("msg", 0222, dir, bt, &blk_msg_fops);
 	if (!bt->msg_file)
 		goto err;
 
kernel/trace/ftrace.c +19 -24

108 lines not on this page · raw message

kernel/trace/kmemtrace.c +0 -1
index a91da69..5553890 100644
@@ -8,7 +8,6 @@
 
 #include <linux/tracepoint.h>
 #include <linux/seq_file.h>
-#include <linux/debugfs.h>
 #include <linux/dcache.h>
 #include <linux/fs.h>
 
kernel/trace/ring_buffer.c +5 -7
index d4ff019..8041979 100644
@@ -7,7 +7,6 @@
 #include <linux/trace_clock.h>
 #include <linux/ftrace_irq.h>
 #include <linux/spinlock.h>
-#include <linux/debugfs.h>
 #include <linux/uaccess.h>
 #include <linux/hardirq.h>
 #include <linux/kmemcheck.h>
@@ -21,6 +20,7 @@
 #include <linux/fs.h>
 
 #include "trace.h"
+#include "tracefs.h"
 
 /*
  * The ring buffer header is special. We must manually up keep it.
@@ -3820,19 +3820,17 @@ static const struct file_operations rb_simple_fops = {
 };
 
 
-static __init int rb_init_debugfs(void)
+static __init int rb_init_tracefs(void)
 {
-	struct dentry *d_tracer;
+	tracefs_init();
 
-	d_tracer = tracing_init_dentry();
-
-	trace_create_file("tracing_on", 0644, d_tracer,
+	trace_create_file("tracing_on", 0644, NULL,
 			    &ring_buffer_flags, &rb_simple_fops);
 
 	return 0;
 }
 
-fs_initcall(rb_init_debugfs);
+fs_initcall(rb_init_tracefs);
 #endif
 
 #ifdef CONFIG_HOTPLUG_CPU
kernel/trace/trace.c +34 -65

228 lines not on this page · raw message

kernel/trace/trace.h +2 -3
index 405cb85..f9c4639 100644
@@ -236,7 +236,7 @@ struct tracer_flags {
 
 
 /**
- * struct tracer - a specific tracer and its callbacks to interact with debugfs
+ * struct tracer - a specific tracer and its callbacks to interact with tracefs
  * @name: the name chosen to select it on the available_tracers file
  * @init: called when one switches to this tracer (echo name > current_tracer)
  * @reset: called when one switches to another tracer
@@ -303,8 +303,7 @@ struct dentry *trace_create_file(const char *name,
 				 void *data,
 				 const struct file_operations *fops);
 
-struct dentry *tracing_init_dentry(void);
-void init_tracer_sysprof_debugfs(struct dentry *d_tracer);
+void init_tracer_sysprof_tracefs(void);
 
 struct ring_buffer_event;
 
kernel/trace/trace_boot.c +0 -1
index c21d5f3..a2235f4 100644
@@ -6,7 +6,6 @@
  */
 
 #include <linux/init.h>
-#include <linux/debugfs.h>
 #include <linux/ftrace.h>
 #include <linux/kallsyms.h>
 #include <linux/time.h>
kernel/trace/trace_branch.c +0 -1
index 4a194f0..8a5cb65 100644
@@ -7,7 +7,6 @@
 #include <linux/seq_file.h>
 #include <linux/spinlock.h>
 #include <linux/irqflags.h>
-#include <linux/debugfs.h>
 #include <linux/uaccess.h>
 #include <linux/module.h>
 #include <linux/ftrace.h>
kernel/trace/trace_events.c +17 -24

127 lines not on this page · raw message

kernel/trace/trace_events_filter.c +0 -1
index 98a6cc5..db194f4 100644
@@ -18,7 +18,6 @@
  * Copyright (C) 2009 Tom Zanussi <[email protected]>
  */
 
-#include <linux/debugfs.h>
 #include <linux/uaccess.h>
 #include <linux/module.h>
 #include <linux/ctype.h>
kernel/trace/trace_export.c +0 -1
index 9753fcc..18a4a76 100644
@@ -6,7 +6,6 @@
 #include <linux/stringify.h>
 #include <linux/kallsyms.h>
 #include <linux/seq_file.h>
-#include <linux/debugfs.h>
 #include <linux/uaccess.h>
 #include <linux/ftrace.h>
 #include <linux/module.h>
kernel/trace/trace_functions.c +0 -1
index b3f3776..e1fb56f 100644
@@ -10,7 +10,6 @@
  *  Copyright (C) 2004 William Lee Irwin III
  */
 #include <linux/ring_buffer.h>
-#include <linux/debugfs.h>
 #include <linux/uaccess.h>
 #include <linux/ftrace.h>
 #include <linux/fs.h>
kernel/trace/trace_functions_graph.c +0 -1
index 45e6c01..3538256 100644
@@ -6,7 +6,6 @@
  * is Copyright (c) Steven Rostedt <[email protected]>
  *
  */
-#include <linux/debugfs.h>
 #include <linux/uaccess.h>
 #include <linux/ftrace.h>
 #include <linux/fs.h>
kernel/trace/trace_hw_branches.c +0 -1
index 69543a9..6238d9d 100644
@@ -5,7 +5,6 @@
  * Markus Metzger <[email protected]>, 2008-2009
  */
 #include <linux/kallsyms.h>
-#include <linux/debugfs.h>
 #include <linux/ftrace.h>
 #include <linux/module.h>
 #include <linux/cpu.h>
kernel/trace/trace_irqsoff.c +0 -1
index 3aa7eaa..9762b1f 100644
@@ -10,7 +10,6 @@
  *  Copyright (C) 2004 William Lee Irwin III
  */
 #include <linux/kallsyms.h>
-#include <linux/debugfs.h>
 #include <linux/uaccess.h>
 #include <linux/module.h>
 #include <linux/ftrace.h>
kernel/trace/trace_nop.c +0 -1
index 394f944..00f08f6 100644
@@ -7,7 +7,6 @@
 
 #include <linux/module.h>
 #include <linux/fs.h>
-#include <linux/debugfs.h>
 #include <linux/ftrace.h>
 
 #include "trace.h"
kernel/trace/trace_printk.c +3 -8
index 2547d88..e02bb05 100644
@@ -5,7 +5,6 @@
  *
  */
 #include <linux/seq_file.h>
-#include <linux/debugfs.h>
 #include <linux/uaccess.h>
 #include <linux/kernel.h>
 #include <linux/ftrace.h>
@@ -18,6 +17,7 @@
 #include <linux/fs.h>
 
 #include "trace.h"
+#include "tracefs.h"
 
 #ifdef CONFIG_MODULES
 
@@ -229,13 +229,8 @@ static const struct file_operations ftrace_formats_fops = {
 
 static __init int init_trace_printk_function_export(void)
 {
-	struct dentry *d_tracer;
-
-	d_tracer = tracing_init_dentry();
-	if (!d_tracer)
-		return 0;
-
-	trace_create_file("printk_formats", 0444, d_tracer,
+	tracefs_init();
+	trace_create_file("printk_formats", 0444, NULL,
 				    NULL, &ftrace_formats_fops);
 
 	return 0;
kernel/trace/trace_sched_switch.c +0 -1
index 5fca0f5..29313cd 100644
@@ -6,7 +6,6 @@
  */
 #include <linux/module.h>
 #include <linux/fs.h>
-#include <linux/debugfs.h>
 #include <linux/kallsyms.h>
 #include <linux/uaccess.h>
 #include <linux/ftrace.h>
kernel/trace/trace_sched_wakeup.c +0 -1
index 26185d7..b9021fa 100644
@@ -11,7 +11,6 @@
  */
 #include <linux/module.h>
 #include <linux/fs.h>
-#include <linux/debugfs.h>
 #include <linux/kallsyms.h>
 #include <linux/uaccess.h>
 #include <linux/ftrace.h>
kernel/trace/trace_stack.c +5 -6
index 8504ac7..1da4e52 100644
@@ -7,13 +7,14 @@
 #include <linux/seq_file.h>
 #include <linux/spinlock.h>
 #include <linux/uaccess.h>
-#include <linux/debugfs.h>
 #include <linux/ftrace.h>
 #include <linux/module.h>
 #include <linux/sysctl.h>
 #include <linux/init.h>
 #include <linux/fs.h>
+
 #include "trace.h"
+#include "tracefs.h"
 
 #define STACK_TRACE_ENTRIES 500
 
@@ -331,14 +332,12 @@ __setup("stacktrace", enable_stacktrace);
 
 static __init int stack_trace_init(void)
 {
-	struct dentry *d_tracer;
-
-	d_tracer = tracing_init_dentry();
+	tracefs_init();
 
-	trace_create_file("stack_max_size", 0644, d_tracer,
+	trace_create_file("stack_max_size", 0644, NULL,
 			&max_stack_size, &stack_max_size_fops);
 
-	trace_create_file("stack_trace", 0444, d_tracer,
+	trace_create_file("stack_trace", 0444, NULL,
 			NULL, &stack_trace_fops);
 
 	if (stack_tracer_enabled)
kernel/trace/trace_stat.c +6 -8
index a4bb239..4ee62a0 100644
@@ -11,8 +11,8 @@
 
 #include <linux/list.h>
 #include <linux/rbtree.h>
-#include <linux/debugfs.h>
 #include "trace_stat.h"
+#include "tracefs.h"
 #include "trace.h"
 
 
@@ -95,7 +95,7 @@ static void reset_stat_session(struct stat_session *session)
 
 static void destroy_session(struct stat_session *session)
 {
-	debugfs_remove(session->file);
+	tracefs_remove(session->file);
 	__reset_stat_session(session);
 	mutex_destroy(&session->stat_mutex);
 	kfree(session);
@@ -303,13 +303,11 @@ static const struct file_operations tracing_stat_fops = {
 
 static int tracing_stat_init(void)
 {
-	struct dentry *d_tracing;
+	tracefs_init();
 
-	d_tracing = tracing_init_dentry();
-
-	stat_dir = debugfs_create_dir("trace_stat", d_tracing);
+	stat_dir = tracefs_create_dir("trace_stat", NULL);
 	if (!stat_dir)
-		pr_warning("Could not create debugfs "
+		pr_warning("Could not create tracefs "
 			   "'trace_stat' entry\n");
 	return 0;
 }
@@ -319,7 +317,7 @@ static int init_stat_file(struct stat_session *session)
 	if (!stat_dir && tracing_stat_init())
 		return -ENODEV;
 
-	session->file = debugfs_create_file(session->ts->name, 0644,
+	session->file = tracefs_create_file(session->ts->name, 0644,
 					    stat_dir,
 					    session, &tracing_stat_fops);
 	if (!session->file)
kernel/trace/trace_sysprof.c +2 -3
index f669396..6f970fe 100644
@@ -6,7 +6,6 @@
  * Copyright (C) 2008 Ingo Molnar <[email protected]>
  */
 #include <linux/kallsyms.h>
-#include <linux/debugfs.h>
 #include <linux/hrtimer.h>
 #include <linux/uaccess.h>
 #include <linux/ftrace.h>
@@ -320,9 +319,9 @@ static const struct file_operations sysprof_sample_fops = {
 	.write		= sysprof_sample_write,
 };
 
-void init_tracer_sysprof_debugfs(struct dentry *d_tracer)
+void init_tracer_sysprof_tracefs(void)
 {
 
 	trace_create_file("sysprof_sample_period", 0644,
-			d_tracer, NULL, &sysprof_sample_fops);
+			NULL, NULL, &sysprof_sample_fops);
 }
kernel/trace/tracefs.c new file +482 -0

482 lines not on this page · raw message

kernel/trace/tracefs.h new file +33 -0
new file mode 100644
index 0000000..7618221
@@ -0,0 +1,33 @@
+/*
+ *  Copyright (C) 2004,2009 Greg Kroah-Hartman <[email protected]>
+ *  Copyright (C) 2004 IBM Inc.
+ *  Copyright (C) 2009 Novell Inc.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License version 2 as
+ *  published by the Free Software Foundation.
+ */
+
+#ifndef _TRACEFS_H_
+#define _TRACEFS_H_
+
+#include <linux/fs.h>
+#include <linux/types.h>
+
+struct file_operations;
+
+struct dentry *tracefs_create_file(const char *name, mode_t mode,
+				   struct dentry *parent, void *data,
+				   const struct file_operations *fops);
+
+struct dentry *tracefs_create_dir(const char *name, struct dentry *parent);
+
+void tracefs_remove(struct dentry *dentry);
+
+void tracefs_remove_recursive(struct dentry *dentry);
+
+bool tracefs_initialized(void);
+
+int tracefs_init(void);
+
+#endif
maintainer
#1 lore raw
Quoted 7 lines · Greg KH

Hi all,

At LinuxCon this year, Steven and I talked about moving the debugfs usage in the tracing core to a stand-alone filesystem to give the ability to start to lock down the api so that people an count on what is going on in the tracing userspace interface.

Quoted 7 lines

So, on the flight to Tokyo for the kernel summit, I wrote up tracefs. Here's the first very rough cut at it below. I've run it here on my laptop, and all seems well, but I do have a few questions:
- I've made the mount point be /sys/kernel/trace/ Is that ok? Should it be /sys/kernel/tracing/? Or something else? You get to pick the mount point now, so I don't want to hear any more grumblings about the location in the future :)

/trace

(rostedt hides)

Quoted 7 lines

- the block tracing code was not changed, as it uses /sys/kernel/debug/block/ at the moment, not the /sys/kernel/debug/tracing/ directory. To change the block tracing code, it would require us to change the userspace tools as well, which I don't know if we want to do. Thanks to Jens for straightening this all out for me, originally I thought it was a bug in the block tracing code.

I thought we were suppose to port the block tracing over to tracepoints anyway, and remove the "block" tracer?

Quoted 4 lines

- is this type of conversion to a custom virtual filesystem acceptable to the other tracing developers? Any objection to not using debugfs calls anymore? The operation is identical, but it keeps the rest of the kernel from intruding on your space now.

What I would like is to still use debugfs for new features until we understand them better. That location, files can disappear or have their formats completely changed. When things move to tracefs, then the API is a bit more rigid. Files can still change, but they must change in a way to be backward compatible. We need a nice way to document how a file can change, and stick to it.

Quoted 17 lines

Again, this is a very rough cut, I know I can make this smaller, and actually make the code in the tracing core a bit simpler when calling tracefs, as it does not need to support all the different options that debugfs did.

Also, the init path for tracefs needs to be reworked, as it's a bit too complex now. This will reduce the usage of the "is this initialized" type mess that the patch below currently has.

Oh, and yes, I will split this up properly as well for a real submission :)

thanks,

greg k-h

Quoted 8 lines

------------

Subject: tracefs

This replaces the debugfs usage in the tracing core with a custom virtual filesystem for its use only.

[ Snip the s/debugfs/tracefs/ changes ]

Note, as mentioned above. I envision having a way to start out in debugfs and then slowly move things over to tracefs when they become standardize. Think of debugfs as linux-next ;-)

Although most of the files are pretty much stable, I don't want to do a cross the board change at the moment.

kernel/trace/tracefs.c

Quoted 5 lines
kernel/trace/tracefs.c new file +0 -0
new file mode 100644
index 0000000..8ac9394

[ Snip the rest because I just know it is perfect ;-) ]

Thanks Greg!

-- Steve

author
#2 lore raw
Quoted 16 lines · Steven Rostedt
Quoted 7 lines · Greg KH

Hi all,

At LinuxCon this year, Steven and I talked about moving the debugfs usage in the tracing core to a stand-alone filesystem to give the ability to start to lock down the api so that people an count on what is going on in the tracing userspace interface.

Quoted 7 lines

So, on the flight to Tokyo for the kernel summit, I wrote up tracefs. Here's the first very rough cut at it below. I've run it here on my laptop, and all seems well, but I do have a few questions:
- I've made the mount point be /sys/kernel/trace/ Is that ok? Should it be /sys/kernel/tracing/? Or something else? You get to pick the mount point now, so I don't want to hear any more grumblings about the location in the future :)

Quoted 3 lines

/trace

(rostedt hides)

Yeah, I knew you were going to do that :)

Quoted 10 lines
Quoted 7 lines

- the block tracing code was not changed, as it uses /sys/kernel/debug/block/ at the moment, not the /sys/kernel/debug/tracing/ directory. To change the block tracing code, it would require us to change the userspace tools as well, which I don't know if we want to do. Thanks to Jens for straightening this all out for me, originally I thought it was a bug in the block tracing code.

I thought we were suppose to port the block tracing over to tracepoints anyway, and remove the "block" tracer?

That's between you and Jens, but at the kernel summit, he said it was not going to go away any year soon.

Quoted 11 lines
Quoted 4 lines

- is this type of conversion to a custom virtual filesystem acceptable to the other tracing developers? Any objection to not using debugfs calls anymore? The operation is identical, but it keeps the rest of the kernel from intruding on your space now.

What I would like is to still use debugfs for new features until we understand them better. That location, files can disappear or have their formats completely changed. When things move to tracefs, then the API is a bit more rigid. Files can still change, but they must change in a way to be backward compatible. We need a nice way to document how a file can change, and stick to it.

That sounds like a very good idea. I'll respin the patch to only merge one tracer over at a time.

You are going to have a bit of a difficult time if you mix debugfs and tracefs as people will not know where to look for the files. But hey, that's your problem to deal with :)

Quoted 8 lines

[ Snip the s/debugfs/tracefs/ changes ]

Note, as mentioned above. I envision having a way to start out in debugfs and then slowly move things over to tracefs when they become standardize. Think of debugfs as linux-next ;-)

Although most of the files are pretty much stable, I don't want to do a cross the board change at the moment.

That sounds reasonable. Thanks for the review, I'll respin this when I get back home next week.

thanks,

greg k-h

#4 lore raw
In reply to Greg KH
Quoted 6 lines · Greg KH

Hi all,

At LinuxCon this year, Steven and I talked about moving the debugfs usage in the tracing core to a stand-alone filesystem to give the ability to start to lock down the api so that people an count on what is going on in the tracing userspace interface.

What we want to move out initially (and i talked to Steve and Frederic about that a few weeks ago) is the event description bits - the format stuff in /debug/tracing/events/ - but definitely not all the other, rather messy and ad-hoc APIs.

_No way_ do we want to tie down the pretty-printing ftrace details as an ABI. We promised that when ftrace went upstream and all the details are way too messy to be exposed in an ABI alike matter (and yes, consider this a NAK Steve ;-).

We want a _very_ careful exporting of certain pieces of information that helps syscall-exposed perf events bits, and to improve the quality of interfaces while we do that.

Ingo

#3 lore raw
In reply to Steven Rostedt
Quoted 16 lines · Steven Rostedt
Quoted 7 lines · Greg KH

Hi all,

At LinuxCon this year, Steven and I talked about moving the debugfs usage in the tracing core to a stand-alone filesystem to give the ability to start to lock down the api so that people an count on what is going on in the tracing userspace interface.

Quoted 7 lines

So, on the flight to Tokyo for the kernel summit, I wrote up tracefs. Here's the first very rough cut at it below. I've run it here on my laptop, and all seems well, but I do have a few questions:
- I've made the mount point be /sys/kernel/trace/ Is that ok? Should it be /sys/kernel/tracing/? Or something else? You get to pick the mount point now, so I don't want to hear any more grumblings about the location in the future :)

Quoted 3 lines

/trace

(rostedt hides)

No, what we want is either /sys/events/ or /proc/events/ alike place to expose event logging formats (i.e. the /debug/tracing/events/ details). Those are clean enough to be exposed as an ABI - and it would be a good point to start.

Ingo

#5 lore raw
In reply to Ingo Molnar
Quoted 20 lines · Ingo Molnar
Quoted 6 lines · Greg KH

Hi all,

At LinuxCon this year, Steven and I talked about moving the debugfs usage in the tracing core to a stand-alone filesystem to give the ability to start to lock down the api so that people an count on what is going on in the tracing userspace interface.

What we want to move out initially (and i talked to Steve and Frederic about that a few weeks ago) is the event description bits - the format stuff in /debug/tracing/events/ - but definitely not all the other, rather messy and ad-hoc APIs.

_No way_ do we want to tie down the pretty-printing ftrace details as an ABI. We promised that when ftrace went upstream and all the details are way too messy to be exposed in an ABI alike matter (and yes, consider this a NAK Steve ;-).

Quoted 5 lines

We want a _very_ careful exporting of certain pieces of information that helps syscall-exposed perf events bits, and to improve the quality of interfaces while we do that.

Ingo

I guess the first bits that need to be exported are the TRACE_EVENT_ABI. But even before that, we need to ensure we have a final version of the trace events description.

#6 lore raw
Quoted 25 lines · Frederic Weisbecker
Quoted 24 lines · Ingo Molnar
Quoted 6 lines · Greg KH

Hi all,

At LinuxCon this year, Steven and I talked about moving the debugfs usage in the tracing core to a stand-alone filesystem to give the ability to start to lock down the api so that people an count on what is going on in the tracing userspace interface.

What we want to move out initially (and i talked to Steve and Frederic about that a few weeks ago) is the event description bits - the format stuff in /debug/tracing/events/ - but definitely not all the other, rather messy and ad-hoc APIs.

_No way_ do we want to tie down the pretty-printing ftrace details as an ABI. We promised that when ftrace went upstream and all the details are way too messy to be exposed in an ABI alike matter (and yes, consider this a NAK Steve ;-).

We want a _very_ careful exporting of certain pieces of information that helps syscall-exposed perf events bits, and to improve the quality of interfaces while we do that.

Quoted 6 lines
Quoted 1 line

Ingo

I guess the first bits that need to be exported are the TRACE_EVENT_ABI. But even before that, we need to ensure we have a final version of the trace events description.

Yeah, exactly. Once we pin them down they'll be with us for a very long time.

Ingo

maintainer
#7 lore raw
In reply to Ingo Molnar
Quoted 4 lines · Ingo Molnar

_No way_ do we want to tie down the pretty-printing ftrace details as an ABI. We promised that when ftrace went upstream and all the details are way too messy to be exposed in an ABI alike matter (and yes, consider this a NAK Steve ;-).

Note, I wasn't talking about tie down the pretty-print formats. But we need to have a standard way to change them.

For example:

[root@mxf ~]# cat /debug/tracing/events/power/power_start/format
name: power_start
ID: 258
format:

	field:unsigned short common_type;	offset:0;	size:2;
	field:unsigned char common_flags;	offset:2;	size:1;
	field:unsigned char common_preempt_count;	offset:3;	size:1;
	field:int common_pid;	offset:4;	size:4;
	field:int common_lock_depth;	offset:8;	size:4;

	field:u64 type;	offset:16;	size:8;
	field:u64 state;	offset:24;	size:8;

print fmt: "type=%lu state=%lu", (unsigned long)REC->type, (unsigned long)REC->state

Now we are going to add a "signed" field to each line. Fine, but we need a spec of some sort to say how that will happen. Or what can be expected to not change. We can say the type (field in this case) will always be the first item, and that the type will stay on a single line. If the parser does not know how to handle one of the items (offset, size, etc) it can simply ignore it. When it hits the "\n", it is done with that type.

We need to document this, so tools will not break when we update this format.

-- Steve

#8 lore raw
Quoted 2 lines · Steven Rostedt

Note, I wasn't talking about tie down the pretty-print formats. But we need to have a standard way to change them.

Which means to tie down it I think. Once we do have a good enough format those bits need to be locked down, with a way for adding new attributes (either entirely new or better replacmeents for existing ones with leaving the old ones in place for existing userspace).

In addition to the format description people have also asked for ABI tracepoints which would lock down the actual trace format in the the same way (only addition of new fields without removing or changing existing ones). For this to be actually useful some trace buffer also needs to be exposed in an ABI-stable (that is non-debugfs way).

author
#9 lore raw
In reply to Ingo Molnar
Quoted 15 lines · Ingo Molnar
Quoted 6 lines · Greg KH

Hi all,

At LinuxCon this year, Steven and I talked about moving the debugfs usage in the tracing core to a stand-alone filesystem to give the ability to start to lock down the api so that people an count on what is going on in the tracing userspace interface.

What we want to move out initially (and i talked to Steve and Frederic about that a few weeks ago) is the event description bits - the format stuff in /debug/tracing/events/ - but definitely not all the other, rather messy and ad-hoc APIs.

Quoted 4 lines

_No way_ do we want to tie down the pretty-printing ftrace details as an ABI. We promised that when ftrace went upstream and all the details are way too messy to be exposed in an ABI alike matter (and yes, consider this a NAK Steve ;-).

Ok, I'll drop this. There was some cleanups I found, I'll pick those out and send them on. What tree should I base off of to send cleanup patches to?

thanks,

greg k-h

#10 lore raw
Quoted 16 lines · Greg KH
Quoted 15 lines · Ingo Molnar
Quoted 6 lines · Greg KH

Hi all,

At LinuxCon this year, Steven and I talked about moving the debugfs usage in the tracing core to a stand-alone filesystem to give the ability to start to lock down the api so that people an count on what is going on in the tracing userspace interface.

What we want to move out initially (and i talked to Steve and Frederic about that a few weeks ago) is the event description bits - the format stuff in /debug/tracing/events/ - but definitely not all the other, rather messy and ad-hoc APIs.

Quoted 8 lines
Quoted 4 lines

_No way_ do we want to tie down the pretty-printing ftrace details as an ABI. We promised that when ftrace went upstream and all the details are way too messy to be exposed in an ABI alike matter (and yes, consider this a NAK Steve ;-).

Ok, I'll drop this. There was some cleanups I found, I'll pick those out and send them on. What tree should I base off of to send cleanup patches to?

The tip of the tracing tree is in tip:tracing/core, you can find it at:

git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip.git tracing/core

Thanks,

Ingo