Fix: Add support for 4.6.4-rt8 kernel
[lttng-modules.git] / lib / ringbuffer / ring_buffer_frontend.c
index 9cd62ced16ae19deedd8eea935c507e09cd5616a..89eefe96bdd05baafe93ddb776aff84e84c24d15 100644 (file)
@@ -63,6 +63,7 @@
 #include <wrapper/atomic.h>
 #include <wrapper/kref.h>
 #include <wrapper/percpu-defs.h>
+#include <wrapper/timer.h>
 
 /*
  * Internal structure representing offsets to use at a sub-buffer switch.
@@ -281,7 +282,7 @@ static void switch_buffer_timer(unsigned long data)
                lib_ring_buffer_switch_slow(buf, SWITCH_ACTIVE);
 
        if (config->alloc == RING_BUFFER_ALLOC_PER_CPU)
-               mod_timer_pinned(&buf->switch_timer,
+               lttng_mod_timer_pinned(&buf->switch_timer,
                                 jiffies + chan->switch_timer_interval);
        else
                mod_timer(&buf->switch_timer,
@@ -298,7 +299,12 @@ static void lib_ring_buffer_start_switch_timer(struct lib_ring_buffer *buf)
 
        if (!chan->switch_timer_interval || buf->switch_timer_enabled)
                return;
-       init_timer(&buf->switch_timer);
+
+       if (config->alloc == RING_BUFFER_ALLOC_PER_CPU)
+               lttng_init_timer_pinned(&buf->switch_timer);
+       else
+               init_timer(&buf->switch_timer);
+
        buf->switch_timer.function = switch_buffer_timer;
        buf->switch_timer.expires = jiffies + chan->switch_timer_interval;
        buf->switch_timer.data = (unsigned long)buf;
@@ -341,7 +347,7 @@ static void read_buffer_timer(unsigned long data)
        }
 
        if (config->alloc == RING_BUFFER_ALLOC_PER_CPU)
-               mod_timer_pinned(&buf->read_timer,
+               lttng_mod_timer_pinned(&buf->read_timer,
                                 jiffies + chan->read_timer_interval);
        else
                mod_timer(&buf->read_timer,
@@ -361,7 +367,11 @@ static void lib_ring_buffer_start_read_timer(struct lib_ring_buffer *buf)
            || buf->read_timer_enabled)
                return;
 
-       init_timer(&buf->read_timer);
+       if (config->alloc == RING_BUFFER_ALLOC_PER_CPU)
+               lttng_init_timer_pinned(&buf->read_timer);
+       else
+               init_timer(&buf->read_timer);
+
        buf->read_timer.function = read_buffer_timer;
        buf->read_timer.expires = jiffies + chan->read_timer_interval;
        buf->read_timer.data = (unsigned long)buf;
@@ -1606,11 +1616,17 @@ void lib_ring_buffer_switch_slow(struct lib_ring_buffer *buf, enum switch_mode m
 }
 EXPORT_SYMBOL_GPL(lib_ring_buffer_switch_slow);
 
+struct switch_param {
+       struct lib_ring_buffer *buf;
+       enum switch_mode mode;
+};
+
 static void remote_switch(void *info)
 {
-       struct lib_ring_buffer *buf = info;
+       struct switch_param *param = info;
+       struct lib_ring_buffer *buf = param->buf;
 
-       lib_ring_buffer_switch_slow(buf, SWITCH_ACTIVE);
+       lib_ring_buffer_switch_slow(buf, param->mode);
 }
 
 static void _lib_ring_buffer_switch_remote(struct lib_ring_buffer *buf,
@@ -1619,6 +1635,7 @@ static void _lib_ring_buffer_switch_remote(struct lib_ring_buffer *buf,
        struct channel *chan = buf->backend.chan;
        const struct lib_ring_buffer_config *config = &chan->backend.config;
        int ret;
+       struct switch_param param;
 
        /*
         * With global synchronization we don't need to use the IPI scheme.
@@ -1639,8 +1656,10 @@ static void _lib_ring_buffer_switch_remote(struct lib_ring_buffer *buf,
         * switch.
         */
        get_online_cpus();
+       param.buf = buf;
+       param.mode = mode;
        ret = smp_call_function_single(buf->backend.cpu,
-                                remote_switch, buf, 1);
+                                remote_switch, &param, 1);
        if (ret) {
                /* Remote CPU is offline, do it ourself. */
                lib_ring_buffer_switch_slow(buf, mode);
This page took 0.024313 seconds and 4 git commands to generate.