linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Frederic Weisbecker <fweisbec@gmail.com>
To: Peter Zijlstra <peterz@infradead.org>
Cc: Hitoshi Mitake <mitake@dcl.info.waseda.ac.jp>,
	linux-kernel@vger.kernel.org, mingo@elte.hu, paulus@samba.org,
	tglx@linutronix.de, gregkh@suse.de
Subject: Re: [PATCH] Add type of locks to lock trace events
Date: Fri, 29 Jan 2010 18:29:41 +0100	[thread overview]
Message-ID: <20100129172939.GD5047@nowhere> (raw)
In-Reply-To: <1264674113.4283.2086.camel@laptop>

On Thu, Jan 28, 2010 at 11:21:53AM +0100, Peter Zijlstra wrote:
> On Tue, 2010-01-26 at 14:56 +0900, Hitoshi Mitake wrote:
> > # Sorry, I wrote wrong Cc address. Previous mail was rejected by mailer-daemon.
> > # This is second time sending, if you already received this, please discard it...
> > 
> > There's no need to add any member to lockdep_map
> > for adding information of type of locks to lock trace events.
> > 
> > Example of perf trace:
> > |       init-0     [001]   335.078670: lock_acquired: 0xffff8800059d6bd8 &rq->lock kernel/lockdep.c:2973 (0 ns)
> > |       rb_consumer-424   [001]   335.078673: lock_acquire: 0xffff8800059d6bd8 1 &rq->lock kernel/lockdep.c:2973
> > |                                                                            # ^ &rq->lock is spin lock!
> > |       rb_consumer-424   [001]   335.078677: lock_acquire: 0xffff8800bba5e8e8 1 buffer->reader_lock_key kernel/trace/ring_
> > |       rb_consumer-424   [001]   335.078679: lock_acquired: 0xffff8800bba5e8e8 buffer->reader_lock_key kernel/trace/ring_b
> > |       rb_consumer-424   [001]   335.078684: lock_acquire: 0xffff8800059d12e8 1 &q->lock kernel/smp.c:83
> > 
> > Of course, as you told, type of lock dealing with is clear for human.
> > But it is not clear for programs like perf lock.
> > 
> > What I want to do is limiting types of lock focus on.
> > e.g. perf lock prof --type spin,rwlock
> > 
> > How do you think, Peter?
> 
> I still don't see the use for it, surely you're going to be familiar
> with the code if you're looking at lock statistics?



Comparing the avg/max time locks are acquired/waited between same
types of locks is interesting, but doing so between spinlocks and mutexes
is definetly pointless.

spinlocks will always be in the bottom of the report while their measures
should be taken in an utterly different order of magnitude.

Each lock nature should be reported separately. An rwlock won't have
the same behaviour pattern than a spinlock. It may spin less in average
but more in the maximum snapshot, and still that depends on a write_lock
or a read_lock operations.

That said I don't think this is the right approach. We only need this
information when the lock is initialized. That's the same for the
file and line things, especially since these add 1/5 more overhead.
And that's even the same for the name of the lock.

Actually we need a lock_init event that brings:

- lock addr
- lock name
- lock type
- file/line

This can be triggered on spinlock_init(), mutex_init(), etc..
for the dynamic cases and use a synthetize_lock_events()
from perf tools that could work toward events injection
through perf ioctl, for the static cases.
Or/and we could use a debugfs file for that, otherwise only
perf will be able to use the lock events. Or this can be
an event injection from ftrace.

And all other lock events should not be giving anymore the
name, type, or file/line. We should deduce it from the
lock_init events and the lock addr in each lock events.

I think this becomes critical, given the high overhead nature
of lock events and their impact in profiling them.


  reply	other threads:[~2010-01-29 17:36 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-16  3:28 [PATCH 1/2] perf: Add util/include/linuxhash.h to include hash.h of kernel Hitoshi Mitake
2009-12-16  3:28 ` [PATCH 2/2] perf lock: Fix output of tracing lock events Hitoshi Mitake
2009-12-16  8:19   ` [tip:perf/lock] " tip-bot for Hitoshi Mitake
2009-12-17  8:50   ` [PATCH 2/2] " Ingo Molnar
2009-12-17  9:24   ` Peter Zijlstra
2009-12-17 10:09     ` Ingo Molnar
2009-12-17 10:26       ` Peter Zijlstra
2009-12-17 10:51         ` Ingo Molnar
2009-12-26 13:43     ` Hitoshi Mitake
2009-12-28 10:01       ` Peter Zijlstra
2009-12-31 13:24         ` Hitoshi Mitake
2010-01-07 10:38           ` Hitoshi Mitake
2010-01-07 10:39             ` [PATCH 0/5] lockdep: Add information of file and line to lockdep_map Hitoshi Mitake
2010-01-13  9:52               ` Peter Zijlstra
2010-01-13 10:09                 ` Ingo Molnar
2010-01-16 13:01                 ` Hitoshi Mitake
2010-01-18  7:20                   ` Peter Zijlstra
2010-01-26  5:56                     ` [PATCH] Add type of locks to lock trace events Hitoshi Mitake
2010-01-28 10:21                       ` Peter Zijlstra
2010-01-29 17:29                         ` Frederic Weisbecker [this message]
2010-01-29 17:41                           ` Peter Zijlstra
2010-01-29 22:12                             ` Frederic Weisbecker
2010-02-24  9:02                               ` [PATCH] Separate lock events with types Hitoshi Mitake
2010-03-26 23:33                                 ` Frederic Weisbecker
2010-04-05 10:37                                   ` Hitoshi Mitake
2010-04-06  8:26                                   ` Peter Zijlstra
2010-04-06  9:44                                     ` Frederic Weisbecker
2010-01-07 10:39             ` [PATCH 1/5] lockdep: Add file and line to initialize sequence of spin and rw lock Hitoshi Mitake
2010-01-07 10:39             ` [PATCH 2/5] lockdep: Add file and line to initialize sequence of rwsem Hitoshi Mitake
2010-01-07 10:39             ` [PATCH 3/5] " Hitoshi Mitake
2010-01-07 10:39             ` [PATCH 4/5] lockdep: Add file and line to initialize sequence of mutex Hitoshi Mitake
2010-01-07 10:39             ` [PATCH 5/5] lockdep: Fix the way to initialize class_mutex for information of file and line Hitoshi Mitake
2010-01-13 10:00               ` Ingo Molnar
2010-01-13 23:17                 ` Greg KH
2010-01-13 23:19                   ` Greg KH
2010-01-16 12:55                     ` Hitoshi Mitake
2009-12-16  8:18 ` [tip:perf/lock] perf: Add util/include/linuxhash.h to include hash.h of kernel tip-bot for Hitoshi Mitake

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=20100129172939.GD5047@nowhere \
    --to=fweisbec@gmail.com \
    --cc=gregkh@suse.de \
    --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=tglx@linutronix.de \
    /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;
as well as URLs for NNTP newsgroup(s).