Messages in this thread | | | Date | Tue, 14 Apr 2009 00:58:46 +0200 | From | Ingo Molnar <> | Subject | Re: [PATCH] tracing/lockdep: turn lock->name into an array |
| |
* 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
| |