[ltt-dev] Why init needs pthread mutex in libust?

Mathieu Desnoyers compudj at krystal.dyndns.org
Tue May 24 08:35:51 EDT 2011


* Robert (rsm219 at gmail.com) wrote:
> Hello list,
> 
> I am trying to understand the code of libust, and there are some questions.
> 
> 1. How is *libust* executed? Why it can execute before the *main* function
> of an application?

library constructor. See the gcc __attribute__((constructor)) function
attribute.

> 2. Why *init* needs pthread *mutex*? I check the code and execution, it
> seems that *ltt_trace_alloc* and *ltt_trace_start* are totally
> serialized.

Which version/file/lineno are you refering to ?

>      Also, currently there is only one trace (with the name of *ust*) in the
> list *ltt_traces.head*, right?

This is going to change this summer. Multi-tracing-session work is on
its way.

> In the code, there are only two places that
> modify the list, one is in *ltt_trace_alloc*, and the other happens in
> destroying traces. But in execution they are serialized with other read to
> the list during execution, then why we need *rcu_read_lock* and *
> synchronize_rcu* there?

To synchronize with respect to tracing probes which only use
rcu_read_lock/unlock.

Thanks,

Mathieu

> 
> Maybe stupid questions, but if you guys can kindly answer them I will
> appreciate it.
> 
> Thanks.
> 
> -- *Robert*
> *
> *

> _______________________________________________
> ltt-dev mailing list
> ltt-dev at lists.casi.polymtl.ca
> http://lists.casi.polymtl.ca/cgi-bin/mailman/listinfo/ltt-dev


-- 
Mathieu Desnoyers
Operating System Efficiency R&D Consultant
EfficiOS Inc.
http://www.efficios.com




More information about the lttng-dev mailing list