Comment the union field (only used in call_rcu scheme)
[lttng-ust.git] / liblttng-ust / tracepoint.c
CommitLineData
f99be407 1/*
b27f8e75 2 * Copyright (C) 2008-2011 Mathieu Desnoyers
1f8b0dff 3 * Copyright (C) 2009 Pierre-Marc Fournier
f99be407 4 *
34e4b7db
PMF
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
f37142a4
MD
7 * License as published by the Free Software Foundation;
8 * version 2.1 of the License.
f99be407 9 *
34e4b7db 10 * This library is distributed in the hope that it will be useful,
f99be407 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
34e4b7db
PMF
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
f99be407 14 *
34e4b7db
PMF
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
1f8b0dff
PMF
18 *
19 * Ported to userspace by Pierre-Marc Fournier.
f99be407 20 */
1f8b0dff 21
b0c4126f 22#define _LGPL_SOURCE
474d745f 23#include <errno.h>
b728d87e
MD
24#include <stdint.h>
25#include <stddef.h>
44c72f10 26
b728d87e 27#include <urcu/arch.h>
b7ea1a1c 28#include <urcu-bp.h>
10c56168 29#include <urcu/hlist.h>
edaa1431 30#include <urcu/uatomic.h>
b728d87e 31#include <urcu/compiler.h>
44c72f10
MD
32
33#include <lttng/tracepoint.h>
ff412fb5 34#include <lttng/ust-abi.h> /* for LTTNG_UST_SYM_NAME_LEN */
44c72f10
MD
35
36#include <usterr-signal-safe.h>
35897f8b 37#include <helper.h>
474d745f 38
23c8854a 39#include "tracepoint-internal.h"
b751f722 40#include "ltt-tracer-core.h"
596c4223 41#include "jhash.h"
8f3f8c99 42#include "error.h"
b0c4126f 43
f99be407
PMF
44/* Set to 1 to enable tracepoint debug output */
45static const int tracepoint_debug;
b27f8e75
MD
46static int initialized;
47static void (*new_tracepoint_cb)(struct tracepoint *);
f99be407 48
efa2c591
MD
49/*
50 * libraries that contain tracepoints (struct tracepoint_lib).
51 * Protected by UST lock.
52 */
0222e121 53static CDS_LIST_HEAD(libs);
474d745f 54
f99be407 55/*
17dfb34b
MD
56 * The UST lock protects the library tracepoints, the hash table, and
57 * the library list.
58 * All calls to the tracepoint API must be protected by the UST lock,
59 * excepts calls to tracepoint_register_lib and
60 * tracepoint_unregister_lib, which take the UST lock themselves.
f99be407 61 */
f99be407
PMF
62
63/*
64 * Tracepoint hash table, containing the active tracepoints.
efa2c591 65 * Protected by ust lock.
f99be407
PMF
66 */
67#define TRACEPOINT_HASH_BITS 6
68#define TRACEPOINT_TABLE_SIZE (1 << TRACEPOINT_HASH_BITS)
10c56168 69static struct cds_hlist_head tracepoint_table[TRACEPOINT_TABLE_SIZE];
f99be407 70
b27f8e75
MD
71static CDS_LIST_HEAD(old_probes);
72static int need_update;
73
f99be407
PMF
74/*
75 * Note about RCU :
76 * It is used to to delay the free of multiple probes array until a quiescent
77 * state is reached.
efa2c591 78 * Tracepoint entries modifications are protected by the ust lock.
f99be407
PMF
79 */
80struct tracepoint_entry {
10c56168 81 struct cds_hlist_node hlist;
b979b346 82 struct tracepoint_probe *probes;
f99be407
PMF
83 int refcount; /* Number of times armed. 0 if disarmed. */
84 char name[0];
85};
86
87struct tp_probes {
88 union {
0222e121 89 struct cds_list_head list;
ade7037b
MD
90 /* Field below only used for call_rcu scheme */
91 /* struct rcu_head head; */
f99be407 92 } u;
b979b346 93 struct tracepoint_probe probes[0];
f99be407
PMF
94};
95
efa2c591 96static void *allocate_probes(int count)
f99be407 97{
b979b346 98 struct tp_probes *p = zmalloc(count * sizeof(struct tracepoint_probe)
909bc43f 99 + sizeof(struct tp_probes));
f99be407
PMF
100 return p == NULL ? NULL : p->probes;
101}
102
efa2c591 103static void release_probes(void *old)
f99be407
PMF
104{
105 if (old) {
b728d87e 106 struct tp_probes *tp_probes = caa_container_of(old,
f99be407 107 struct tp_probes, probes[0]);
474d745f 108 synchronize_rcu();
909bc43f 109 free(tp_probes);
f99be407
PMF
110 }
111}
112
113static void debug_print_probes(struct tracepoint_entry *entry)
114{
115 int i;
116
9dec086e 117 if (!tracepoint_debug || !entry->probes)
f99be407
PMF
118 return;
119
9dec086e
NC
120 for (i = 0; entry->probes[i].func; i++)
121 DBG("Probe %d : %p", i, entry->probes[i].func);
f99be407
PMF
122}
123
124static void *
9dec086e
NC
125tracepoint_entry_add_probe(struct tracepoint_entry *entry,
126 void *probe, void *data)
f99be407
PMF
127{
128 int nr_probes = 0;
b979b346 129 struct tracepoint_probe *old, *new;
f99be407
PMF
130
131 WARN_ON(!probe);
132
133 debug_print_probes(entry);
9dec086e 134 old = entry->probes;
f99be407
PMF
135 if (old) {
136 /* (N -> N+1), (N != 0, 1) probes */
9dec086e
NC
137 for (nr_probes = 0; old[nr_probes].func; nr_probes++)
138 if (old[nr_probes].func == probe &&
139 old[nr_probes].data == data)
f99be407
PMF
140 return ERR_PTR(-EEXIST);
141 }
142 /* + 2 : one for new probe, one for NULL func */
143 new = allocate_probes(nr_probes + 2);
144 if (new == NULL)
145 return ERR_PTR(-ENOMEM);
146 if (old)
b979b346 147 memcpy(new, old, nr_probes * sizeof(struct tracepoint_probe));
9dec086e
NC
148 new[nr_probes].func = probe;
149 new[nr_probes].data = data;
150 new[nr_probes + 1].func = NULL;
f99be407 151 entry->refcount = nr_probes + 1;
9dec086e 152 entry->probes = new;
f99be407
PMF
153 debug_print_probes(entry);
154 return old;
155}
156
157static void *
9dec086e
NC
158tracepoint_entry_remove_probe(struct tracepoint_entry *entry, void *probe,
159 void *data)
f99be407
PMF
160{
161 int nr_probes = 0, nr_del = 0, i;
b979b346 162 struct tracepoint_probe *old, *new;
f99be407 163
9dec086e 164 old = entry->probes;
f99be407
PMF
165
166 if (!old)
167 return ERR_PTR(-ENOENT);
168
169 debug_print_probes(entry);
170 /* (N -> M), (N > 1, M >= 0) probes */
9dec086e 171 for (nr_probes = 0; old[nr_probes].func; nr_probes++) {
c66428ac
DG
172 if (!probe ||
173 (old[nr_probes].func == probe &&
9dec086e 174 old[nr_probes].data == data))
f99be407
PMF
175 nr_del++;
176 }
177
178 if (nr_probes - nr_del == 0) {
179 /* N -> 0, (N > 1) */
9dec086e 180 entry->probes = NULL;
f99be407
PMF
181 entry->refcount = 0;
182 debug_print_probes(entry);
183 return old;
184 } else {
185 int j = 0;
186 /* N -> M, (N > 1, M > 0) */
187 /* + 1 for NULL */
188 new = allocate_probes(nr_probes - nr_del + 1);
189 if (new == NULL)
190 return ERR_PTR(-ENOMEM);
9dec086e
NC
191 for (i = 0; old[i].func; i++)
192 if (probe &&
193 (old[i].func != probe || old[i].data != data))
f99be407 194 new[j++] = old[i];
9dec086e 195 new[nr_probes - nr_del].func = NULL;
f99be407 196 entry->refcount = nr_probes - nr_del;
9dec086e 197 entry->probes = new;
f99be407
PMF
198 }
199 debug_print_probes(entry);
200 return old;
201}
202
203/*
204 * Get tracepoint if the tracepoint is present in the tracepoint hash table.
efa2c591 205 * Must be called with ust lock held.
f99be407
PMF
206 * Returns NULL if not present.
207 */
208static struct tracepoint_entry *get_tracepoint(const char *name)
209{
10c56168
DG
210 struct cds_hlist_head *head;
211 struct cds_hlist_node *node;
f99be407 212 struct tracepoint_entry *e;
ff412fb5
MD
213 size_t name_len = strlen(name);
214 uint32_t hash;
f99be407 215
ff412fb5
MD
216 if (name_len > LTTNG_UST_SYM_NAME_LEN - 1) {
217 WARN("Truncating tracepoint name %s which exceeds size limits of %u chars", name, LTTNG_UST_SYM_NAME_LEN - 1);
218 name_len = LTTNG_UST_SYM_NAME_LEN - 1;
219 }
220 hash = jhash(name, name_len, 0);
f99be407 221 head = &tracepoint_table[hash & (TRACEPOINT_TABLE_SIZE - 1)];
10c56168 222 cds_hlist_for_each_entry(e, node, head, hlist) {
ff412fb5 223 if (!strncmp(name, e->name, LTTNG_UST_SYM_NAME_LEN - 1))
f99be407
PMF
224 return e;
225 }
226 return NULL;
227}
228
229/*
230 * Add the tracepoint to the tracepoint hash table. Must be called with
efa2c591 231 * ust lock held.
f99be407
PMF
232 */
233static struct tracepoint_entry *add_tracepoint(const char *name)
234{
10c56168
DG
235 struct cds_hlist_head *head;
236 struct cds_hlist_node *node;
f99be407 237 struct tracepoint_entry *e;
ff412fb5
MD
238 size_t name_len = strlen(name);
239 uint32_t hash;
f99be407 240
ff412fb5
MD
241 if (name_len > LTTNG_UST_SYM_NAME_LEN - 1) {
242 WARN("Truncating tracepoint name %s which exceeds size limits of %u chars", name, LTTNG_UST_SYM_NAME_LEN - 1);
243 name_len = LTTNG_UST_SYM_NAME_LEN - 1;
244 }
245 hash = jhash(name, name_len, 0);
f99be407 246 head = &tracepoint_table[hash & (TRACEPOINT_TABLE_SIZE - 1)];
10c56168 247 cds_hlist_for_each_entry(e, node, head, hlist) {
ff412fb5 248 if (!strncmp(name, e->name, LTTNG_UST_SYM_NAME_LEN - 1)) {
c1f20530 249 DBG("tracepoint %s busy", name);
f99be407
PMF
250 return ERR_PTR(-EEXIST); /* Already there */
251 }
252 }
253 /*
1dba3e6c 254 * Using zmalloc here to allocate a variable length element. Could
f99be407
PMF
255 * cause some memory fragmentation if overused.
256 */
ff412fb5 257 e = zmalloc(sizeof(struct tracepoint_entry) + name_len + 1);
f99be407
PMF
258 if (!e)
259 return ERR_PTR(-ENOMEM);
ff412fb5
MD
260 memcpy(&e->name[0], name, name_len + 1);
261 e->name[name_len] = '\0';
9dec086e 262 e->probes = NULL;
f99be407 263 e->refcount = 0;
10c56168 264 cds_hlist_add_head(&e->hlist, head);
f99be407
PMF
265 return e;
266}
267
268/*
269 * Remove the tracepoint from the tracepoint hash table. Must be called with
17dfb34b 270 * ust_lock held.
f99be407 271 */
efa2c591 272static void remove_tracepoint(struct tracepoint_entry *e)
f99be407 273{
10c56168 274 cds_hlist_del(&e->hlist);
909bc43f 275 free(e);
f99be407
PMF
276}
277
278/*
279 * Sets the probe callback corresponding to one tracepoint.
280 */
281static void set_tracepoint(struct tracepoint_entry **entry,
282 struct tracepoint *elem, int active)
283{
ff412fb5 284 WARN_ON(strncmp((*entry)->name, elem->name, LTTNG_UST_SYM_NAME_LEN - 1) != 0);
f99be407
PMF
285
286 /*
0222e121 287 * rcu_assign_pointer has a cmm_smp_wmb() which makes sure that the new
f99be407
PMF
288 * probe callbacks array is consistent before setting a pointer to it.
289 * This array is referenced by __DO_TRACE from
0222e121 290 * include/linux/tracepoints.h. A matching cmm_smp_read_barrier_depends()
f99be407
PMF
291 * is used.
292 */
9dec086e 293 rcu_assign_pointer(elem->probes, (*entry)->probes);
f36c12ab 294 elem->state = active;
f99be407
PMF
295}
296
297/*
298 * Disable a tracepoint and its probe callback.
299 * Note: only waiting an RCU period after setting elem->call to the empty
300 * function insures that the original callback is not used anymore. This insured
301 * by preempt_disable around the call site.
302 */
303static void disable_tracepoint(struct tracepoint *elem)
304{
f36c12ab 305 elem->state = 0;
9dec086e 306 rcu_assign_pointer(elem->probes, NULL);
f99be407
PMF
307}
308
309/**
310 * tracepoint_update_probe_range - Update a probe range
311 * @begin: beginning of the range
312 * @end: end of the range
313 *
314 * Updates the probe callback corresponding to a range of tracepoints.
315 */
b27f8e75 316static
f218ff28
MD
317void tracepoint_update_probe_range(struct tracepoint * const *begin,
318 struct tracepoint * const *end)
f99be407 319{
f218ff28 320 struct tracepoint * const *iter;
f99be407
PMF
321 struct tracepoint_entry *mark_entry;
322
f99be407 323 for (iter = begin; iter < end; iter++) {
f08ebbe2
MD
324 if (!*iter)
325 continue; /* skip dummy */
f218ff28
MD
326 if (!(*iter)->name) {
327 disable_tracepoint(*iter);
9dec086e
NC
328 continue;
329 }
f218ff28 330 mark_entry = get_tracepoint((*iter)->name);
f99be407 331 if (mark_entry) {
f218ff28 332 set_tracepoint(&mark_entry, *iter,
f99be407
PMF
333 !!mark_entry->refcount);
334 } else {
f218ff28 335 disable_tracepoint(*iter);
f99be407
PMF
336 }
337 }
f99be407
PMF
338}
339
772030fe
PMF
340static void lib_update_tracepoints(void)
341{
342 struct tracepoint_lib *lib;
343
b27f8e75 344 cds_list_for_each_entry(lib, &libs, list) {
772030fe
PMF
345 tracepoint_update_probe_range(lib->tracepoints_start,
346 lib->tracepoints_start + lib->tracepoints_count);
b27f8e75 347 }
772030fe
PMF
348}
349
f99be407
PMF
350/*
351 * Update probes, removing the faulty probes.
352 */
353static void tracepoint_update_probes(void)
354{
b27f8e75 355 /* tracepoints registered from libraries and executable. */
474d745f 356 lib_update_tracepoints();
f99be407
PMF
357}
358
b979b346 359static struct tracepoint_probe *
9dec086e 360tracepoint_add_probe(const char *name, void *probe, void *data)
f99be407
PMF
361{
362 struct tracepoint_entry *entry;
b979b346 363 struct tracepoint_probe *old;
f99be407
PMF
364
365 entry = get_tracepoint(name);
366 if (!entry) {
367 entry = add_tracepoint(name);
368 if (IS_ERR(entry))
b979b346 369 return (struct tracepoint_probe *)entry;
f99be407 370 }
9dec086e 371 old = tracepoint_entry_add_probe(entry, probe, data);
f99be407
PMF
372 if (IS_ERR(old) && !entry->refcount)
373 remove_tracepoint(entry);
374 return old;
375}
376
377/**
81614639 378 * __tracepoint_probe_register - Connect a probe to a tracepoint
f99be407
PMF
379 * @name: tracepoint name
380 * @probe: probe handler
381 *
382 * Returns 0 if ok, error value on error.
383 * The probe address must at least be aligned on the architecture pointer size.
17dfb34b 384 * Called with the UST lock held.
f99be407 385 */
81614639 386int __tracepoint_probe_register(const char *name, void *probe, void *data)
f99be407
PMF
387{
388 void *old;
389
9dec086e 390 old = tracepoint_add_probe(name, probe, data);
f99be407
PMF
391 if (IS_ERR(old))
392 return PTR_ERR(old);
393
394 tracepoint_update_probes(); /* may update entry */
395 release_probes(old);
396 return 0;
397}
f99be407 398
9dec086e 399static void *tracepoint_remove_probe(const char *name, void *probe, void *data)
f99be407
PMF
400{
401 struct tracepoint_entry *entry;
402 void *old;
403
404 entry = get_tracepoint(name);
405 if (!entry)
406 return ERR_PTR(-ENOENT);
9dec086e 407 old = tracepoint_entry_remove_probe(entry, probe, data);
f99be407
PMF
408 if (IS_ERR(old))
409 return old;
410 if (!entry->refcount)
411 remove_tracepoint(entry);
412 return old;
413}
414
415/**
416 * tracepoint_probe_unregister - Disconnect a probe from a tracepoint
417 * @name: tracepoint name
418 * @probe: probe function pointer
9dec086e 419 * @probe: probe data pointer
f99be407 420 *
17dfb34b 421 * Called with the UST lock held.
f99be407 422 */
81614639 423int __tracepoint_probe_unregister(const char *name, void *probe, void *data)
f99be407
PMF
424{
425 void *old;
426
9dec086e 427 old = tracepoint_remove_probe(name, probe, data);
f99be407
PMF
428 if (IS_ERR(old))
429 return PTR_ERR(old);
430
431 tracepoint_update_probes(); /* may update entry */
432 release_probes(old);
433 return 0;
434}
f99be407 435
f99be407
PMF
436static void tracepoint_add_old_probes(void *old)
437{
438 need_update = 1;
439 if (old) {
b728d87e 440 struct tp_probes *tp_probes = caa_container_of(old,
f99be407 441 struct tp_probes, probes[0]);
0222e121 442 cds_list_add(&tp_probes->u.list, &old_probes);
f99be407
PMF
443 }
444}
445
446/**
447 * tracepoint_probe_register_noupdate - register a probe but not connect
448 * @name: tracepoint name
449 * @probe: probe handler
450 *
451 * caller must call tracepoint_probe_update_all()
17dfb34b 452 * Called with the UST lock held.
f99be407 453 */
9dec086e
NC
454int tracepoint_probe_register_noupdate(const char *name, void *probe,
455 void *data)
f99be407
PMF
456{
457 void *old;
458
9dec086e 459 old = tracepoint_add_probe(name, probe, data);
f99be407 460 if (IS_ERR(old)) {
f99be407
PMF
461 return PTR_ERR(old);
462 }
463 tracepoint_add_old_probes(old);
f99be407
PMF
464 return 0;
465}
f99be407
PMF
466
467/**
468 * tracepoint_probe_unregister_noupdate - remove a probe but not disconnect
469 * @name: tracepoint name
470 * @probe: probe function pointer
471 *
472 * caller must call tracepoint_probe_update_all()
17dfb34b 473 * Called with the UST lock held.
f99be407 474 */
9dec086e
NC
475int tracepoint_probe_unregister_noupdate(const char *name, void *probe,
476 void *data)
f99be407
PMF
477{
478 void *old;
479
9dec086e 480 old = tracepoint_remove_probe(name, probe, data);
f99be407 481 if (IS_ERR(old)) {
f99be407
PMF
482 return PTR_ERR(old);
483 }
484 tracepoint_add_old_probes(old);
f99be407
PMF
485 return 0;
486}
f99be407
PMF
487
488/**
489 * tracepoint_probe_update_all - update tracepoints
17dfb34b 490 * Called with the UST lock held.
f99be407
PMF
491 */
492void tracepoint_probe_update_all(void)
493{
0222e121 494 CDS_LIST_HEAD(release_probes);
f99be407
PMF
495 struct tp_probes *pos, *next;
496
f99be407 497 if (!need_update) {
f99be407
PMF
498 return;
499 }
0222e121
MD
500 if (!cds_list_empty(&old_probes))
501 cds_list_replace_init(&old_probes, &release_probes);
f99be407 502 need_update = 0;
f99be407
PMF
503
504 tracepoint_update_probes();
0222e121
MD
505 cds_list_for_each_entry_safe(pos, next, &release_probes, u.list) {
506 cds_list_del(&pos->u.list);
474d745f 507 synchronize_rcu();
909bc43f 508 free(pos);
f99be407
PMF
509 }
510}
f99be407 511
474d745f
PMF
512void tracepoint_set_new_tracepoint_cb(void (*cb)(struct tracepoint *))
513{
514 new_tracepoint_cb = cb;
515}
f99be407 516
f218ff28 517static void new_tracepoints(struct tracepoint * const *start, struct tracepoint * const *end)
f99be407 518{
f218ff28
MD
519 if (new_tracepoint_cb) {
520 struct tracepoint * const *t;
f08ebbe2 521
b27f8e75 522 for (t = start; t < end; t++) {
f08ebbe2
MD
523 if (*t)
524 new_tracepoint_cb(*t);
474d745f
PMF
525 }
526 }
f99be407 527}
f99be407 528
1622ba22
MD
529static
530void lib_disable_tracepoints(struct tracepoint * const *begin,
531 struct tracepoint * const *end)
532{
533 struct tracepoint * const *iter;
534
535 for (iter = begin; iter < end; iter++) {
536 if (!*iter)
537 continue; /* skip dummy */
538 disable_tracepoint(*iter);
539 }
540
541}
542
b27f8e75
MD
543int tracepoint_register_lib(struct tracepoint * const *tracepoints_start,
544 int tracepoints_count)
474d745f 545{
b467f7a7 546 struct tracepoint_lib *pl, *iter;
474d745f 547
edaa1431
MD
548 init_tracepoint();
549
1dba3e6c 550 pl = (struct tracepoint_lib *) zmalloc(sizeof(struct tracepoint_lib));
474d745f
PMF
551
552 pl->tracepoints_start = tracepoints_start;
553 pl->tracepoints_count = tracepoints_count;
554
17dfb34b 555 ust_lock();
b467f7a7
MD
556 /*
557 * We sort the libs by struct lib pointer address.
558 */
559 cds_list_for_each_entry_reverse(iter, &libs, list) {
560 BUG_ON(iter == pl); /* Should never be in the list twice */
561 if (iter < pl) {
562 /* We belong to the location right after iter. */
563 cds_list_add(&pl->list, &iter->list);
564 goto lib_added;
565 }
566 }
567 /* We should be added at the head of the list */
0222e121 568 cds_list_add(&pl->list, &libs);
b467f7a7 569lib_added:
474d745f
PMF
570 new_tracepoints(tracepoints_start, tracepoints_start + tracepoints_count);
571
b27f8e75 572 /* TODO: update just the loaded lib */
474d745f 573 lib_update_tracepoints();
17dfb34b 574 ust_unlock();
474d745f 575
1fcf7ad7
MD
576 DBG("just registered a tracepoints section from %p and having %d tracepoints",
577 tracepoints_start, tracepoints_count);
9dec086e 578
474d745f
PMF
579 return 0;
580}
581
f218ff28 582int tracepoint_unregister_lib(struct tracepoint * const *tracepoints_start)
474d745f 583{
24b6668c 584 struct tracepoint_lib *lib;
1622ba22 585 int tracepoints_count;
24b6668c 586
17dfb34b 587 ust_lock();
0222e121 588 cds_list_for_each_entry(lib, &libs, list) {
f218ff28 589 if (lib->tracepoints_start == tracepoints_start) {
24b6668c 590 struct tracepoint_lib *lib2free = lib;
1622ba22 591
0222e121 592 cds_list_del(&lib->list);
1622ba22 593 tracepoints_count = lib->tracepoints_count;
24b6668c 594 free(lib2free);
1622ba22 595 goto found;
24b6668c
PMF
596 }
597 }
1622ba22
MD
598 goto end;
599found:
600 /*
601 * Force tracepoint disarm for all tracepoints of this lib.
602 * This takes care of destructor of library that would leave a
603 * LD_PRELOAD wrapper override function enabled for tracing, but
604 * the session teardown would not be able to reach the
605 * tracepoint anymore to disable it.
606 */
607 lib_disable_tracepoints(tracepoints_start,
608 tracepoints_start + tracepoints_count);
609 DBG("just unregistered a tracepoints section from %p",
610 tracepoints_start);
611end:
17dfb34b 612 ust_unlock();
474d745f
PMF
613 return 0;
614}
b27f8e75 615
edaa1431 616void init_tracepoint(void)
b27f8e75 617{
edaa1431
MD
618 if (uatomic_xchg(&initialized, 1) == 1)
619 return;
5e96a467 620 init_usterr();
b27f8e75
MD
621}
622
edaa1431 623void exit_tracepoint(void)
b27f8e75 624{
17dfb34b 625 initialized = 0;
b27f8e75 626}
40b2b5a4
MD
627
628/*
629 * Create the wrapper symbols.
630 */
631#undef tp_rcu_read_lock_bp
632#undef tp_rcu_read_unlock_bp
633#undef tp_rcu_dereference_bp
634
635void tp_rcu_read_lock_bp(void)
636{
637 rcu_read_lock_bp();
638}
639
640void tp_rcu_read_unlock_bp(void)
641{
642 rcu_read_unlock_bp();
643}
644
645void *tp_rcu_dereference_sym_bp(void *p)
646{
647 return rcu_dereference_bp(p);
648}
This page took 0.06032 seconds and 4 git commands to generate.