public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
To: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Hitoshi Mitake <mitake@dcl.info.waseda.ac.jp>,
	Jason Baron <jbaron@redhat.com>,
	Steven Rostedt <rostedt@goodmis.org>, Ingo Molnar <mingo@elte.hu>,
	Peter Zijlstra <peterz@infradead.org>,
	linux-kernel@vger.kernel.org, h.mitake@gmail.com,
	Paul Mackerras <paulus@samba.org>,
	Arnaldo Carvalho de Melo <acme@redhat.com>,
	Jens Axboe <jens.axboe@oracle.com>
Subject: Re: [PATCH RFC 00/11] lock monitor: Separate features related to lock
Date: Thu, 18 Mar 2010 21:08:57 -0400	[thread overview]
Message-ID: <20100319010857.GC23020@Krystal> (raw)
In-Reply-To: <20100318211633.GG5103@nowhere>

* Frederic Weisbecker (fweisbec@gmail.com) wrote:
> On Thu, Mar 18, 2010 at 02:59:29PM +0900, Hitoshi Mitake wrote:
> > On 03/17/10 18:52, Ingo Molnar wrote:
> > >
> > > * Frederic Weisbecker<fweisbec@gmail.com>  wrote:
> > >
> > >>> You add chained indirect calls into all lock ops, that's got to hurt.
> > >>
> > >> Well, the idea was not bad at the first glance. It was separating  
> > lockdep
> > >> and lock events codes.
> > >>
> > >> But indeed, the indirect calls plus the locking are not good for such 
> > a fast
> > >> path.
> > >
> > > What would be nice to have is some sort of dynamic patching approach  
> > to enable
> > > _both_ lockdep, lockstat and perf lock.
> > >
> > > If TRACE_EVENT() tracepoints were patchable we could use them. (but  
> > they arent
> > > right now)
> >
> > I'll try it!
> 
> 
> 
> I sometimes wonder which trick between jmp optimization and hot patching
> would be the best to optimize the tracepoints off-cases.
> 
> I should look more closely at the jmp optimization. I don't know if
> it avoids to push the tracepoints parameters in the off case, in
> which case it could be perhaps more efficient than hot patching,

yep, tracepoints with jump patching will branch over the whole stack setup in
the off case, which is one of the good reasons for using this solution over
patching only a call (leaving the stack setup in place).

Note that if the parameters include side-effects (such as a function call),
these will be executed even when the tracepoint is disabled. This is why people
should implement these calls with side-effects in the appropriate TRACE_EVENT
fields.

> although perhaps most of the time the given arguments are already in
> registers because the traced function uses them for its own needs.
> 
> Also, adopting hot patching means the tracepoint calls would be
> in a non-inlined separated function. The result would be probably
> less i-cache footprint from the caller, and better for the off-case,
> worse for the on-case. But tracing off-case is most important.
> 
> (Adding more people in Cc)
> 

The idea has been discussed to add support in gcc to emit the code for an
unlikely branch into a separate section, which does have the smaller cache-line
footprint benefit your are talking about, but without the overhead of the extra
out-of-line function call in the enabled case. I don't know how this work is
advanced though. We had determined that the "asm goto" was an higher priority
item.

Thanks,

Mathieu

