X-Git-Url: http://git.liburcu.org/?a=blobdiff_plain;f=probes%2Flttng-kretprobes.c;h=307e67774cfa25d1c98679637ed20a3a6b5d8f1e;hb=9486bed4329e2e7a15115c564fede382845ed87a;hp=eb3f68573dc895554af4484d0a8aad03ddcf284a;hpb=79150a4903b5f31695fcd1d9655555ba6dc4bfa4;p=lttng-modules.git diff --git a/probes/lttng-kretprobes.c b/probes/lttng-kretprobes.c index eb3f6857..307e6777 100644 --- a/probes/lttng-kretprobes.c +++ b/probes/lttng-kretprobes.c @@ -1,5 +1,5 @@ /* - * probes/lttng-kretprobes.c +* probes/lttng-kretprobes.c * * LTTng kretprobes integration module. * @@ -24,11 +24,12 @@ #include #include #include -#include "../lttng-events.h" -#include "../wrapper/ringbuffer/frontend_types.h" -#include "../wrapper/vmalloc.h" -#include "../wrapper/irqflags.h" -#include "../lttng-tracer.h" +#include +#include +#include +#include +#include +#include enum lttng_kretprobe_type { EVENT_ENTRY = 0, @@ -53,7 +54,7 @@ int _lttng_kretprobes_handler(struct kretprobe_instance *krpi, lttng_krp->event[type]; struct lttng_probe_ctx lttng_probe_ctx = { .event = event, - .interruptible = lttng_regs_irqs_disabled(regs), + .interruptible = !lttng_regs_irqs_disabled(regs), }; struct lttng_channel *chan = event->chan; struct lib_ring_buffer_ctx ctx; @@ -63,11 +64,11 @@ int _lttng_kretprobes_handler(struct kretprobe_instance *krpi, unsigned long parent_ip; } payload; - if (unlikely(!ACCESS_ONCE(chan->session->active))) + if (unlikely(!READ_ONCE(chan->session->active))) return 0; - if (unlikely(!ACCESS_ONCE(chan->enabled))) + if (unlikely(!READ_ONCE(chan->enabled))) return 0; - if (unlikely(!ACCESS_ONCE(event->enabled))) + if (unlikely(!READ_ONCE(event->enabled))) return 0; payload.ip = (unsigned long) krpi->rp->kp.addr; @@ -224,9 +225,9 @@ int lttng_kretprobes_register(const char *name, * unregistered. Same for memory allocation. */ kref_init(<tng_krp->kref_alloc); - kref_get(<tng_krp->kref_alloc); /* inc refcount to 2 */ + kref_get(<tng_krp->kref_alloc); /* inc refcount to 2, no overflow. */ kref_init(<tng_krp->kref_register); - kref_get(<tng_krp->kref_register); /* inc refcount to 2 */ + kref_get(<tng_krp->kref_register); /* inc refcount to 2, no overflow. */ /* * Ensure the memory we just allocated don't trigger page faults. @@ -304,8 +305,8 @@ int lttng_kretprobes_event_enable_state(struct lttng_event *event, } lttng_krp = event->u.kretprobe.lttng_krp; event_return = lttng_krp->event[EVENT_RETURN]; - ACCESS_ONCE(event->enabled) = enable; - ACCESS_ONCE(event_return->enabled) = enable; + WRITE_ONCE(event->enabled, enable); + WRITE_ONCE(event_return->enabled, enable); return 0; } EXPORT_SYMBOL_GPL(lttng_kretprobes_event_enable_state);