lkml.org 
[lkml]   [2010]   [Jan]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH] tracing: consolidate protection of reader access to the ring buffer
From
Date
On Wed, 2010-01-06 at 20:08 +0800, Lai Jiangshan wrote:
> At the beginning, access to the ring buffer are fully serialized
> by trace_types_lock. Patch d7350c3f4569 gives more freedom to readers,
> and patch b04cc6b1f6 adds code to protect trace_pipe and cpu#/trace_pipe.
>
> But actually it is not enough, ring buffer readers are not always
> read-only, they may consume data.
>
> This patch makes accesses to trace, trace_pipe, trace_pipe_raw
> cpu#/trace, cpu#/trace_pipe and cpu#/trace_pipe_raw are serialized.
> And removes tracing_reader_cpumask which is used to protect trace_pipe.
>
> detail:
>
> ring buffer serializes readers, but it is low level protection.
> The validity of the events (which returns by ring_buffer_peek() ..etc)
> are not protected by ring buffer.
>
> The content of events may become garbage if we allow other process consumes
> these events concurrently:
> A) the page of the consumed events may become a normal page
> (not reader page) in ring buffer, and this page will be rewrited
> by events producer.
> B) The page of the consumed events may become a page for splice_read,
> and this page will be returned to system.
>
> This patch adds trace_access_lock() and trace_access_unlock() primitives.
>
> These primitives allow multi process access to different cpu ring buffer
> concurrently.
>
> These primitives don't distinguish read-only and read-consume access.
> Multi read-only access are also serialized.
>
> And we don't use these primitives when we open files,
> we only use them when we read files.
>
> Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>


I queue this up with your other pending patches for .34

Thanks!

-- Steve




\
 
 \ /
  Last update: 2010-01-06 16:31    [from the cache]
©2003-2011 Jasper Spaans