public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Frederic Weisbecker <fweisbec@gmail.com>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@elte.hu>, LKML <linux-kernel@vger.kernel.org>,
	Arnaldo Carvalho de Melo <acme@redhat.com>,
	Paul Mackerras <paulus@samba.org>,
	Hitoshi Mitake <mitake@dcl.info.waseda.ac.jp>,
	Li Zefan <lizf@cn.fujitsu.com>,
	Lai Jiangshan <laijs@cn.fujitsu.com>,
	Masami Hiramatsu <mhiramat@redhat.com>,
	Jens Axboe <jens.axboe@oracle.com>
Subject: Re: [PATCH 02/11] tracing: Introduce TRACE_EVENT_INJECT
Date: Sat, 6 Feb 2010 13:20:07 +0100	[thread overview]
Message-ID: <20100206122004.GF5062@nowhere> (raw)
In-Reply-To: <1265382452.24386.38.camel@gandalf.stny.rr.com>

On Fri, Feb 05, 2010 at 10:07:32AM -0500, Steven Rostedt wrote:
> How would it be dumping all?
> 
> You need to pick an event to register, not all events will do this.
> 
> How is this different than defining a TRACE_EVENT_INJECT()?  Now
> lock_class_init will always call this inject.
> 
> What I am proposing is to add the lock_class_init just as TRACE_EVENT()
> and then in a initcall, do:
> 
> register_event_command("lock_class_init", NULL, NULL, inject_me, 
> 			inject_me, data);
> 
> The above would have lock_class_init, when enabled or disabled call
> inject_me. Isn't that exactly what the TRACE_EVENT_INJECT() is doing?
> 
> I have no qualms about adding lock_class_init, I just don't think we
> need another TRACE_EVENT macro, that is very inflexible. I rather
> consolidate the macros in ftrace.h than be adding new ones.


This won't work for perf needs because:

1) we need this call to be asynchronous, ie: called whenever we
   want.

Basically, the injection of this event is required for other
lock events to be understandable. It is split in two parts:

* a normal trace event, synchronous, that has a normal trace_* thing
  call site. This tracks the new lock classes created.
* an asynchronous point that catch up with old events we need.

These two parts cover all lock init events we need.

But there is a reason I haven't made this injection callback something
we call once the event gets enabled (I had a first version using
TRACE_EVENT_CALLBACK, but it didn't work), because when perf registers
a trace event, it is not yet scheduled in, not at the same time but
a bit after (it's even more complicated from perf tools as we
create every events as disabled first and enable them later).

So if you call the injector right after registering a user for
the trace event, the injected events will be refused by perf,
as it is not yet set up in the context.

This is why perf needs to choose the time when this injector
is called.

2) we don't want to call that for every lock init events
   registered

We create one lock_init perf event per cpu, only one will need
to call this injector. We just need to catch up with old events
only once.


3) perf and ftrace need the same injector callback here.

4) but ftrace needs this callback to be called when the event gets
enabled (otherwise, other lock init events just don't make sense).

I agree with you that creating a new trace event macro is a bit
insane. ftrace.h is already a nightmare. I just thought that
having the injector set inside the same macro that the synchronous
event is defined helped to make it clear about its nature: that
it needs a secondary async catch up thing.

But a register_event_injector thing will work too, we probably
better want that, given the maintainance pain otherwise.

I really would like to make something useful for everyone, could
you tell me more about johill needs?

Thanks.


  reply	other threads:[~2010-02-06 12:20 UTC|newest]

Thread overview: 55+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-03  9:14 [RFC GIT PULL] perf/trace/lock optimization/scalability improvements Frederic Weisbecker
2010-02-03  9:14 ` [PATCH 01/11] tracing: Add lock_class_init event Frederic Weisbecker
2010-02-03  9:14 ` [PATCH 02/11] tracing: Introduce TRACE_EVENT_INJECT Frederic Weisbecker
2010-02-05 14:08   ` Steven Rostedt
2010-02-05 14:47   ` Steven Rostedt
2010-02-05 14:53     ` Peter Zijlstra
2010-02-05 15:07       ` Steven Rostedt
2010-02-06 12:20         ` Frederic Weisbecker [this message]
2010-02-06 13:19           ` Steven Rostedt
2010-02-10 10:04             ` Frederic Weisbecker
2010-02-10 14:05               ` Steven Rostedt
2010-02-11 18:57                 ` Frederic Weisbecker
2010-02-11 19:23                   ` Steven Rostedt
2010-02-03  9:14 ` [PATCH 03/11] tracing: Inject lock_class_init events on registration Frederic Weisbecker
2010-02-05 14:13   ` Steven Rostedt
2010-02-05 14:30     ` Peter Zijlstra
2010-02-05 14:44       ` Steven Rostedt
2010-02-03  9:14 ` [PATCH 04/11] tracing: Add lock class id in lock_acquire event Frederic Weisbecker
2010-02-03  9:14 ` [PATCH 05/11] perf: New PERF_EVENT_IOC_INJECT ioctl Frederic Weisbecker
2010-02-03  9:19   ` Frederic Weisbecker
2010-02-03  9:14 ` [PATCH 06/11] perf: Handle injection ioctl with trace events Frederic Weisbecker
2010-02-03  9:14 ` [PATCH 07/11] perf: Handle injection iotcl for tracepoints from perf record Frederic Weisbecker
2010-02-03  9:14 ` [PATCH 08/11] perf/lock: Add support for lock_class_init events Frederic Weisbecker
2010-02-03  9:14 ` [PATCH 09/11] tracing: Remove the lock name from most lock events Frederic Weisbecker
2010-02-03  9:14 ` [PATCH 10/11] tracing/perf: Fix lock events recursions in the fast path Frederic Weisbecker
2010-02-04 15:47   ` Paul E. McKenney
2010-02-05  2:38     ` Lai Jiangshan
2010-02-05  9:45       ` Peter Zijlstra
2010-02-05  9:50         ` Peter Zijlstra
2010-02-05 10:49           ` Ingo Molnar
2010-02-05 12:10             ` Peter Zijlstra
2010-02-05 12:12               ` Peter Zijlstra
2010-02-05 13:01                 ` Peter Zijlstra
2010-02-06 11:12                   ` Frederic Weisbecker
2010-02-06 11:24                     ` Peter Zijlstra
2010-02-06 11:40                       ` Frederic Weisbecker
2010-02-06 14:17                         ` Peter Zijlstra
2010-02-06 16:10                           ` Frederic Weisbecker
2010-02-07  9:45                             ` Peter Zijlstra
2010-02-10 10:17                               ` Frederic Weisbecker
2010-02-28 22:24                   ` Frederic Weisbecker
2010-02-03  9:14 ` [PATCH 11/11] perf lock: Drop the buffers multiplexing dependency Frederic Weisbecker
2010-02-03 10:25 ` [RFC GIT PULL] perf/trace/lock optimization/scalability improvements Jens Axboe
2010-02-03 20:50   ` Frederic Weisbecker
2010-02-03 21:21     ` Jens Axboe
2010-02-03 22:13       ` Frederic Weisbecker
2010-02-04 19:40     ` Jens Axboe
2010-02-06 10:37       ` Frederic Weisbecker
2010-02-03 10:26 ` Ingo Molnar
2010-02-03 21:26   ` Frederic Weisbecker
2010-02-03 10:33 ` Peter Zijlstra
2010-02-03 22:07   ` Frederic Weisbecker
2010-02-04  6:33     ` Ingo Molnar
2010-02-07 17:10     ` Peter Zijlstra
2010-02-10 10:49       ` Frederic Weisbecker

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=20100206122004.GF5062@nowhere \
    --to=fweisbec@gmail.com \
    --cc=acme@redhat.com \
    --cc=jens.axboe@oracle.com \
    --cc=laijs@cn.fujitsu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lizf@cn.fujitsu.com \
    --cc=mhiramat@redhat.com \
    --cc=mingo@elte.hu \
    --cc=mitake@dcl.info.waseda.ac.jp \
    --cc=paulus@samba.org \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.org \
    /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