X-Git-Url: http://git.lttng.org./?a=blobdiff_plain;f=lib%2Fringbuffer%2Fring_buffer_frontend.c;h=1e4b98b677b994162198a83b840122198f22c4f3;hb=7c85d2eed6474032787e4e999c6226f15a18c221;hp=3a0433bf7bb5d436fe9a94cf139cea4e041c903e;hpb=5bbe78ac27c7365d791490b465edbd8e891e652f;p=lttng-modules.git diff --git a/lib/ringbuffer/ring_buffer_frontend.c b/lib/ringbuffer/ring_buffer_frontend.c index 3a0433bf..1e4b98b6 100644 --- a/lib/ringbuffer/ring_buffer_frontend.c +++ b/lib/ringbuffer/ring_buffer_frontend.c @@ -904,15 +904,6 @@ int lib_ring_buffer_snapshot(struct lib_ring_buffer *buf, unsigned long consumed_cur, write_offset; int finalized; - /* - * First, ensure we perform a "final" flush onto the stream. This will - * ensure we create a packet of padding if we encounter an empty - * packet. This ensures the time-stamps right before the snapshot is - * used as end of packet timestamp. - */ - if (!buf->quiescent) - _lib_ring_buffer_switch_remote(buf, SWITCH_FLUSH); - retry: finalized = ACCESS_ONCE(buf->finalized); /* @@ -1615,11 +1606,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, @@ -1628,6 +1625,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. @@ -1648,8 +1646,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, ¶m, 1); if (ret) { /* Remote CPU is offline, do it ourself. */ lib_ring_buffer_switch_slow(buf, mode); @@ -1663,6 +1663,13 @@ void lib_ring_buffer_switch_remote(struct lib_ring_buffer *buf) } EXPORT_SYMBOL_GPL(lib_ring_buffer_switch_remote); +/* Switch sub-buffer even if current sub-buffer is empty. */ +void lib_ring_buffer_switch_remote_empty(struct lib_ring_buffer *buf) +{ + _lib_ring_buffer_switch_remote(buf, SWITCH_FLUSH); +} +EXPORT_SYMBOL_GPL(lib_ring_buffer_switch_remote_empty); + /* * Returns : * 0 if ok