lkml.org 
[lkml]   [2012]   [Sep]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH v3 2/3] tracing: reset ring buffer when changing trace_clocks
    Date
    Because the "tsc" clock isn't in nanoseconds, the ring buffer must be
    reset when changing clocks so that incomparable timestamps don't end up
    in the same trace.

    Tested: Confirmed switching clocks resets the trace buffer.

    Google-Bug-Id: 6980623
    Signed-off-by: David Sharp <dhsharp@google.com>
    Cc: Steven Rostedt <rostedt@goodmis.org>
    Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
    ---
    kernel/trace/trace.c | 8 ++++++++
    1 files changed, 8 insertions(+), 0 deletions(-)

    diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
    index 92fb08e..4e26df3 100644
    --- a/kernel/trace/trace.c
    +++ b/kernel/trace/trace.c
    @@ -4012,6 +4012,14 @@ static ssize_t tracing_clock_write(struct file *filp, const char __user *ubuf,
    if (max_tr.buffer)
    ring_buffer_set_clock(max_tr.buffer, trace_clocks[i].func);

    + /*
    + * New clock may not be consistent with the previous clock.
    + * Reset the buffer so that it doesn't have incomparable timestamps.
    + */
    + tracing_reset_online_cpus(&global_trace);
    + if (max_tr.buffer)
    + tracing_reset_online_cpus(&max_tr);
    +
    mutex_unlock(&trace_types_lock);

    *fpos += cnt;
    --
    1.7.7.3


    \
     
     \ /
      Last update: 2012-09-21 01:41    [W:0.035 / U:0.244 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site