[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1262791687.28171.2879.camel@gandalf.stny.rr.com>
Date: Wed, 06 Jan 2010 10:28:07 -0500
From: Steven Rostedt <rostedt@...dmis.org>
To: Lai Jiangshan <laijs@...fujitsu.com>
Cc: Ingo Molnar <mingo@...e.hu>,
Frederic Weisbecker <fweisbec@...il.com>,
LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] tracing: consolidate protection of reader access to
the ring buffer
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@...fujitsu.com>
I queue this up with your other pending patches for .34
Thanks!
-- Steve
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists