mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: Lai Jiangshan <laijs@cn.fujitsu.com>
Cc: Ingo Molnar <mingo@elte.hu>,
	Frederic Weisbecker <fweisbec@gmail.com>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] tracing: consolidate protection of reader access to the ring buffer
Date: Wed, 06 Jan 2010 10:28:07 -0500	[thread overview]
Message-ID: <1262791687.28171.2879.camel@gandalf.stny.rr.com> (raw)
In-Reply-To: <4B447D52.1050602@cn.fujitsu.com>

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



  reply	other threads:[~2010-01-06 15:28 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-06 12:08 Lai Jiangshan
2010-01-06 15:28 ` Steven Rostedt [this message]
2010-01-13 10:23 ` [tip:tracing/core] tracing: Consolidate " tip-bot for Lai Jiangshan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1262791687.28171.2879.camel@gandalf.stny.rr.com \
    --to=rostedt@goodmis.org \
    --cc=fweisbec@gmail.com \
    --cc=laijs@cn.fujitsu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®