• Frederic Weisbecker's avatar
    tracing/ftrace: fix double calls to tracing_start() · ac1d52d0
    Frederic Weisbecker authored
    Impact: fix a warning during preemptirqsoff selftests
    
    When the preemptirqsoff selftest fails, we see the following
    warning:
    
    [    6.050000] Testing tracer preemptirqsoff: .. no entries found ..
    ------------[ cut here ]------------
    [    6.060000] WARNING: at kernel/trace/trace.c:688 tracing_start+0x67/0xd3()
    [    6.060000] Modules linked in:
    [    6.060000] Pid: 1, comm: swapper Tainted: G
    [    6.060000] Call Trace:
    [    6.060000]  [<ffffffff802460ff>] warn_slowpath+0xb1/0x100
    [    6.060000]  [<ffffffff802a8f5b>] ? trace_preempt_on+0x35/0x4b
    [    6.060000]  [<ffffffff802a37fb>] ? tracing_start+0x31/0xd3
    [    6.060000]  [<ffffffff802a37fb>] ? tracing_start+0x31/0xd3
    [    6.060000]  [<ffffffff80271e0b>] ? __lock_acquired+0xe6/0x1f2
    [    6.060000]  [<ffffffff802a37fb>] ? tracing_start+0x31/0xd3
    [    6.060000]  [<ffffffff802a3831>] tracing_start+0x67/0xd3
    [    6.060000]  [<ffffffff802a8ace>] ? irqsoff_tracer_reset+0x2d/0x57
    [    6.060000]  [<ffffffff802a4d1c>] trace_selftest_startup_preemptirqsoff+0x1c8/0x1f1
    [    6.060000]  [<ffffffff802a4798>] register_tracer+0x12f/0x241
    [    6.060000]  [<ffffffff810250d0>] ? init_irqsoff_tracer+0x0/0x53
    [    6.060000]  [<ffffffff8102510b>] init_irqsoff_tracer+0x3b/0x53
    
    This is because in fail case, the preemptirqsoff tracer selftest calls twice
    the tracing_start() function:
    
    int
    trace_selftest_startup_preemptirqsoff(struct tracer *trace, struct trace_array *tr)
    {
            if (!ret && !count) {
                    printk(KERN_CONT ".. no entries found ..");
                    ret = -1;
                    tracing_start(); <-----
                    goto out;
            }
            [...]
    out:
            trace->reset(tr);
            tracing_start(); <------
            tracing_max_latency = save_max;
    
            return ret;
    }
    
    Since it is well handled in the out path, we don't need the conditional one.
    Reported-by: default avatarIngo Molnar <mingo@elte.hu>
    Signed-off-by: default avatarFrederic Weisbecker <fweisbec@gmail.com>
    LKML-Reference: <1237159961-7447-1-git-send-email-fweisbec@gmail.com>
    Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
    ac1d52d0
trace_selftest.c 14.3 KB