Re: [PATCH -v2] tracing: lockdep tracepoints

From: Peter Zijlstra
Date: Wed Mar 04 2009 - 08:02:11 EST


On Wed, 2009-03-04 at 13:12 +0100, 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");
> );

As discussed on IRC, that won't actually work. In generic, you cannot
assume the string is stable, in my particular case it would work, since
lock->name is a compile time constant, except for modules, who will
still ruin that.

So I think something like TRACE_FIELD_STRING() is called for. Not sure
how to integrate a variable length field like that with the static
format description though. Maybe use offsets from the start of the
object as string pointers, so you can place the variable sized bits
after the static bits.



--
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/