public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: linux-kernel@vger.kernel.org, Ingo Molnar <mingo@elte.hu>,
	Andrew Morton <akpm@linux-foundation.org>,
	Frederic Weisbecker <fweisbec@gmail.com>,
	Masami Hiramatsu <mhiramat@redhat.com>,
	Tom Zanussi <tzanussi@gmail.com>
Subject: Re: [PATCH 13/13 v3] tracing: Comment the use of event_mutex with trace event flags
Date: Fri, 14 May 2010 18:21:40 -0400	[thread overview]
Message-ID: <20100514222140.GA14234@Krystal> (raw)
In-Reply-To: <20100514192917.222882793@goodmis.org>

* Steven Rostedt (rostedt@goodmis.org) wrote:
> From: Steven Rostedt <srostedt@redhat.com>
> 
> The flags variable is protected by the event_mutex when modifying,
> but the event_mutex is not held when reading the variable.
> 
> This is due to the fact that the reads occur in critical sections where
> taking a mutex (or even a spinlock) is not wanted.
> 
> But the two flags that exist (enable and filter_active) have the code
> written as such to handle the reads to not need a lock.
> 
> The enable flag is used just to know if the event is enabled or not
> and its use is always under the event_mutex. Whether or not the event
> is actually enabled is really determined by the tracepoint being
> registered. The flag is just a way to let the code know if the tracepoint
> is registered.
> 
> The filter_active is different. It is read without the lock. If it
> is set, then the event probes jump to the filter code. There can be a
> slight mismatch between filters available and filter_active. If the flag is
> set but no filters are available, the code safely jumps to a filter nop.
> If the flag is not set and the filters are available, then the filters
> are skipped. This is acceptable since filters are usually set before
> tracing or they are set by humans, which would not notice the slight
> delay that this causes.
> 
> Reported-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
> Cc: Tom Zanussi <tzanussi@gmail.com>
> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
> ---
>  include/linux/ftrace_event.h |    9 ++++++++-
>  1 files changed, 8 insertions(+), 1 deletions(-)
> 
> diff --git a/include/linux/ftrace_event.h b/include/linux/ftrace_event.h
> index 5ac97a4..3578e90 100644
> --- a/include/linux/ftrace_event.h
> +++ b/include/linux/ftrace_event.h
> @@ -169,7 +169,14 @@ struct ftrace_event_call {
>  	 *   bit 1:		enabled
>  	 *   bit 2:		filter_active
>  	 *
> -	 *  Must hold event_mutex to change.
> +	 * Changes to flags must hold the event_mutex.
> +	 *
> +	 * Note: Reads of flags do not hold the event_mutex since
> +	 * they occur in critical sections. But the way flags
> +	 * is currently used, these changes do no affect the code
> +	 * except that when a change is made, it may have a slight
> +	 * delay in propagating the changes to other CPUs due to
> +	 * cacheing and such.

cacheing -> caching ?

Besides this minor nit:

Acked-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>

>  	 */
>  	unsigned int		flags;
>  
> -- 
> 1.7.0
> 
> 

-- 
Mathieu Desnoyers
Operating System Efficiency R&D Consultant
EfficiOS Inc.
http://www.efficios.com

  reply	other threads:[~2010-05-14 22:21 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-14 19:22 [PATCH 00/13 v3] [GIT PULL] tracing: shrinking trace events and updates Steven Rostedt
2010-05-14 19:22 ` [PATCH 01/13 v3] tracing: Create class struct for events Steven Rostedt
2010-05-14 19:22 ` [PATCH 02/13 v3] tracepoints: Add check trace callback type Steven Rostedt
2010-05-14 19:22 ` [PATCH 03/13 v3] tracing: Let tracepoints have data passed to tracepoint callbacks Steven Rostedt
2010-05-14 19:22 ` [PATCH 04/13 v3] tracing: Remove per event trace registering Steven Rostedt
2010-05-14 19:22 ` [PATCH 05/13 v3] tracing: Move fields from event to class structure Steven Rostedt
2010-05-18  4:51   ` Li Zefan
2010-05-14 19:22 ` [PATCH 06/13 v3] tracing: Move raw_init from events to class Steven Rostedt
2010-05-14 19:22 ` [PATCH 07/13 v3] tracing: Allow events to share their print functions Steven Rostedt
2010-05-14 19:22 ` [PATCH 08/13 v3] tracing: Move print functions into event class Steven Rostedt
2010-05-14 19:22 ` [PATCH 09/13 v3] tracing: Remove duplicate id information in event structure Steven Rostedt
2010-05-14 19:22 ` [PATCH 10/13 v3] tracing: Combine event filter_active and enable into single flags field Steven Rostedt
2010-05-14 19:22 ` [PATCH 11/13 v3] tracing: Fix function declarations if !CONFIG_STACKTRACE Steven Rostedt
2010-05-14 19:22 ` [PATCH 12/13 v3] ring-buffer: Add cached pages when freeing reader page Steven Rostedt
2010-05-14 22:26   ` Mathieu Desnoyers
2010-05-15  1:06     ` Steven Rostedt
2010-05-14 19:22 ` [PATCH 13/13 v3] tracing: Comment the use of event_mutex with trace event flags Steven Rostedt
2010-05-14 22:21   ` Mathieu Desnoyers [this message]
2010-05-15  0:44     ` Steven Rostedt

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=20100514222140.GA14234@Krystal \
    --to=mathieu.desnoyers@efficios.com \
    --cc=akpm@linux-foundation.org \
    --cc=fweisbec@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mhiramat@redhat.com \
    --cc=mingo@elte.hu \
    --cc=rostedt@goodmis.org \
    --cc=tzanussi@gmail.com \
    /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