2 * Copyright (C) 2008-2011 Mathieu Desnoyers
3 * Copyright (C) 2009 Pierre-Marc Fournier
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation;
8 * version 2.1 of the License.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 * Ported to userspace by Pierre-Marc Fournier.
28 #include <urcu/arch.h>
30 #include <urcu/hlist.h>
31 #include <urcu/uatomic.h>
32 #include <urcu/compiler.h>
33 #include <urcu/system.h>
35 #include <lttng/tracepoint.h>
36 #include <lttng/ust-abi.h> /* for LTTNG_UST_SYM_NAME_LEN */
38 #include <usterr-signal-safe.h>
41 #include "tracepoint-internal.h"
42 #include "lttng-tracer-core.h"
46 /* Test compiler support for weak symbols with hidden visibility. */
47 int __tracepoint_test_symbol1
__attribute__((weak
, visibility("hidden")));
48 void *__tracepoint_test_symbol2
__attribute__((weak
, visibility("hidden")));
51 } __tracepoint_test_symbol3
__attribute__((weak
, visibility("hidden")));
53 /* Set to 1 to enable tracepoint debug output */
54 static const int tracepoint_debug
;
55 static int initialized
;
56 static void (*new_tracepoint_cb
)(struct lttng_ust_tracepoint
*);
59 * tracepoint_mutex nests inside UST mutex.
61 * Note about interaction with fork/clone: UST does not hold the
62 * tracepoint mutex across fork/clone because it is either:
63 * - nested within UST mutex, in which case holding the UST mutex across
65 * - taken by a library constructor, which should never race with a
66 * fork/clone if the application is expected to continue running with
67 * the same memory layout (no following exec()).
69 static pthread_mutex_t tracepoint_mutex
= PTHREAD_MUTEX_INITIALIZER
;
72 * libraries that contain tracepoints (struct tracepoint_lib).
73 * Protected by tracepoint mutex.
75 static CDS_LIST_HEAD(libs
);
78 * The tracepoint mutex protects the library tracepoints, the hash table, and
80 * All calls to the tracepoint API must be protected by the tracepoint mutex,
81 * excepts calls to tracepoint_register_lib and
82 * tracepoint_unregister_lib, which take the tracepoint mutex themselves.
86 * Tracepoint hash table, containing the active tracepoints.
87 * Protected by tracepoint mutex.
89 #define TRACEPOINT_HASH_BITS 12
90 #define TRACEPOINT_TABLE_SIZE (1 << TRACEPOINT_HASH_BITS)
91 static struct cds_hlist_head tracepoint_table
[TRACEPOINT_TABLE_SIZE
];
93 static CDS_LIST_HEAD(old_probes
);
94 static int need_update
;
98 * It is used to to delay the free of multiple probes array until a quiescent
100 * Tracepoint entries modifications are protected by the tracepoint mutex.
102 struct tracepoint_entry
{
103 struct cds_hlist_node hlist
;
104 struct lttng_ust_tracepoint_probe
*probes
;
105 int refcount
; /* Number of times armed. 0 if disarmed. */
106 int callsite_refcount
; /* how many libs use this tracepoint */
107 const char *signature
;
113 struct cds_list_head list
;
114 /* Field below only used for call_rcu scheme */
115 /* struct rcu_head head; */
117 struct lttng_ust_tracepoint_probe probes
[0];
121 * Callsite hash table, containing the tracepoint call sites.
122 * Protected by tracepoint mutex.
124 #define CALLSITE_HASH_BITS 12
125 #define CALLSITE_TABLE_SIZE (1 << CALLSITE_HASH_BITS)
126 static struct cds_hlist_head callsite_table
[CALLSITE_TABLE_SIZE
];
128 struct callsite_entry
{
129 struct cds_hlist_node hlist
; /* hash table node */
130 struct cds_list_head node
; /* lib list of callsites node */
131 struct lttng_ust_tracepoint
*tp
;
134 /* coverity[+alloc] */
135 static void *allocate_probes(int count
)
137 struct tp_probes
*p
=
138 zmalloc(count
* sizeof(struct lttng_ust_tracepoint_probe
)
139 + sizeof(struct tp_probes
));
140 return p
== NULL
? NULL
: p
->probes
;
143 /* coverity[+free : arg-0] */
144 static void release_probes(void *old
)
147 struct tp_probes
*tp_probes
= caa_container_of(old
,
148 struct tp_probes
, probes
[0]);
154 static void debug_print_probes(struct tracepoint_entry
*entry
)
158 if (!tracepoint_debug
|| !entry
->probes
)
161 for (i
= 0; entry
->probes
[i
].func
; i
++)
162 DBG("Probe %d : %p", i
, entry
->probes
[i
].func
);
166 tracepoint_entry_add_probe(struct tracepoint_entry
*entry
,
167 void (*probe
)(void), void *data
)
170 struct lttng_ust_tracepoint_probe
*old
, *new;
174 return ERR_PTR(-EINVAL
);
176 debug_print_probes(entry
);
179 /* (N -> N+1), (N != 0, 1) probes */
180 for (nr_probes
= 0; old
[nr_probes
].func
; nr_probes
++)
181 if (old
[nr_probes
].func
== probe
&&
182 old
[nr_probes
].data
== data
)
183 return ERR_PTR(-EEXIST
);
185 /* + 2 : one for new probe, one for NULL func */
186 new = allocate_probes(nr_probes
+ 2);
188 return ERR_PTR(-ENOMEM
);
191 nr_probes
* sizeof(struct lttng_ust_tracepoint_probe
));
192 new[nr_probes
].func
= probe
;
193 new[nr_probes
].data
= data
;
194 new[nr_probes
+ 1].func
= NULL
;
195 entry
->refcount
= nr_probes
+ 1;
197 debug_print_probes(entry
);
202 tracepoint_entry_remove_probe(struct tracepoint_entry
*entry
,
203 void (*probe
)(void), void *data
)
205 int nr_probes
= 0, nr_del
= 0, i
;
206 struct lttng_ust_tracepoint_probe
*old
, *new;
211 return ERR_PTR(-ENOENT
);
213 debug_print_probes(entry
);
214 /* (N -> M), (N > 1, M >= 0) probes */
216 for (nr_probes
= 0; old
[nr_probes
].func
; nr_probes
++) {
217 if (old
[nr_probes
].func
== probe
&&
218 old
[nr_probes
].data
== data
)
223 if (nr_probes
- nr_del
== 0) {
224 /* N -> 0, (N > 1) */
225 entry
->probes
= NULL
;
227 debug_print_probes(entry
);
231 /* N -> M, (N > 1, M > 0) */
233 new = allocate_probes(nr_probes
- nr_del
+ 1);
235 return ERR_PTR(-ENOMEM
);
236 for (i
= 0; old
[i
].func
; i
++)
237 if (old
[i
].func
!= probe
|| old
[i
].data
!= data
)
239 new[nr_probes
- nr_del
].func
= NULL
;
240 entry
->refcount
= nr_probes
- nr_del
;
243 debug_print_probes(entry
);
248 * Get tracepoint if the tracepoint is present in the tracepoint hash table.
249 * Must be called with tracepoint mutex held.
250 * Returns NULL if not present.
252 static struct tracepoint_entry
*get_tracepoint(const char *name
)
254 struct cds_hlist_head
*head
;
255 struct cds_hlist_node
*node
;
256 struct tracepoint_entry
*e
;
257 size_t name_len
= strlen(name
);
260 if (name_len
> LTTNG_UST_SYM_NAME_LEN
- 1) {
261 WARN("Truncating tracepoint name %s which exceeds size limits of %u chars", name
, LTTNG_UST_SYM_NAME_LEN
- 1);
262 name_len
= LTTNG_UST_SYM_NAME_LEN
- 1;
264 hash
= jhash(name
, name_len
, 0);
265 head
= &tracepoint_table
[hash
& (TRACEPOINT_TABLE_SIZE
- 1)];
266 cds_hlist_for_each_entry(e
, node
, head
, hlist
) {
267 if (!strncmp(name
, e
->name
, LTTNG_UST_SYM_NAME_LEN
- 1))
274 * Add the tracepoint to the tracepoint hash table. Must be called with
275 * tracepoint mutex held.
277 static struct tracepoint_entry
*add_tracepoint(const char *name
,
278 const char *signature
)
280 struct cds_hlist_head
*head
;
281 struct cds_hlist_node
*node
;
282 struct tracepoint_entry
*e
;
283 size_t name_len
= strlen(name
);
286 if (name_len
> LTTNG_UST_SYM_NAME_LEN
- 1) {
287 WARN("Truncating tracepoint name %s which exceeds size limits of %u chars", name
, LTTNG_UST_SYM_NAME_LEN
- 1);
288 name_len
= LTTNG_UST_SYM_NAME_LEN
- 1;
290 hash
= jhash(name
, name_len
, 0);
291 head
= &tracepoint_table
[hash
& (TRACEPOINT_TABLE_SIZE
- 1)];
292 cds_hlist_for_each_entry(e
, node
, head
, hlist
) {
293 if (!strncmp(name
, e
->name
, LTTNG_UST_SYM_NAME_LEN
- 1)) {
294 DBG("tracepoint %s busy", name
);
295 return ERR_PTR(-EEXIST
); /* Already there */
299 * Using zmalloc here to allocate a variable length element. Could
300 * cause some memory fragmentation if overused.
302 e
= zmalloc(sizeof(struct tracepoint_entry
) + name_len
+ 1);
304 return ERR_PTR(-ENOMEM
);
305 memcpy(&e
->name
[0], name
, name_len
+ 1);
306 e
->name
[name_len
] = '\0';
309 e
->callsite_refcount
= 0;
310 e
->signature
= signature
;
311 cds_hlist_add_head(&e
->hlist
, head
);
316 * Remove the tracepoint from the tracepoint hash table. Must be called with
317 * tracepoint mutex held.
319 static void remove_tracepoint(struct tracepoint_entry
*e
)
321 cds_hlist_del(&e
->hlist
);
326 * Sets the probe callback corresponding to one tracepoint.
328 static void set_tracepoint(struct tracepoint_entry
**entry
,
329 struct lttng_ust_tracepoint
*elem
, int active
)
331 WARN_ON(strncmp((*entry
)->name
, elem
->name
, LTTNG_UST_SYM_NAME_LEN
- 1) != 0);
333 * Check that signatures match before connecting a probe to a
334 * tracepoint. Warn the user if they don't.
336 if (strcmp(elem
->signature
, (*entry
)->signature
) != 0) {
337 static int warned
= 0;
339 /* Only print once, don't flood console. */
341 WARN("Tracepoint signature mismatch, not enabling one or more tracepoints. Ensure that the tracepoint probes prototypes match the application.");
342 WARN("Tracepoint \"%s\" signatures: call: \"%s\" vs probe: \"%s\".",
343 elem
->name
, elem
->signature
, (*entry
)->signature
);
346 /* Don't accept connecting non-matching signatures. */
351 * rcu_assign_pointer has a cmm_smp_wmb() which makes sure that the new
352 * probe callbacks array is consistent before setting a pointer to it.
353 * This array is referenced by __DO_TRACE from
354 * include/linux/tracepoints.h. A matching cmm_smp_read_barrier_depends()
357 rcu_assign_pointer(elem
->probes
, (*entry
)->probes
);
358 CMM_STORE_SHARED(elem
->state
, active
);
362 * Disable a tracepoint and its probe callback.
363 * Note: only waiting an RCU period after setting elem->call to the empty
364 * function insures that the original callback is not used anymore. This insured
365 * by preempt_disable around the call site.
367 static void disable_tracepoint(struct lttng_ust_tracepoint
*elem
)
369 CMM_STORE_SHARED(elem
->state
, 0);
370 rcu_assign_pointer(elem
->probes
, NULL
);
374 * Add the callsite to the callsite hash table. Must be called with
375 * tracepoint mutex held.
377 static void add_callsite(struct tracepoint_lib
* lib
, struct lttng_ust_tracepoint
*tp
)
379 struct cds_hlist_head
*head
;
380 struct callsite_entry
*e
;
381 const char *name
= tp
->name
;
382 size_t name_len
= strlen(name
);
384 struct tracepoint_entry
*tp_entry
;
386 if (name_len
> LTTNG_UST_SYM_NAME_LEN
- 1) {
387 WARN("Truncating tracepoint name %s which exceeds size limits of %u chars", name
, LTTNG_UST_SYM_NAME_LEN
- 1);
388 name_len
= LTTNG_UST_SYM_NAME_LEN
- 1;
390 hash
= jhash(name
, name_len
, 0);
391 head
= &callsite_table
[hash
& (CALLSITE_TABLE_SIZE
- 1)];
392 e
= zmalloc(sizeof(struct callsite_entry
));
394 PERROR("Unable to add callsite for tracepoint \"%s\"", name
);
397 cds_hlist_add_head(&e
->hlist
, head
);
399 cds_list_add(&e
->node
, &lib
->callsites
);
401 tp_entry
= get_tracepoint(name
);
404 tp_entry
->callsite_refcount
++;
408 * Remove the callsite from the callsite hash table and from lib
409 * callsite list. Must be called with tracepoint mutex held.
411 static void remove_callsite(struct callsite_entry
*e
)
413 struct tracepoint_entry
*tp_entry
;
415 tp_entry
= get_tracepoint(e
->tp
->name
);
417 tp_entry
->callsite_refcount
--;
418 if (tp_entry
->callsite_refcount
== 0)
419 disable_tracepoint(e
->tp
);
421 cds_hlist_del(&e
->hlist
);
422 cds_list_del(&e
->node
);
427 * Enable/disable all callsites based on the state of a specific
429 * Must be called with tracepoint mutex held.
431 static void tracepoint_sync_callsites(const char *name
)
433 struct cds_hlist_head
*head
;
434 struct cds_hlist_node
*node
;
435 struct callsite_entry
*e
;
436 size_t name_len
= strlen(name
);
438 struct tracepoint_entry
*tp_entry
;
440 tp_entry
= get_tracepoint(name
);
441 if (name_len
> LTTNG_UST_SYM_NAME_LEN
- 1) {
442 WARN("Truncating tracepoint name %s which exceeds size limits of %u chars", name
, LTTNG_UST_SYM_NAME_LEN
- 1);
443 name_len
= LTTNG_UST_SYM_NAME_LEN
- 1;
445 hash
= jhash(name
, name_len
, 0);
446 head
= &callsite_table
[hash
& (CALLSITE_TABLE_SIZE
- 1)];
447 cds_hlist_for_each_entry(e
, node
, head
, hlist
) {
448 struct lttng_ust_tracepoint
*tp
= e
->tp
;
450 if (strncmp(name
, tp
->name
, LTTNG_UST_SYM_NAME_LEN
- 1))
453 set_tracepoint(&tp_entry
, tp
,
454 !!tp_entry
->refcount
);
456 disable_tracepoint(tp
);
462 * tracepoint_update_probe_range - Update a probe range
463 * @begin: beginning of the range
464 * @end: end of the range
466 * Updates the probe callback corresponding to a range of tracepoints.
469 void tracepoint_update_probe_range(struct lttng_ust_tracepoint
* const *begin
,
470 struct lttng_ust_tracepoint
* const *end
)
472 struct lttng_ust_tracepoint
* const *iter
;
473 struct tracepoint_entry
*mark_entry
;
475 for (iter
= begin
; iter
< end
; iter
++) {
477 continue; /* skip dummy */
478 if (!(*iter
)->name
) {
479 disable_tracepoint(*iter
);
482 mark_entry
= get_tracepoint((*iter
)->name
);
484 set_tracepoint(&mark_entry
, *iter
,
485 !!mark_entry
->refcount
);
487 disable_tracepoint(*iter
);
492 static void lib_update_tracepoints(struct tracepoint_lib
*lib
)
494 tracepoint_update_probe_range(lib
->tracepoints_start
,
495 lib
->tracepoints_start
+ lib
->tracepoints_count
);
498 static void lib_register_callsites(struct tracepoint_lib
*lib
)
500 struct lttng_ust_tracepoint
* const *begin
;
501 struct lttng_ust_tracepoint
* const *end
;
502 struct lttng_ust_tracepoint
* const *iter
;
504 begin
= lib
->tracepoints_start
;
505 end
= lib
->tracepoints_start
+ lib
->tracepoints_count
;
507 for (iter
= begin
; iter
< end
; iter
++) {
509 continue; /* skip dummy */
510 if (!(*iter
)->name
) {
513 add_callsite(lib
, *iter
);
517 static void lib_unregister_callsites(struct tracepoint_lib
*lib
)
519 struct callsite_entry
*callsite
, *tmp
;
521 cds_list_for_each_entry_safe(callsite
, tmp
, &lib
->callsites
, node
)
522 remove_callsite(callsite
);
526 * Update probes, removing the faulty probes.
528 static void tracepoint_update_probes(void)
530 struct tracepoint_lib
*lib
;
532 /* tracepoints registered from libraries and executable. */
533 cds_list_for_each_entry(lib
, &libs
, list
)
534 lib_update_tracepoints(lib
);
537 static struct lttng_ust_tracepoint_probe
*
538 tracepoint_add_probe(const char *name
, void (*probe
)(void), void *data
,
539 const char *signature
)
541 struct tracepoint_entry
*entry
;
542 struct lttng_ust_tracepoint_probe
*old
;
544 entry
= get_tracepoint(name
);
546 entry
= add_tracepoint(name
, signature
);
548 return (struct lttng_ust_tracepoint_probe
*)entry
;
550 old
= tracepoint_entry_add_probe(entry
, probe
, data
);
551 if (IS_ERR(old
) && !entry
->refcount
)
552 remove_tracepoint(entry
);
557 * __tracepoint_probe_register - Connect a probe to a tracepoint
558 * @name: tracepoint name
559 * @probe: probe handler
561 * Returns 0 if ok, error value on error.
562 * The probe address must at least be aligned on the architecture pointer size.
563 * Called with the tracepoint mutex held.
565 int __tracepoint_probe_register(const char *name
, void (*probe
)(void),
566 void *data
, const char *signature
)
571 DBG("Registering probe to tracepoint %s", name
);
573 pthread_mutex_lock(&tracepoint_mutex
);
574 old
= tracepoint_add_probe(name
, probe
, data
, signature
);
580 tracepoint_sync_callsites(name
);
583 pthread_mutex_unlock(&tracepoint_mutex
);
587 static void *tracepoint_remove_probe(const char *name
, void (*probe
)(void),
590 struct tracepoint_entry
*entry
;
593 entry
= get_tracepoint(name
);
595 return ERR_PTR(-ENOENT
);
596 old
= tracepoint_entry_remove_probe(entry
, probe
, data
);
599 if (!entry
->refcount
)
600 remove_tracepoint(entry
);
605 * tracepoint_probe_unregister - Disconnect a probe from a tracepoint
606 * @name: tracepoint name
607 * @probe: probe function pointer
608 * @probe: probe data pointer
610 int __tracepoint_probe_unregister(const char *name
, void (*probe
)(void),
616 DBG("Un-registering probe from tracepoint %s", name
);
618 pthread_mutex_lock(&tracepoint_mutex
);
619 old
= tracepoint_remove_probe(name
, probe
, data
);
624 tracepoint_sync_callsites(name
);
627 pthread_mutex_unlock(&tracepoint_mutex
);
631 static void tracepoint_add_old_probes(void *old
)
635 struct tp_probes
*tp_probes
= caa_container_of(old
,
636 struct tp_probes
, probes
[0]);
637 cds_list_add(&tp_probes
->u
.list
, &old_probes
);
642 * tracepoint_probe_register_noupdate - register a probe but not connect
643 * @name: tracepoint name
644 * @probe: probe handler
646 * caller must call tracepoint_probe_update_all()
648 int tracepoint_probe_register_noupdate(const char *name
, void (*probe
)(void),
649 void *data
, const char *signature
)
654 pthread_mutex_lock(&tracepoint_mutex
);
655 old
= tracepoint_add_probe(name
, probe
, data
, signature
);
660 tracepoint_add_old_probes(old
);
662 pthread_mutex_unlock(&tracepoint_mutex
);
667 * tracepoint_probe_unregister_noupdate - remove a probe but not disconnect
668 * @name: tracepoint name
669 * @probe: probe function pointer
671 * caller must call tracepoint_probe_update_all()
672 * Called with the tracepoint mutex held.
674 int tracepoint_probe_unregister_noupdate(const char *name
, void (*probe
)(void),
680 DBG("Un-registering probe from tracepoint %s", name
);
682 pthread_mutex_lock(&tracepoint_mutex
);
683 old
= tracepoint_remove_probe(name
, probe
, data
);
688 tracepoint_add_old_probes(old
);
690 pthread_mutex_unlock(&tracepoint_mutex
);
695 * tracepoint_probe_update_all - update tracepoints
697 void tracepoint_probe_update_all(void)
699 CDS_LIST_HEAD(release_probes
);
700 struct tp_probes
*pos
, *next
;
702 pthread_mutex_lock(&tracepoint_mutex
);
706 if (!cds_list_empty(&old_probes
))
707 cds_list_replace_init(&old_probes
, &release_probes
);
710 tracepoint_update_probes();
711 cds_list_for_each_entry_safe(pos
, next
, &release_probes
, u
.list
) {
712 cds_list_del(&pos
->u
.list
);
717 pthread_mutex_unlock(&tracepoint_mutex
);
720 void tracepoint_set_new_tracepoint_cb(void (*cb
)(struct lttng_ust_tracepoint
*))
722 new_tracepoint_cb
= cb
;
725 static void new_tracepoints(struct lttng_ust_tracepoint
* const *start
,
726 struct lttng_ust_tracepoint
* const *end
)
728 if (new_tracepoint_cb
) {
729 struct lttng_ust_tracepoint
* const *t
;
731 for (t
= start
; t
< end
; t
++) {
733 new_tracepoint_cb(*t
);
738 int tracepoint_register_lib(struct lttng_ust_tracepoint
* const *tracepoints_start
,
739 int tracepoints_count
)
741 struct tracepoint_lib
*pl
, *iter
;
745 pl
= (struct tracepoint_lib
*) zmalloc(sizeof(struct tracepoint_lib
));
747 PERROR("Unable to register tracepoint lib");
750 pl
->tracepoints_start
= tracepoints_start
;
751 pl
->tracepoints_count
= tracepoints_count
;
752 CDS_INIT_LIST_HEAD(&pl
->callsites
);
754 pthread_mutex_lock(&tracepoint_mutex
);
756 * We sort the libs by struct lib pointer address.
758 cds_list_for_each_entry_reverse(iter
, &libs
, list
) {
759 BUG_ON(iter
== pl
); /* Should never be in the list twice */
761 /* We belong to the location right after iter. */
762 cds_list_add(&pl
->list
, &iter
->list
);
766 /* We should be added at the head of the list */
767 cds_list_add(&pl
->list
, &libs
);
769 new_tracepoints(tracepoints_start
, tracepoints_start
+ tracepoints_count
);
770 lib_register_callsites(pl
);
771 lib_update_tracepoints(pl
);
772 pthread_mutex_unlock(&tracepoint_mutex
);
774 DBG("just registered a tracepoints section from %p and having %d tracepoints",
775 tracepoints_start
, tracepoints_count
);
779 for (i
= 0; i
< tracepoints_count
; i
++) {
780 DBG("registered tracepoint: %s", tracepoints_start
[i
]->name
);
787 int tracepoint_unregister_lib(struct lttng_ust_tracepoint
* const *tracepoints_start
)
789 struct tracepoint_lib
*lib
;
791 pthread_mutex_lock(&tracepoint_mutex
);
792 cds_list_for_each_entry(lib
, &libs
, list
) {
793 if (lib
->tracepoints_start
!= tracepoints_start
)
796 cds_list_del(&lib
->list
);
798 * Unregistering a callsite also decreases the
799 * callsite reference count of the corresponding
800 * tracepoint, and disables the tracepoint if
801 * the reference count drops to zero.
803 lib_unregister_callsites(lib
);
804 DBG("just unregistered a tracepoints section from %p",
805 lib
->tracepoints_start
);
809 pthread_mutex_unlock(&tracepoint_mutex
);
814 * Report in debug message whether the compiler correctly supports weak
815 * hidden symbols. This test checks that the address associated with two
816 * weak symbols with hidden visibility is the same when declared within
817 * two compile units part of the same module.
819 static void check_weak_hidden(void)
821 DBG("Your compiler treats weak symbols with hidden visibility for integer objects as %s between compile units part of the same module.",
822 &__tracepoint_test_symbol1
== lttng_ust_tp_check_weak_hidden1() ?
824 "DIFFERENT addresses");
825 DBG("Your compiler treats weak symbols with hidden visibility for pointer objects as %s between compile units part of the same module.",
826 &__tracepoint_test_symbol2
== lttng_ust_tp_check_weak_hidden2() ?
828 "DIFFERENT addresses");
829 DBG("Your compiler treats weak symbols with hidden visibility for 24-byte structure objects as %s between compile units part of the same module.",
830 &__tracepoint_test_symbol3
== lttng_ust_tp_check_weak_hidden3() ?
832 "DIFFERENT addresses");
835 void init_tracepoint(void)
837 if (uatomic_xchg(&initialized
, 1) == 1)
843 void exit_tracepoint(void)
849 * Create the wrapper symbols.
851 #undef tp_rcu_read_lock_bp
852 #undef tp_rcu_read_unlock_bp
853 #undef tp_rcu_dereference_bp
855 void tp_rcu_read_lock_bp(void)
860 void tp_rcu_read_unlock_bp(void)
862 rcu_read_unlock_bp();
865 void *tp_rcu_dereference_sym_bp(void *p
)
867 return rcu_dereference_bp(p
);