• Steven Rostedt (Google)'s avatar
    ring-buffer: Have mmapped ring buffer keep track of missed events · fe832be0
    Steven Rostedt (Google) authored
    While testing libtracefs on the mmapped ring buffer, the test that checks
    if missed events are accounted for failed when using the mapped buffer.
    This is because the mapped page does not update the missed events that
    were dropped because the writer filled up the ring buffer before the
    reader could catch it.
    
    Add the missed events to the reader page/sub-buffer when the IOCTL is done
    and a new reader page is acquired.
    
    Note that all accesses to the reader_page via rb_page_commit() had to be
    switched to rb_page_size(), and rb_page_size() which was just a copy of
    rb_page_commit() but now it masks out the RB_MISSED bits. This is needed
    as the mapped reader page is still active in the ring buffer code and
    where it reads the commit field of the bpage for the size, it now must
    mask it otherwise the missed bits that are now set will corrupt the size
    returned.
    
    Link: https://lore.kernel.org/linux-trace-kernel/20240312175405.12fb6726@gandalf.local.home
    
    Cc: Masami Hiramatsu <mhiramat@kernel.org>
    Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
    Cc: Vincent Donnefort <vdonnefort@google.com>
    Signed-off-by: default avatarSteven Rostedt (Google) <rostedt@goodmis.org>
    fe832be0
ring_buffer.c 182 KB