lkml.org 
[lkml]   [2012]   [Jun]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH] ring-buffer: fix uninitialized read_stamp
On Thu, Jun 7, 2012 at 4:27 PM, David Sharp <dhsharp@google.com> wrote:
> This fixes a scenario in which trace_pipe_raw will return events with invalid
> timestamps when events are copied out one at a time (instead of swapping out
> the reader page with a spare page). In this scenario, ring_buffer_read_page()
> uses cpu_buffer->read_stamp to keep track of the time of the earliest event.
> However, cpu_buffer->read_stamp was not always updated. The only function that
> sets read_stamp to a new valid value is rb_reset_reader_page(), which is called
> only by rb_get_reader_page(). rb_reset_reader_page() was not called when there
> is data immediately available on the page to read (read < rb_page_size()). This
> is the bug.
>
> Setting the read_stamp on the first read from a page fixes the bug.
>
> Tested: On certain lightly-loaded machines, repetitive reads from
> trace_pipe_raw without using splice() would sometimes result in invalid
> timestamps. Poisoning read_stamp in rb_init_page() with a negative value makes
> the problem more visible. After this fix, the invalid timstamps disappear.

err, that's poisoning the bpage->time_stamp, not read_stamp.

>
> Google-Bug-Id: 6410455
> Signed-off-by: David Sharp <dhsharp@google.com>


\
 
 \ /
  Last update: 2012-06-08 02:21    [W:0.107 / U:0.356 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site