Commit 8656e7a2 authored by Frederic Weisbecker's avatar Frederic Weisbecker Committed by Ingo Molnar

tracing/core: make the per cpu trace files in per cpu directories

Impact: restructure the VFS layout of per CPU trace buffers

The per cpu trace files are all in a single directory:
/debug/tracing/per_cpu. In case of a large number of cpu, the
content of this directory becomes messy so we create now one
directory per cpu inside /debug/tracing/per_cpu which contain
each their own trace_pipe and trace files.

Ie:

 /debug/tracing$ ls -R per_cpu
 per_cpu:
 cpu0  cpu1

 per_cpu/cpu0:
 trace  trace_pipe

 per_cpu/cpu1:
 trace  trace_pipe
Signed-off-by: default avatarFrederic Weisbecker <fweisbec@gmail.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Lai Jiangshan <laijs@cn.fujitsu.com>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
parent f4abfb8d
...@@ -3061,28 +3061,31 @@ struct dentry *tracing_dentry_percpu(void) ...@@ -3061,28 +3061,31 @@ struct dentry *tracing_dentry_percpu(void)
static void tracing_init_debugfs_percpu(long cpu) static void tracing_init_debugfs_percpu(long cpu)
{ {
struct dentry *d_percpu = tracing_dentry_percpu(); struct dentry *d_percpu = tracing_dentry_percpu();
struct dentry *entry; struct dentry *entry, *d_cpu;
/* strlen(trace_pipe) + MAX(log10(cpu)) + '\0' */ /* strlen(cpu) + MAX(log10(cpu)) + '\0' */
char filename[17]; char cpu_dir[7];
if (cpu > 999 || cpu < 0) if (cpu > 999 || cpu < 0)
return; return;
/* per cpu trace_pipe */ sprintf(cpu_dir, "cpu%ld", cpu);
sprintf(filename, "trace_pipe%ld", cpu); d_cpu = debugfs_create_dir(cpu_dir, d_percpu);
if (!d_cpu) {
pr_warning("Could not create debugfs '%s' entry\n", cpu_dir);
return;
}
entry = debugfs_create_file(filename, 0444, d_percpu, /* per cpu trace_pipe */
entry = debugfs_create_file("trace_pipe", 0444, d_cpu,
(void *) cpu, &tracing_pipe_fops); (void *) cpu, &tracing_pipe_fops);
if (!entry) if (!entry)
pr_warning("Could not create debugfs '%s' entry\n", filename); pr_warning("Could not create debugfs 'trace_pipe' entry\n");
/* per cpu trace */ /* per cpu trace */
sprintf(filename, "trace%ld", cpu); entry = debugfs_create_file("trace", 0444, d_cpu,
entry = debugfs_create_file(filename, 0444, d_percpu,
(void *) cpu, &tracing_fops); (void *) cpu, &tracing_fops);
if (!entry) if (!entry)
pr_warning("Could not create debugfs '%s' entry\n", filename); pr_warning("Could not create debugfs 'trace' entry\n");
} }
#ifdef CONFIG_FTRACE_SELFTEST #ifdef CONFIG_FTRACE_SELFTEST
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment