[lttng-dev] notrace missing in lttng-ust

Woegerer, Paul Paul_Woegerer at mentor.com
Tue Jul 3 03:45:33 EDT 2012


Hi Mathieu,

here is the revised patch that makes tracepoint.h and 
ust-tracepoint-event.h robust against -finstrument-functions.
I tested it against our small ackermann sample (3 custom tracepoints + 
-finstrument-functions). See screenshots.

Btw, nice macro metaprogramming in ust-tracepoint-event.h :)

Thanks,
Paul

On 06/30/2012 08:16 PM, Mathieu Desnoyers wrote:
> * Woegerer, Paul (Paul_Woegerer at mentor.com) wrote:
>> Hi Mathieu,
>>
>> libust 0.x uses notrace (__attribute__((no_instrument_function)) for all
>> functions that are involved in event emitting.
>>
>> For example:
>> ./libust/marker.c:122:notrace void __ust_marker_empty_function(const
>> struct ust_marker *mdata,
>> ./libust/marker.c:137:notrace void ust_marker_probe_cb(const struct
>> ust_marker *mdata,
>> ./libust/marker.c:197:static notrace void
>> ust_marker_probe_cb_noarg(const struct ust_marker *mdata,
>>
>> I just realized that this is no more the case for lttng-ust.
>> Was it a conscious decision not to use notrace for LTTng 2.0 lttng-ust,
>> or is it just missing ?
> just missing. only needed for -finstrument-functions.
>
>> I would like to have notrace also in lttng-ust, at least for the
>> _DECLARE_TRACEPOINT macro in tracepoint.h.
> I guess the probes generated by ust-tracepoint-event.h would need that
> too. A patch that adds those noinline everywhere where it's needed
> (hint: all functions called on the tracing patch within public headers
> of lttng-ust 2.0 would be a good start). Please test the patch by
> tracing a program automatically instrumented by -finstrument-functions
> and see if things blow up.
>
> Thanks,
>
> Mathieu
>
>> Like this for example:
>>
>> diff --git a/include/lttng/tracepoint.h b/include/lttng/tracepoint.h
>> index 5bab476..71665dc 100644
>> --- a/include/lttng/tracepoint.h
>> +++ b/include/lttng/tracepoint.h
>> @@ -137,6 +137,7 @@ extern "C" {
>>
>>   #define _DECLARE_TRACEPOINT(_provider, _name, ...)     \
>>   extern struct tracepoint __tracepoint_##_provider##___##_name;
>>    \
>> +static inline void
>> __tracepoint_cb_##_provider##___##_name(_TP_ARGS_PROTO(__VA_ARGS__))
>> __attribute__ ((no_instrument_function));    \
>>   static inline void
>> __tracepoint_cb_##_provider##___##_name(_TP_ARGS_PROTO(__VA_ARGS__)) \
>>   {                                            \
>>       struct tracepoint_probe *__tp_probe;                        \
>> @@ -158,12 +159,16 @@ end:     \
>>       tp_rcu_read_unlock_bp();                            \
>>   }                                            \
>>   static inline void __tracepoint_register_##_provider##___##_name(char
>> *name,        \
>> +        void (*func)(void), void *data) __attribute__
>> ((no_instrument_function));    \
>> +static inline void __tracepoint_register_##_provider##___##_name(char
>> *name,        \
>>           void (*func)(void), void *data) \
>>   {                                            \
>>       __tracepoint_probe_register(name, func, data,     \
>>           __tracepoint_##_provider##___##_name.signature); \
>>   }                                            \
>>   static inline void __tracepoint_unregister_##_provider##___##_name(char
>> *name,        \
>> +        void (*func)(void), void *data) __attribute__
>> ((no_instrument_function));    \
>> +static inline void __tracepoint_unregister_##_provider##___##_name(char
>> *name,        \
>>           void (*func)(void), void *data) \
>>   {                                            \
>>       __tracepoint_probe_unregister(name, func, data); \
>>
>> Greetings,
>> Paul
>>
>> -- 
>> Paul Woegerer | SW Development Engineer
>> Mentor Embedded(tm) | Prinz Eugen Straße 72/2/4, Vienna, 1040 Austria
>> P 43.1.535991320
>> Nucleus® | Linux® | Android(tm) | Services | UI | Multi-OS
>>
>> Android is a trademark of Google Inc. Use of this trademark is subject to Google Permissions.
>> Linux is the registered trademark of Linus Torvalds in the U.S. and other countries.
>>
>>
>> _______________________________________________
>> lttng-dev mailing list
>> lttng-dev at lists.lttng.org
>> http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev


-- 
Paul Woegerer | SW Development Engineer
Mentor Embedded(tm) | Prinz Eugen Straße 72/2/4, Vienna, 1040 Austria
P 43.1.535991320
Nucleus® | Linux® | Android(tm) | Services | UI | Multi-OS

Android is a trademark of Google Inc. Use of this trademark is subject to Google Permissions.
Linux is the registered trademark of Linus Torvalds in the U.S. and other countries.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Make-lttng-ust-robust-against-finstrument-functions.patch
Type: text/x-patch
Size: 9607 bytes
Desc: not available
URL: <http://lists.lttng.org/pipermail/lttng-dev/attachments/20120703/a3a5e770/attachment-0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ackermann_before.png
Type: image/png
Size: 32262 bytes
Desc: not available
URL: <http://lists.lttng.org/pipermail/lttng-dev/attachments/20120703/a3a5e770/attachment-0002.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ackermann_after.png
Type: image/png
Size: 14661 bytes
Desc: not available
URL: <http://lists.lttng.org/pipermail/lttng-dev/attachments/20120703/a3a5e770/attachment-0003.png>


More information about the lttng-dev mailing list