Re: [PATCH -v2] tracing: lockdep tracepoints

From: Steven Rostedt
Date: Wed Mar 04 2009 - 08:07:20 EST



On Wed, 4 Mar 2009, Frederic Weisbecker wrote:
> >
>
>
> The TRACE_FIELD_SPECIAL is only used in case of complex assignment,
> those that can't be done in a simple "=" expression.
>
> All you need is simply:
>
> TRACE_FORMAT(lock_contended,
> TPPROTO(struct lockdep_map *lock, unsigned long ip),
> TPARGS(lock, ip),
> TPFMT("%s", lock->name)
> TRACE_STRUCT(
> TRACE_FIELD(char *, name, lock->name)
> )
> TPRAWFMT("%s");
> );


Nope, that wont work :-( If this is saved to userspace, all the user
would have is some hex value. If they have a copy of the vmlinux image,
then they could probably translate that value, unless it was a module.

Perhaps something like:

TRACE_EVENT_FORMAT(lock_contended,
TPPROTO(struct lockdep_map *lock, unsigned long ip),
TPARGS(lock, ip),
TPFMT("%s", lock->name);
TRACE_STRUCT(
TRACE_FIELD_SPECIAL(char name[16], name,
strncpy(name, lock->name, 16));
),
TPRAWFMT("%s")
);

This would require those 16 bytes to be copied with the raw format, but
then we would always have the name (first 16 bytes anyway) for later use.

-- Steve

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/