tracing: remove users of tracing_reset
authorSteven Rostedt <srostedt@redhat.com>
Fri, 4 Sep 2009 16:12:39 +0000 (12:12 -0400)
committerSteven Rostedt <rostedt@goodmis.org>
Fri, 4 Sep 2009 16:12:39 +0000 (12:12 -0400)
The function tracing_reset is deprecated for outside use of trace.c.

The new function to reset the the buffers is tracing_reset_online_cpus.

The reason for this is that resetting the buffers while the event
trace points are active can corrupt the buffers, because they may
be writing at the time of reset. The tracing_reset_online_cpus disables
writes and waits for current writers to finish.

This patch replaces all users of tracing_reset except for the latency
tracers. Those changes require more work and will be removed in the
following patches.

Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
kernel/trace/kmemtrace.c
kernel/trace/trace.c
kernel/trace/trace_boot.c
kernel/trace/trace_power.c

index dda53ccf749b979e3959a698eb67fd386104399f..81b1645c85490175beeea335fcebecb12fd4783a 100644 (file)
@@ -183,11 +183,9 @@ static void kmemtrace_stop_probes(void)
 
 static int kmem_trace_init(struct trace_array *tr)
 {
-       int cpu;
        kmemtrace_array = tr;
 
-       for_each_cpu(cpu, cpu_possible_mask)
-               tracing_reset(tr, cpu);
+       tracing_reset_online_cpus(tr);
 
        kmemtrace_start_probes();
 
index 9110329ecf77e1d9aaef8df86b266f9fc8b02895..54517a889791bcac9d185fa5e269b8afff8ef9e7 100644 (file)
@@ -550,7 +550,6 @@ __acquires(kernel_lock)
        if (type->selftest && !tracing_selftest_disabled) {
                struct tracer *saved_tracer = current_trace;
                struct trace_array *tr = &global_trace;
-               int i;
 
                /*
                 * Run a selftest on this tracer.
@@ -559,8 +558,7 @@ __acquires(kernel_lock)
                 * internal tracing to verify that everything is in order.
                 * If we fail, we do not register this tracer.
                 */
-               for_each_tracing_cpu(i)
-                       tracing_reset(tr, i);
+               tracing_reset_online_cpus(tr);
 
                current_trace = type;
                /* the test is responsible for initializing and enabling */
@@ -573,8 +571,7 @@ __acquires(kernel_lock)
                        goto out;
                }
                /* Only reset on passing, to avoid touching corrupted buffers */
-               for_each_tracing_cpu(i)
-                       tracing_reset(tr, i);
+               tracing_reset_online_cpus(tr);
 
                printk(KERN_CONT "PASSED\n");
        }
index a29ef23ffb47080d81c41950ac4385566b193058..863139327816830082eaaa2e79dccbab8c5001d0 100644 (file)
@@ -41,14 +41,12 @@ void disable_boot_trace(void)
 
 static int boot_trace_init(struct trace_array *tr)
 {
-       int cpu;
        boot_trace = tr;
 
        if (!tr)
                return 0;
 
-       for_each_cpu(cpu, cpu_possible_mask)
-               tracing_reset(tr, cpu);
+       tracing_reset_online_cpus(tr);
 
        tracing_sched_switch_assign_trace(tr);
        return 0;
index 8a30d9874cd430d507c3f9e997610430f1bcb894..a5d5a4f7745b565818031047391e9e7d605001ef 100644 (file)
@@ -144,14 +144,12 @@ static void power_trace_reset(struct trace_array *tr)
 
 static int power_trace_init(struct trace_array *tr)
 {
-       int cpu;
        power_trace = tr;
 
        trace_power_enabled = 1;
        tracing_power_register();
 
-       for_each_cpu(cpu, cpu_possible_mask)
-               tracing_reset(tr, cpu);
+       tracing_reset_online_cpus(tr);
        return 0;
 }