aboutsummaryrefslogtreecommitdiff
path: root/init/main.c
diff options
context:
space:
mode:
authorLai Jiangshan2010-01-06 20:08:50 +0800
committerSteven Rostedt2010-01-06 12:51:34 -0500
commit7e53bd42d14c75192b99674c40fcc359392da59d (patch)
tree65c3638604a2c03947da5cbd7ffb3e4dfee66370 /init/main.c
parent0fa0edaf32b9a78b9854f1da98d4511a501089b0 (diff)
tracing: Consolidate protection of reader access to the ring buffer
At the beginning, access to the ring buffer was 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 serialized. And removes tracing_reader_cpumask which is used to protect trace_pipe. Details: 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 another process to consume 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 rewritten by the 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 buffers concurrently. These primitives don't distinguish read-only and read-consume access. Multi read-only access is 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> LKML-Reference: <4B447D52.1050602@cn.fujitsu.com> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Diffstat (limited to 'init/main.c')
0 files changed, 0 insertions, 0 deletions