All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo@elte.hu>
To: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Steven Rostedt <rostedt@goodmis.org>,
	Zhaolei <zhaolei@cn.fujitsu.com>,
	Tom Zanussi <tzanussi@gmail.com>, Li Zefan <lizf@cn.fujitsu.com>,
	LKML <linux-kernel@vger.kernel.org>,
	Peter Zijlstra <peterz@infradead.org>
Subject: Re: [PATCH] tracing/lockdep: turn lock->name into an array
Date: Tue, 14 Apr 2009 00:58:46 +0200	[thread overview]
Message-ID: <20090413225846.GA817@elte.hu> (raw)
In-Reply-To: <20090413224219.GK5977@nowhere>


* Frederic Weisbecker <fweisbec@gmail.com> wrote:

> On Tue, Apr 14, 2009 at 12:36:06AM +0200, Frederic Weisbecker wrote:
> > Impact: allow filtering by lock name / fix module tracing
> > 
> > Currently, the "lock acquired" event is traced using a TRACE_EVENT.
> > But we can't use the char * type for the name without risking to
> > dereference a freed pointer. A lock name can come from a module
> > towards lockdep and it is risky to only store its address because we
> > defer its name printing.
> > 
> > That's why this patch uses a fixed array size and copy the name.
> > Also it lets us filter the lock name because the event filtering
> > doesn't handle the char pointers. Such support is not needed yet since
> > the events don't use it for now because it is rarely easy to keep track
> > of a string while we defer its output.
> > 
> > Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
> > ---
> >  include/trace/lockdep_event_types.h |   13 +++++++++++--
> >  1 files changed, 11 insertions(+), 2 deletions(-)
> > 
> > diff --git a/include/trace/lockdep_event_types.h b/include/trace/lockdep_event_types.h
> > index 863f1e4..68f84f4 100644
> > --- a/include/trace/lockdep_event_types.h
> > +++ b/include/trace/lockdep_event_types.h
> > @@ -32,18 +32,27 @@ TRACE_FORMAT(lock_contended,
> >  	TP_FMT("%s", lock->name)
> >  	);
> >  
> > +#define LOCK_NAME_SIZE	25
> 
> 
> 
> This constant may look a bit weird.
> I just started with the assumption that a full lock name
> will rarely exceed this length.
> 
> If you agree with it, I will expand the conversion of lockdep
> TRACE_FORMAT to TRACE_EVENTS with the same assumption.
> So that we will be able to use filters with locks events.

Sure.

But 25 might be on the narrow side. The names come from macros and 
we do have a few cases of particularly long sequences of: 
spin_lock(&my_subsys->my_bus->my_driver->my_hw->my_object->my_lock) 
easily spanning 25 characters. And stripping will strip away the 
most useful (final) bits of the word.

	Ingo

  reply	other threads:[~2009-04-13 22:59 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-13 22:36 [PATCH] tracing/lockdep: turn lock->name into an array Frederic Weisbecker
2009-04-13 22:42 ` Frederic Weisbecker
2009-04-13 22:58   ` Ingo Molnar [this message]
2009-04-14  7:48   ` Peter Zijlstra
2009-04-14 10:27     ` Ingo Molnar
2009-04-14 21:22       ` Frederic Weisbecker
2009-04-13 23:01 ` Ingo Molnar
2009-04-14  0:24   ` Frederic Weisbecker
2009-04-14  6:35 ` KOSAKI Motohiro
2009-04-14  6:53   ` Ingo Molnar
2009-04-14  6:56     ` KOSAKI Motohiro
2009-04-14  7:20     ` Peter Zijlstra
2009-04-14 10:25       ` Ingo Molnar
2009-04-17 17:25     ` Jeremy Fitzhardinge
2009-04-17 17:27       ` Peter Zijlstra
2009-04-17 17:36         ` Steven Rostedt
2009-04-17 20:29           ` 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=20090413225846.GA817@elte.hu \
    --to=mingo@elte.hu \
    --cc=fweisbec@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lizf@cn.fujitsu.com \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.org \
    --cc=tzanussi@gmail.com \
    --cc=zhaolei@cn.fujitsu.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.