> 
> > And I have a question related to this dynamic patching approach for lockdep.
> > If dynamic proving turning on/off is provided,
> > lockdep will be confused by inconsistency of lock acquiring log.
> >
> > Will the sequence,
> >
> > lock_acquire(l) -> turning off -> lock_release(l) -> turning on ->  
> > lock_acquire(l)
> >
> > detected as double acquiring?
> >
> > Should turning on/off lockdep be done in the time
> > when every processes have no lock?
> 
> 
> There is almost always a process with a lock somewhere ;-)
> 
> This is not a big deal, it's very similar to unfinished scenarios
> due to the end of the tracing that can happen anytime and you miss
> a lock_release or whatever. We can also begin the tracing anytime,
> and you may receive orphan lock_release in the very beginning
> because you missed the lock_acquire that happened before the tracing.
> 
> Any locking scenario that doesn't fit into the state machine
> or is incomplete must be considered as broken and then ignored.
> 

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

  reply	other threads:[~2010-03-19  1:09 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-14 10:38 [PATCH RFC 00/11] lock monitor: Separate features related to lock Hitoshi Mitake
2010-03-14 10:38 ` [PATCH RFC 01/11] lock monitor: New subsystem for lock event hooking Hitoshi Mitake
2010-03-14 10:38 ` [PATCH RFC 02/11] Adopt lockdep to lock monitor Hitoshi Mitake
2010-03-14 10:38 ` [PATCH RFC 03/11] Adopt spinlock " Hitoshi Mitake
2010-03-14 10:38 ` [PATCH RFC 04/11] Adopt rwlock " Hitoshi Mitake
2010-03-14 10:38 ` [PATCH RFC 05/11] Adopt arch dependent rwsem " Hitoshi Mitake
2010-03-14 10:38 ` [PATCH RFC 06/11] Adopt rwsem of x86 " Hitoshi Mitake
2010-03-14 10:38 ` [PATCH RFC 07/11] Adopt the way of initializing semaphore " Hitoshi Mitake
2010-03-14 10:38 ` [PATCH RFC 08/11] Adopt mutex " Hitoshi Mitake
2010-03-14 10:38 ` [PATCH RFC 09/11] Adopt rcu_read_lock() " Hitoshi Mitake
2010-03-14 10:38 ` [PATCH RFC 10/11] Adopt kernel/sched.c " Hitoshi Mitake
2010-03-14 10:38 ` [PATCH RFC 11/11] Very dirty temporal solution for testing " Hitoshi Mitake
2010-03-14 18:13 ` [PATCH RFC 00/11] lock monitor: Separate features related to lock Peter Zijlstra
2010-03-17  1:32   ` Frederic Weisbecker
2010-03-17  7:30     ` Hitoshi Mitake
2010-03-17 15:39       ` Frederic Weisbecker
2010-03-18  5:49         ` Hitoshi Mitake
2010-03-18 20:30           ` Frederic Weisbecker
2010-03-20  5:51             ` Hitoshi Mitake
2010-03-23 15:45         ` Peter Zijlstra
2010-03-17  9:52     ` Ingo Molnar
2010-03-17 13:59       ` Jason Baron
2010-03-18  5:59       ` Hitoshi Mitake
2010-03-18 21:16         ` Frederic Weisbecker
2010-03-19  1:08           ` Mathieu Desnoyers [this message]
2010-03-19  1:23             ` Frederic Weisbecker
2010-03-19  1:36               ` Mathieu Desnoyers
2010-03-19  2:27                 ` Frederic Weisbecker
2010-03-19  2:40                   ` Mathieu Desnoyers
2010-03-19  3:06                     ` Frederic Weisbecker
2010-03-19 12:56                       ` Mathieu Desnoyers
2010-03-19 16:00                         ` Jason Baron
2010-03-20  4:51                           ` Frederic Weisbecker
2010-03-20  4:46                         ` Frederic Weisbecker
2010-03-20  5:56           ` Hitoshi Mitake
2010-03-20  8:23             ` Hitoshi Mitake
2010-03-21  9:49               ` Hitoshi Mitake
2010-03-23 15:32               ` Peter Zijlstra
2010-04-04  7:56                 ` Hitoshi Mitake
2010-03-17  1:47 ` Frederic Weisbecker
2010-03-17  7:33   ` Hitoshi Mitake
2010-03-17  9:50     ` Ingo Molnar

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=20100319010857.GC23020@Krystal \
    --to=mathieu.desnoyers@efficios.com \
    --cc=acme@redhat.com \
    --cc=fweisbec@gmail.com \
    --cc=h.mitake@gmail.com \
    --cc=jbaron@redhat.com \
    --cc=jens.axboe@oracle.com \
    --cc=linux-kernel@vger.kernel.org \
    --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