lttng-ust.git
13 years agofinish_consuming_dead_subbuffer: fix data_size read race, reread new consumed count
Mathieu Desnoyers [Thu, 3 Mar 2011 17:53:52 +0000 (12:53 -0500)] 
finish_consuming_dead_subbuffer: fix data_size read race, reread new consumed count

Make sure finish_consuming_dead_subbuffer always see a data_size that is non
0xffffffff only when the buffer data is entirely readable, else the code rely on
the commit_seq counter which is the proper solution.

The consumed count should be re-read in each test within the loop, otherwise the
mathematic formula to get the amount of data to read does not work wrt
buffer-size wrap-around.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
13 years agolibustconsumer: check read subuffer return value
Mathieu Desnoyers [Thu, 3 Mar 2011 16:59:42 +0000 (11:59 -0500)] 
libustconsumer: check read subuffer return value

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
13 years agofork: child should issue synchronize_rcu() for urcu-bp garbage collection
Mathieu Desnoyers [Thu, 3 Mar 2011 16:46:20 +0000 (11:46 -0500)] 
fork: child should issue synchronize_rcu() for urcu-bp garbage collection

After a fork(), the child process should execute synchronize_rcu() before any
new thread can be created. Failure to do so could lead to a deadlock in the
unlikely scenario where a thread ID appearing in the parent is reused in the
child before GC is performed.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
13 years agoAdd missing listener threads data vs fork() protection
Mathieu Desnoyers [Thu, 3 Mar 2011 16:38:47 +0000 (11:38 -0500)] 
Add missing listener threads data vs fork() protection

The following races are problematic:

- fork() occurs concurrently with listener thread receiving commands.
  - Mutexes and data structures can be left in incoherent state.
- fork() occurs concurrently with ust library destructor.
  - listen_sock can be left in incoherent state in the child.

Protect these resources with their own specific mutex.
listener_thread_data_mutex protects all data/mutexes touched by the listener
thread. It is also held across fork to make sure the child see a coherent
version of these structures.

listen_sock_mutex protects the listen_sock teardown (pthread cancel done at
libust destructor). Is is also held across fork() to protect from concurrent
teardown of listen_sock. We add a check around listen_sock teardown to see if it
has already been deleted (which could happen if the destructor runs concurrently
with fork().

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
13 years agoCode base to fix the print errors in UST (v4)
David Goulet [Thu, 3 Mar 2011 15:48:11 +0000 (10:48 -0500)] 
Code base to fix the print errors in UST (v4)

Update:
v2: Use commit_seq instead of commit_count to fix a consumerd segfault when
    accessing commit_count, since it is not mapped.
v3: Remove commented out code
v4: Remove unused variable

Signed-off-by: Yannick Brosseau <yannick.brosseau@gmail.com>
Signed-off-by: David Goulet <david.goulet@polymtl.ca>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
13 years agoustctl: Fix memory allocation problem with compatibility args
Jason Wessel [Thu, 3 Mar 2011 02:21:07 +0000 (21:21 -0500)] 
ustctl: Fix memory allocation problem with compatibility args

The parenthesis were missing to make the malloc math have the correct
precedence.  The addition needs to occur before the multiplication.
The result is the same but for clarity also change change char ** to
char * because we are allocating an array of char pointers.

Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
13 years agoustctl: fix a broken format string
Nils Carlson [Fri, 25 Feb 2011 08:39:03 +0000 (09:39 +0100)] 
ustctl: fix a broken format string

Signed-off-by: Nils Carlson <nils.carlson@ericsson.com>
13 years agoAllow backward compatibility to ustctl <= 0.11 for some commands
Jason Wessel [Thu, 24 Feb 2011 20:40:12 +0000 (21:40 +0100)] 
Allow backward compatibility to ustctl <= 0.11 for some commands

The rewrite of the ustctl broke all the existing scripts
that make use of ustctl.  This allows the original commands,
examples, and external scripts to continue working properly.

This covers the commands:

--list-markers
--list-trace-events
--alloc-trace
--start-trace
--stop-trace
--create-trace
--destroy-trace
--enable-marker
--disable-marker

Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
Signed-off-by: Nils Carlson <nils.carlson@ericsson.com>
13 years agolibustctl: use direct socket communication
Nils Carlson [Fri, 4 Feb 2011 07:24:51 +0000 (08:24 +0100)] 
libustctl: use direct socket communication

This patch changes libustctl to be socket instead of pid oriented.
The user is expected to connect to a pid using
ustctl_connect_pid(pid_t) which returns a socket file-descriptor and
then use the socket for the rest of the api. This reduces the amount
of open and closing systemcalls and also makes it possible for a
session daemon to detect process shutdown by the socket closing.

David, this ones for you. :-)

Signed-off-by: Nils Carlson <nils.carlson@ericsson.com>
Acked-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
13 years agotests: Add a comment in libustctl function tests
Nils Carlson [Thu, 24 Feb 2011 08:54:28 +0000 (09:54 +0100)] 
tests: Add a comment in libustctl function tests

Add a comment regarding activation of non-existent markers
and fix a trailing whitespace.

Signed-off-by: Nils Carlson <nils.carlson@ericsson.com>
13 years agoFix libustctl_function_tests
Yannick Brosseau [Wed, 23 Feb 2011 17:46:22 +0000 (18:46 +0100)] 
Fix libustctl_function_tests

After discussions, we concluded that the enable a non existing marker is a valid case, so we
move it to the working case section.
While being there, check that the re-enable a marker set the right errno

Signed-off-by: Yannick Brosseau <yannick.brosseau@gmail.com>
Signed-off-by: Nils Carlson <nils.carlson@ericsson.com>
13 years agolibust: Fix multiple fd close during fork v2
Nils Carlson [Wed, 23 Feb 2011 12:34:41 +0000 (13:34 +0100)] 
libust: Fix multiple fd close during fork v2

Remove superfluous fd closes during fork and also destroy all
traces instead of just "auto".

Changes since v1: Also stop all traces

Reported-by: Yannick Brosseau <yannick.brosseau@gmail.com>
Signed-off-by: Nils Carlson <nils.carlson@ericsson.com>
13 years agoAlso use short signal name for the trap function
Yannick Brosseau [Wed, 23 Feb 2011 15:10:31 +0000 (10:10 -0500)] 
Also use short signal name for the trap function

Following the switch from bash to sh, as for
commit a1bece556695c05c03d4eb83066df553c2fc56b9,
the signal name used by the trap function also need to be changed

Signed-off-by: Yannick Brosseau <yannick.brosseau@gmail.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
13 years agoInitialize _res_header variable to zero before use in process_client_cmd
Yannick Brosseau [Tue, 22 Feb 2011 23:30:30 +0000 (00:30 +0100)] 
Initialize _res_header variable to zero before use in process_client_cmd

This use of a non-initialized variable was detected by the valgrind test.

Signed-off-by: Yannick Brosseau <yannick.brosseau@gmail.com>
Acked-by: Nils Carlson <nils.carlson@ericsson.com>
13 years agoChange the valgrind test to use the libraries from the build directory
Yannick Brosseau [Tue, 22 Feb 2011 23:25:19 +0000 (00:25 +0100)] 
Change the valgrind test to use the libraries from the build directory

Also add the $USER name to all temp files so multiple users don't conflict.

Signed-off-by: Yannick Brosseau <yannick.brosseau@gmail.com>
Acked-by: Nils Carlson <nils.carlson@ericsson.com>
13 years agoTESTS: Add a delay at the start of the fork test for a more uniform testing.
Yannick Brosseau [Mon, 21 Feb 2011 19:36:09 +0000 (20:36 +0100)] 
TESTS: Add a delay at the start of the fork test for a more uniform testing.

Add a sleep to leave time for the ustconsumer thread to initialize correctly
before the fork.
Most of the time the consumer was not yet started at the time of the fork so
a bunch of initializations were not done and the fork code path was not
tested properly.

Signed-off-by: Yannick Brosseau <yannick.brosseau@gmail.com>
Acked-by: Nils Carlson <nils.carlson@ericsson.com>
13 years agoCleanup error handling in open_channel
Mathieu Desnoyers [Wed, 23 Feb 2011 04:22:44 +0000 (23:22 -0500)] 
Cleanup error handling in open_channel

Reported-by: Yannick Brosseau <yannick.brosseau@gmail.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
13 years agousttrace: use short signal names for busybox compatibility
Jason Wessel [Tue, 22 Feb 2011 22:37:25 +0000 (17:37 -0500)] 
usttrace: use short signal names for busybox compatibility

The kill command in coreutils will accept the short signal name, but
various versions of busybox will not accept the long signal name.  For
compatibility with busybox use the short signal name.

Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
13 years agousttrace: Use /bin/sh instead of /bin/bash for busybox compatibility
Jason Wessel [Tue, 22 Feb 2011 22:36:03 +0000 (17:36 -0500)] 
usttrace: Use /bin/sh instead of /bin/bash for busybox compatibility

The busybox posix like shell does not understand the "function"
directive nor does it understand the syntax for redirecting a file via
a shell expanded variable with $(<$pidfilepath).  Busybox also does
not typically provide a link to /bin/bash since busybox does not
provide bash.

It is possible to work around all these limitations in order to allow
user space tracing to work properly in a busybox based environment
with several syntax changes to the usttrace script.

Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
13 years agoadd ARM specific support for UST
Jason Wessel [Tue, 22 Feb 2011 22:34:09 +0000 (17:34 -0500)] 
add ARM specific support for UST

Add the link definition and the inline assembly required for User
Space Trace support on ARM.

[ edit: coding style cleanup ]

Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
13 years agoAdd arch-agnostic fls() fallback
Mathieu Desnoyers [Tue, 22 Feb 2011 22:29:31 +0000 (17:29 -0500)] 
Add arch-agnostic fls() fallback

In preparation for ARM port.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
13 years agomarkers: ensure assembly is portable by using .hword instead of .word
Mathieu Desnoyers [Tue, 22 Feb 2011 17:31:48 +0000 (12:31 -0500)] 
markers: ensure assembly is portable by using .hword instead of .word

http://www.chemie.fu-berlin.de/chemnet/use/info/gas/gas_7.html

.hword expressions

This expects zero or more expressions, and emits a 16 bit number for each.

This directive is a synonym for `.short'; depending on the target architecture,
it may also be a synonym for `.word'.

(caused marker struct layout discrepancy on ARM)

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
13 years agomarkers: fix: teardown should be tagged with "destructor" attribute
Mathieu Desnoyers [Tue, 22 Feb 2011 16:39:54 +0000 (11:39 -0500)] 
markers: fix: teardown should be tagged with "destructor" attribute

..rather than "constructor", which led to the core markers being removed from
the list before doing anything useful.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
13 years agotests: skip the non-functioning tracepoint test
Nils Carlson [Mon, 21 Feb 2011 13:12:14 +0000 (14:12 +0100)] 
tests: skip the non-functioning tracepoint test

Signed-off-by: Nils Carlson <nils.carlson@ericsson.com>
13 years agofix valgrind test valgrind check
Nils Carlson [Mon, 21 Feb 2011 09:17:26 +0000 (10:17 +0100)] 
fix valgrind test valgrind check

Signed-off-by: Nils Carlson <nils.carlson@ericsson.com>
13 years agoFix marker/tracepoint/trace_event lib list: expected to be sorted
Mathieu Desnoyers [Tue, 22 Feb 2011 14:15:48 +0000 (09:15 -0500)] 
Fix marker/tracepoint/trace_event lib list: expected to be sorted

Sort library lists.

List operations expect the library lists to be sorted by pointer addresses (this
was needed for iteration on kernel modules without having to hold the mutex
across read system calls). It's usefulness in userspace is debatable, but there
is clearly a bug here, since the code that iterates on the lists still expects
them to be sorted.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
13 years agoUse the libust.so and libustinstr-malloc.so from the build directory
Yannick Brosseau [Mon, 21 Feb 2011 01:30:05 +0000 (20:30 -0500)] 
Use the libust.so and libustinstr-malloc.so from the build directory

Signed-off-by: Yannick Brosseau <yannick.brosseau@gmail.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
13 years agotests: fix tap.c use of uninitialized pipe_r_file
Yannick Brosseau [Sun, 20 Feb 2011 15:19:36 +0000 (10:19 -0500)] 
tests: fix tap.c use of uninitialized pipe_r_file

[ Edit: updated patch header ]

The _tap_comment_stdout thread can start using pipe_r_file when it
is still uninitialized. Fix it by moving the initialization before the pthread
creation.

Signed-off-by: Yannick Brosseau <yannick.brosseau@gmail.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
13 years agoTest for the presence of the tracepoint_test file before running the test
Yannick Brosseau [Fri, 18 Feb 2011 21:34:06 +0000 (16:34 -0500)] 
Test for the presence of the tracepoint_test file before running the test

Since the test is disabled in the makefile, don't try to execute it in the
script.

Signed-off-by: Yannick Brosseau <yannick.brosseau@gmail.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
13 years agoAdd missing -lpthread to some tests
Yannick Brosseau [Fri, 18 Feb 2011 21:58:21 +0000 (16:58 -0500)] 
Add missing -lpthread to some tests

Signed-off-by: Yannick Brosseau <yannick.brosseau@gmail.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
13 years agoTest for the presence of valgrind in the valgrind test
Yannick Brosseau [Fri, 18 Feb 2011 21:57:43 +0000 (16:57 -0500)] 
Test for the presence of valgrind in the valgrind test

Signed-off-by: Yannick Brosseau <yannick.brosseau@gmail.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
13 years agoUse usttrace and libraries from the build directory in the test scripts
Yannick Brosseau [Fri, 18 Feb 2011 21:57:07 +0000 (16:57 -0500)] 
Use usttrace and libraries from the build directory in the test scripts

Signed-off-by: Yannick Brosseau <yannick.brosseau@gmail.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
13 years agoTry harder to find a usable lttv in the tests scripts v2
Yannick Brosseau [Fri, 18 Feb 2011 21:55:25 +0000 (16:55 -0500)] 
Try harder to find a usable lttv in the tests scripts v2

Add many more attempts to auto-detect the path to the lttv executable or
the runlttv script in trace comparison tests.
Also support setting the LTTV env variable to directly set a path the
the lttv executable in addition to the RUNLTTV variable

Changelog:
   Correctly manage multiple traces

[ Edit: fix merge conflict ]

Signed-off-by: Yannick Brosseau <yannick.brosseau@gmail.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
13 years agoFix segfault in ust_fork
Yannick Brosseau [Fri, 18 Feb 2011 21:39:07 +0000 (16:39 -0500)] 
Fix segfault in ust_fork

Move the ltt_trace_destroy after the iteration of open_buffer_list. The destroy
free the pointers used in the open_buffer_list

Signed-off-by: Yannick Brosseau <yannick.brosseau@gmail.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
13 years agoRemove marker 8-byte alignment
Mathieu Desnoyers [Thu, 17 Feb 2011 20:19:06 +0000 (15:19 -0500)] 
Remove marker 8-byte alignment

The pointer array should not by 8-byte aligned, because it breaks 32-bit archs.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
13 years agoRemove "progbits" section flag
Mathieu Desnoyers [Thu, 17 Feb 2011 20:15:20 +0000 (15:15 -0500)] 
Remove "progbits" section flag

progbits is set by default on all architectures, and the ARM gcc does not like
when it's explicitely there. So remove it.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
13 years agomarkers: fix use of ptrs
Mathieu Desnoyers [Thu, 17 Feb 2011 19:55:57 +0000 (14:55 -0500)] 
markers: fix use of ptrs

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
13 years agoTracepoints: fix use of __ptrs
Mathieu Desnoyers [Thu, 17 Feb 2011 19:55:41 +0000 (14:55 -0500)] 
Tracepoints: fix use of __ptrs

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
13 years agoTracepoints: refer to new section name
Mathieu Desnoyers [Thu, 17 Feb 2011 19:34:55 +0000 (14:34 -0500)] 
Tracepoints: refer to new section name

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
13 years agoTrace event: export pointer array
Mathieu Desnoyers [Thu, 17 Feb 2011 19:32:06 +0000 (14:32 -0500)] 
Trace event: export pointer array

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
13 years agomarkers: export pointer array instead of struct marker
Mathieu Desnoyers [Thu, 17 Feb 2011 19:18:08 +0000 (14:18 -0500)] 
markers: export pointer array instead of struct marker

Ensures we don't end up running in gcc/linker structure alignment problems by
exporting an array of pointers instead of the structures per se.

Same fix as done for tracepoints for the mainline kernel.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
13 years agotracepoints: export pointer array
Mathieu Desnoyers [Thu, 17 Feb 2011 18:25:52 +0000 (13:25 -0500)] 
tracepoints: export pointer array

Fixes odd alignment issues between linker and compiler, caused by compiler
using larger alignment values than expected for structures -- and the linker
adding unexpected padding within the sections. Use the same technique recently
introduced for Linux kernel tracepoints.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
13 years agotest_functions.sh: don't override RUNLTTV
Mathieu Desnoyers [Thu, 17 Feb 2011 18:25:19 +0000 (13:25 -0500)] 
test_functions.sh: don't override RUNLTTV

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
13 years agomarkers: assembly definition should also align on 128
Mathieu Desnoyers [Mon, 14 Feb 2011 17:22:26 +0000 (12:22 -0500)] 
markers: assembly definition should also align on 128

Needed to match the expected C layout.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
13 years agoUST markers: fix structure alignment for recent gcc
Mathieu Desnoyers [Mon, 14 Feb 2011 17:03:09 +0000 (12:03 -0500)] 
UST markers: fix structure alignment for recent gcc

GCC 4.5 (and possibly some late 4.4) choose to align structures on large
multiples, which breaks the __marker section (adding extra padding between
object sections). Increase the structure alignment to fix this issue.

Note that kernel tracepoints have recently been changed to use an array of
pointers (which are pointing to the actual tracepoint structures), thus removing
the requirement for these odd structure alignments.

But given that markers are in "maintainance mode", let's do the quick fix and
just increase the minimum alignment size.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
13 years agoRemove trace clock warning on non x86 systems
Mathieu Desnoyers [Mon, 14 Feb 2011 16:54:45 +0000 (11:54 -0500)] 
Remove trace clock warning on non x86 systems

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
13 years agoUST-wide warning fixes
David Goulet [Fri, 11 Feb 2011 21:16:11 +0000 (16:16 -0500)] 
UST-wide warning fixes

Signed-off-by: David Goulet <david.goulet@polymtl.ca>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
13 years agotype-serializer: check is cpu id is out of bound.
Mathieu Desnoyers [Thu, 10 Feb 2011 21:11:02 +0000 (16:11 -0500)] 
type-serializer: check is cpu id is out of bound.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
13 years agoFix test build issue by commenting test in makefile. to fix.
Mathieu Desnoyers [Thu, 10 Feb 2011 19:29:24 +0000 (14:29 -0500)] 
Fix test build issue by commenting test in makefile. to fix.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
13 years agoUST-wide warning fixes/bugfixes
Mathieu Desnoyers [Thu, 10 Feb 2011 18:36:54 +0000 (13:36 -0500)] 
UST-wide warning fixes/bugfixes

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
13 years agousterr: check print format even in non UST_DEBUG configs
Mathieu Desnoyers [Thu, 10 Feb 2011 18:34:48 +0000 (13:34 -0500)] 
usterr: check print format even in non UST_DEBUG configs

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
13 years agoust_safe_snprintf should check print format
Mathieu Desnoyers [Thu, 10 Feb 2011 17:46:42 +0000 (12:46 -0500)] 
ust_safe_snprintf should check print format

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
13 years agoRemove PowerPC specific time reading function
Yannick Brosseau [Thu, 10 Feb 2011 15:51:41 +0000 (10:51 -0500)] 
Remove PowerPC specific time reading function

The PPC version of the trace_clock_read64 was using the TB register
which is not constant accross implementations. The currently
measured time base on PPC was not accurate.
So, for now, we rely on the CLOCK_MONOTONIC.

This patch remove a bunch of #ifdef for x86 and PPC, since we now rely on
the same base clock. It also fix the build on PPC that was currently broken

Signed-off-by: Yannick Brosseau <yannick.brosseau@gmail.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
13 years agoAdd all tests executable to gitignore
David Goulet [Wed, 9 Feb 2011 19:11:53 +0000 (14:11 -0500)] 
Add all tests executable to gitignore

Signed-off-by: David Goulet <david.goulet@polymtl.ca>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
13 years agoAdd getcpu error validation
Mathieu Desnoyers [Wed, 9 Feb 2011 19:09:11 +0000 (14:09 -0500)] 
Add getcpu error validation

This check is important for the case where getcpu(2) is not implemented by the
Kernel. So, the CPU 0 is the fallback.

Reported-by: David Goulet <david.goulet@polymtl.ca>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
13 years agoMerge branch 'master' of ssh://git.dorsal.polymtl.ca/home/git/ust
Mathieu Desnoyers [Wed, 2 Feb 2011 21:59:17 +0000 (16:59 -0500)] 
Merge branch 'master' of ssh://git.dorsal.polymtl.ca/home/git/ust

13 years agoRemove sys/timerfd.h include from test program
Mathieu Desnoyers [Wed, 2 Feb 2011 21:57:53 +0000 (16:57 -0500)] 
Remove sys/timerfd.h include from test program

This include is not required, and adds a dependency on relatively recent
distributions (breaks Debian Lenny).

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
13 years agoRename libustcmd to libustctl
Nils Carlson [Fri, 28 Jan 2011 08:52:08 +0000 (09:52 +0100)] 
Rename libustcmd to libustctl

This patch renames libustcmd to libustctl mostly because libustctl
sounds much better but also to clarify the connection between ustctl
and libustctl.

Signed-off-by: Nils Carlson <nils.carlson@ericsson.com>
Acked-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Acked-by: David Goulet <david.goulet@polymtl.ca>
13 years agoUpdate documentation for new ustctl cli
Nils Carlson [Thu, 20 Jan 2011 11:15:54 +0000 (12:15 +0100)] 
Update documentation for new ustctl cli

Signed-off-by: Nils Carlson <nils.carlson@ericsson.com>
13 years agoUpdate test-cases for new ustctl cli
Nils Carlson [Thu, 20 Jan 2011 12:34:49 +0000 (13:34 +0100)] 
Update test-cases for new ustctl cli

Signed-off-by: Nils Carlson <nils.carlson@ericsson.com>
13 years agoustctl cli rewrite
Nils Carlson [Fri, 7 Jan 2011 14:41:27 +0000 (15:41 +0100)] 
ustctl cli rewrite

Completely re-write the ustctl cli making it behave in a similar
fashion to git. This makes more sense than using long-options
as commands.

Signed-off-by: Nils Carlson <nils.carlson@ericsson.com>
13 years agoAdd UST vs SystemTAP scalability test
Mathieu Desnoyers [Tue, 25 Jan 2011 17:26:51 +0000 (12:26 -0500)] 
Add UST vs SystemTAP scalability test

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
13 years agoChangeLog and version updates for release 0.11
Nils Carlson [Fri, 14 Jan 2011 21:15:18 +0000 (22:15 +0100)] 
ChangeLog and version updates for release 0.11

13 years agoFix a minor ugliness
Nils Carlson [Fri, 14 Jan 2011 21:08:59 +0000 (22:08 +0100)] 
Fix a minor ugliness

Variable was defined in middle of a block

13 years agoFix variable declaration of the clock source v2
David Goulet [Fri, 14 Jan 2011 17:14:31 +0000 (18:14 +0100)] 
Fix variable declaration of the clock source v2

The ust_clock_source was static in clock.h header file.
Thus, tracectl.c was not able to modify that variable for
the trace clock read function. Bad timestamp was always
returned if CLOCK_TRACE was not available.

v2:
Comment by Mathieu Desnoyers, set clock source variable
to extern in clock.h

Signed-off-by: David Goulet <david.goulet@polymtl.ca>
Acked-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Acked-by: Nils Carlson <nils.carlson@ericsson.com>
13 years agoFix the URCU version detection for autoconf version 2.65 and older
Yannick Brosseau [Fri, 14 Jan 2011 16:05:27 +0000 (17:05 +0100)] 
Fix the URCU version detection for autoconf version 2.65 and older

Signed-off-by: Yannick Brosseau <yannick.brosseau@gmail.com>
Acked-by: David Goulet <david.goulet@polymtl.ca>
Acked-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
13 years agoChangeLog and version updates for ust 0.10
Nils Carlson [Fri, 14 Jan 2011 08:02:16 +0000 (09:02 +0100)] 
ChangeLog and version updates for ust 0.10

13 years agousttrace fix variable name clash
Mathieu Desnoyers [Tue, 11 Jan 2011 16:52:29 +0000 (11:52 -0500)] 
usttrace fix variable name clash

Fix some variable name errors in the shell scripts. It does not fix my
hang, but might help.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Acked-by: Nils Carlson <nils.carlson@ericsson.com>
13 years agoAt runtime, UST checks if the LTTng clock source is available
Julien Desfossez [Wed, 12 Jan 2011 08:36:37 +0000 (09:36 +0100)] 
At runtime, UST checks if the LTTng clock source is available
If not, CLOCK_MONOTONIC is the default fallback.

This makes UST use the LTTng kernel clock source. With this
clock support, LTTng and UST traces are perfectly synchronize.
Traces from these two tracer can be merged for analysis.

LTTng 0.240 or higher is needed for this new clock source.

Signed-off-by: Julien Desfossez <julien.desfossez@polymtl.ca>
Signed-off-by: David Goulet <david.goulet@polymtl.ca>
Acked-by: Nils Carlson <nils.carlson@ericsson.com>
13 years agoAdd a test to valide that we use URCU with a minimum version of 0.5
Yannick Brosseau [Mon, 10 Jan 2011 19:20:56 +0000 (20:20 +0100)] 
Add a test to valide that we use URCU with a minimum version of 0.5

Signed-off-by: Yannick Brosseau <yannick.brosseau@gmail.com>
Acked-by: Nils Carlson <nils.carlson@ericsson.com>
13 years agoRename libustd to libustconsumer and ustd to ust-consumerd
Nils Carlson [Wed, 5 Jan 2011 12:53:43 +0000 (13:53 +0100)] 
Rename libustd to libustconsumer and ustd to ust-consumerd

This is a fargoing but necessary renaming of some ust components.
The point of the renaming is to allow for a new daemon, ustd, which
will be able to keep track of tracing sessions and connect applications
with consumers. Also, the current names were non-sensical.

This patch is a step on the way towards creating a session daemon
that can connect trace producers and consumers in a nice way.

Signed-off-by: Nils Carlson <nils.carlson@ericsson.com>
13 years agoGeneralize some ustcomm functionality
Nils Carlson [Wed, 29 Dec 2010 14:01:06 +0000 (15:01 +0100)] 
Generalize some ustcomm functionality

There were multiple cases of only a single text field being sent
with ustcomm. This commit merges these into a single case.

Signed-off-by: Nils Carlson <nils.carlson@ericsson.com>
13 years agoFix freeing of channels and buffers in buffers.c v2
Nils Carlson [Tue, 30 Nov 2010 13:36:30 +0000 (14:36 +0100)] 
Fix freeing of channels and buffers in buffers.c v2

Changes since v1:
Handle new naming conventions

buffers.c appeared to be very convoluted full of krefs and in
general very bad shape. I have tried to make the freeing and
unmapping of shared memory symmetrical in the sense that every
open has a corresponding close and every map has a corresponding
unmap.

I have removed all use of krefs. Assuming no concurrency this
should be fine. The kref usage was anyway broken.

Signed-off-by: Nils Carlson <nils.carlson@ericsson.com>
13 years agoChangeLog and version updates for release 0.9
Nils Carlson [Fri, 3 Dec 2010 14:41:41 +0000 (15:41 +0100)] 
ChangeLog and version updates for release 0.9

13 years agoFix info automake and clean doc automake
Nils Carlson [Tue, 30 Nov 2010 13:11:23 +0000 (14:11 +0100)] 
Fix info automake and clean doc automake

Fix so that info is built using automake and also clean up the
automake process so that make clean works.

Signed-off-by: Nils Carlson <nils.carlson@ericsson.com>
Acked-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
13 years agoUpdate manpage for option -o of usttrace
David Goulet [Sat, 27 Nov 2010 19:09:32 +0000 (14:09 -0500)] 
Update manpage for option -o of usttrace

Signed-off-by: David Goulet <david.goulet@polymtl.ca>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
13 years agoRemove unuse header disable.h
David Goulet [Sat, 27 Nov 2010 19:08:06 +0000 (14:08 -0500)] 
Remove unuse header disable.h

Signed-off-by: David Goulet <david.goulet@polymtl.ca>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
13 years agoRemove kref from kcompat's headers and code
David Goulet [Sat, 27 Nov 2010 19:07:08 +0000 (14:07 -0500)] 
Remove kref from kcompat's headers and code

It contains the exact same code of urcu_ref.h. The kref
struct and methods are replaced by those from liburcu.

Signed-off-by: David Goulet <david.goulet@polymtl.ca>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
13 years agoRemove hlist from kcompat's headers and code
David Goulet [Sat, 27 Nov 2010 19:05:07 +0000 (14:05 -0500)] 
Remove hlist from kcompat's headers and code

The hlist structure is no longer needed since it's the exact
same implementation in liburcu.

Signed-off-by: David Goulet <david.goulet@polymtl.ca>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
13 years agoFix Bug#604955: ust: FTBFS
Mathieu Desnoyers [Fri, 26 Nov 2010 01:01:51 +0000 (20:01 -0500)] 
Fix Bug#604955: ust: FTBFS

> Regarding the above subject, Your package FTBFS on ubuntu due to
> indirect linking

Fixed the test program by adding "-lpthread -lrt" to Makefile.am.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
13 years agoRename for the new liburcu API namespace
Mathieu Desnoyers [Fri, 19 Nov 2010 04:27:24 +0000 (23:27 -0500)] 
Rename for the new liburcu API namespace

This commit makes UST compatible with liburcu 0.5.2

Signed-off-by: David Goulet <david.goulet@polymtl.ca>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
13 years agoAdd libtool to .gitignore
Mathieu Desnoyers [Fri, 19 Nov 2010 04:22:53 +0000 (23:22 -0500)] 
Add libtool to .gitignore

Signed-off-by: David Goulet <david.goulet@polymtl.ca>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
13 years agoAdd output directory option to usttrace
David Goulet [Thu, 18 Nov 2010 17:08:03 +0000 (12:08 -0500)] 
Add output directory option to usttrace

This patch add the -o option to usttrace to control the output directory
given to the UST daemon.

Signed-off-by: David Goulet <david.goulet@polymtl.ca>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
13 years agoAdd trace name handling throughout tracectl, ustcomm and ustcmd
Nils Carlson [Thu, 4 Nov 2010 16:45:06 +0000 (17:45 +0100)] 
Add trace name handling throughout tracectl, ustcomm and ustcmd

This patch is the first real step in allowing multi-session
tracing. It pushes trace name all the way out to libustcmd
(though not yet to ustctl) and trace session support all
the way into tracectl in libust (though not yet down to markers).

Signed-off-by: Nils Carlson <nils.carlson@ericsson.com>
Acked-by: David Goulet <david.goulet@polymtl.ca>
13 years agoAdd ustcomm_trace_info struct and support functions to ustcomm
Nils Carlson [Thu, 4 Nov 2010 16:44:12 +0000 (17:44 +0100)] 
Add ustcomm_trace_info struct and support functions to ustcomm

Signed-off-by: Nils Carlson <nils.carlson@ericsson.com>
Acked-by: David Goulet <david.goulet@polymtl.ca>
14 years agoKill some unused code in ustcomm.c
Nils Carlson [Thu, 4 Nov 2010 16:15:10 +0000 (17:15 +0100)] 
Kill some unused code in ustcomm.c

Signed-off-by: Nils Carlson<nils.carlson@ericsson.com>
Acked-by: David Goulet <david.goulet@polymtl.ca>
14 years agoChangeLog and version updates for release 0.8
Nils Carlson [Tue, 26 Oct 2010 17:48:12 +0000 (19:48 +0200)] 
ChangeLog and version updates for release 0.8

14 years agoMake tracectl destructor aware of fork status
Nils Carlson [Mon, 25 Oct 2010 10:57:30 +0000 (12:57 +0200)] 
Make tracectl destructor aware of fork status

This little patch checks to see whether we have used a fork
wrapper to fork. If not we won't have a working UST in the process
and can skip the destructor stage.

Signed-off-by: Nils Carlson <nils.carlson@ericsson.com>
Acked-by: David Goulet <david.goulet@polymtl.ca>
14 years agoFunction tests for libustcmd and a C tap library
Nils Carlson [Mon, 25 Oct 2010 10:06:31 +0000 (12:06 +0200)] 
Function tests for libustcmd and a C tap library

This is a bunch of function tests for libustcmd, checking return
values and other things and emitting output directly in TAP format.

I wanted to get better feedback on what is working and what isn't
and also check that functions return intelligent values. The function
tests currently run without ustd. Eventually I want to link ustd into
the testcase as well to check that functions return errors if no ustd
instance was reachable, but right now it's enough that we get some
general feedback.

Signed-off-by: Nils Carlson <nils.carlson@ericsson.com>
Acked-by: David Goulet <david.goulet@polymtl.ca>
14 years agoIntroduce a new communication protocol for UST v5
Nils Carlson [Mon, 11 Oct 2010 14:10:30 +0000 (16:10 +0200)] 
Introduce a new communication protocol for UST v5

Changes since v4:
More scanning fixes in ustctl

Changes since v3:
Fix minor bugs in ustctl

Changes since v2:
Fix packing of the socket path and ustcmd handling
of socket path

Changes since v1:
Update after comments from David Goulet,
fix some style issues, a bug in GET_SOCK_PATH and
add a fixme for posterity.

This is once again a bit of a code-dump. The principal of this
patch is to get rid of most string parsing in UST and most
dynamic heap memory allocation by libust. A secondary goal
has been to introduce a command-response model so all commands
receive responses with a result code. This has been achived
through the following steps.

 1. Create standardised message containers as structs ending in
    a char array. The char array is used to pack strings into
    while pointers in the struct point positions relative the data
    segment in the struct. Unpacking the struct upon reception is
    a simple matter of adding to the pointers the position in memory
    of the char array.

2.  Keeping a char array permanently allocated in libust that is
    used to receive incoming data, avoiding allocation. This array
    is large enough to receive any of the pre-defined message
    structs.

3.  Replacing all string matching for commands with enum based switch
    statements. This will scale better over time.

4.  All commands now receive responses containing a result as a negative
    errno. Libustcmd now returns -1 and sets errno according to these.
    Eventually these will need to be documented in manpages with
    what each errno implies. Ustctl needs to check these in turn and
    give meaningfull feedback.

5.  Cleaning up tracectl.c quite a bit separating out control functions
    and message handling.

6.  Move channel marker scanning from tracectl out to ustctl.

Fifth is a pain

Signed-off-by: Nils Carlson <nils.carlson@ericsson.com>
Acked-by: David Goulet <david.goulet@polymtl.ca>
14 years agoRemove a silly print out in ust_trace.h
Nils Carlson [Tue, 12 Oct 2010 08:13:37 +0000 (10:13 +0200)] 
Remove a silly print out in ust_trace.h

Signed-off-by: Nils Carlson <nils.carlson@ericsson.com>
Acked-by: David Goulet <david.goulet@polymtl.ca>
14 years agoAdd a valgrind suppression for sendmsg (v2)
Nils Carlson [Mon, 11 Oct 2010 15:01:32 +0000 (17:01 +0200)] 
Add a valgrind suppression for sendmsg (v2)

Changes since v1: Make the suppression match libc and
libpthread, multiple versions.

For some reason valgrind thinks the iov array in ustcomm_send_fd
is used uninitialised. Add a suppression so this won't show as
an error.

Signed-off-by: Nils Carlson <nils.carlson@ericsson.com>
Acked-by: David Goulet <david.goulet@polymtl.ca>
14 years agoAdd a tracepoint test program
David Goulet [Fri, 1 Oct 2010 19:19:57 +0000 (21:19 +0200)] 
Add a tracepoint test program

This test is aimed at testing different tracepoint case and
be used to ensure no bugs are added.

Complete description of the test in tracepoint_test.c

Signed-off-by: David Goulet <david.goulet@polymtl.ca>
Acked-by: Nils Carlson <nils.carlson@ericsson.com>
14 years agoUpdate the COPYING file to state the correct license
Nils Carlson [Mon, 11 Oct 2010 13:28:18 +0000 (15:28 +0200)] 
Update the COPYING file to state the correct license

Update the COPYING file to the most applicable license and
add more attributions.

Signed-off-by: Nils Carlson <nils.carlson@ericsson.com>
14 years agoFix missing data pointer
David Goulet [Thu, 30 Sep 2010 18:52:55 +0000 (20:52 +0200)] 
Fix missing data pointer

This applies to tracepoint using a marker (trace_mark_tp)

At commit 9dec086e052cf7f583a3afaa3aab48a6de8d38ac,
the tracepoint_probe_register/unregister_noupdate function has been
changed with the addition of a void data pointer. In set_marker(),
the call to that function was not updated with this new parameter.
The effect was that on a second register_trace with an already
registered probe, the data ptr was corrupted with false data and
thus the probe checking failed to validate duplicates. So, the same
data was reproduced for a single trace call. Same behavior for
unregistering the marker, it was not found.

NOTE : For now, this pointer is NULL because we don't have at this
point tracing session.

Signed-off-by: David Goulet <david.goulet@polymtl.ca>
Acked-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
14 years agoFix insecure library loading (Debian Bug #598309, CVE-2010-3386) (v2)
Mathieu Desnoyers [Thu, 30 Sep 2010 14:49:05 +0000 (16:49 +0200)] 
Fix insecure library loading (Debian Bug #598309, CVE-2010-3386) (v2)

Thanks to Raphael Geissert for spotting this, and to Jon Bernard for forwarding
the information to us.

Changelog since v1:
Apply comments from Nils.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Acked-by: Nils Carlson <nils.carlson@ericsson.com>
CC: Raphael Geissert <geissert@debian.org>
CC: Jon Bernard <jbernard@debian.org>
14 years agoFix a zmalloc bug
Nils Carlson [Thu, 30 Sep 2010 08:09:04 +0000 (10:09 +0200)] 
Fix a zmalloc bug

sizeof(void *) was allocated instead of sizeof(struct probe).

Signed-off-by: Nils Carlson <nils.carlson@ericsson.com>
14 years agoNew naming convention for internal macros
David Goulet [Tue, 28 Sep 2010 13:05:49 +0000 (15:05 +0200)] 
New naming convention for internal macros

This is the first patch introducing the new naming convention
for the UST tracer. To prevent namespace pollution, _ust_ prefix
is added to internal macros which are visible in the global header.

For this patch, only the container_of macro is renamed and the
redundant definition in kcompat/simple.h is removed.

Signed-off-by: David Goulet <david.goulet@polymtl.ca>
Acked-by: Nils Carlson <nils.carlson@ericsson.com>
14 years agoRe-write ustcomm parts of UST v2
Nils Carlson [Mon, 27 Sep 2010 08:54:48 +0000 (10:54 +0200)] 
Re-write ustcomm parts of UST v2

Changes since v1:

Updated after comments from David Goulet and resulting insights.
* Add a continue after a failed accept
* Fix some malloc issues
* Fix some coding style in the patch
* make del_named_sock free the memory, even if all else fails.

Notice: valgrind test-case currently broken. Needs an exception.

Description:

This is a very big patch, and so it requires a bit of explaining.

This patch is a step on the way of accomplishing serveral goals I have in this
area:

1. Use enums for commands and eliminate text-based commands. This does not mean
   that we will stop processing strings for trace/channel and marker names;
   just that the long series of if statements with token and string matching
   will be replaced with a switch statement. To this end I have created a
   ustcomm_header struct that contains the length of the data-field and some
   other fields. This allows us to first receive the header, allocate memory
   for the data and then receive the data; eliminating all scanning of messages.

2. Reduce the complexity of the implementation. To put it simply, I don't like
   callbacks. They reduce transparency and make it difficult to follow the
   flow of the code; so I have eliminated multipoll replacing it with a normal
   epoll. I have also replaced almost all the different server, connection and
   source structs with one, called ustcomm_sock.

3. Make ustd scale better. Currently ustd scales terribly. We allocate one
   thread per-cpu per-channel per-process, five applications each with three
   channels on a four cpu machine leads to 5*3*4=60 threads. Part of the reason
   for this multitude of threads was that we used a ustcomm_request call
   (consisting of a send and a receive) to wait for a subbuffer to be written.
   The sequence for a subbuffer to be written was as follows:

      Ustd calls send with a 'get_subbuffer' command, and then recv in one of
      the threads and hangs on the recv on the socket.

      Upon filling the subbuffer the traced app writes '1' to a pipe.

      The ust_thread inside the app which was listening to the other end of the
      pipe wakes up when the '1' is written. The callback from multipoll calls
      a send which sends a reply to the ustd thread over the socket.

      The ustd thread wakes up and reads the message, continuing along in its
      execution.

   I replace this with a bit of a different mechanism, which should allow us
   to eventually reduce the number of threads to one per cpu:

      Ustd requests a buffer_fd which causes the ustd_thread inside the app
      to send the file-descriptor for the read en of the pipe to ustd.

      The ustd thread now does a read on the pipe, halting its execution until
      the app fills the subbuffer and writes '1' to the pipe, waking up the ustd
      thread.

      Ustd now makes the 'get_subbuffer' call which the ust_thread inside the
      app responds to with information about the subbuffer. Writes it and then
      goes back to the read call, hanging on the pipe.

   So we are still stuck on the multitude of threads, but we are in much better
   position to move forward. Replacing the read with an epoll statement and then
   pointing the epoll event data at the buffer struct containing the current
   buffer to whitch the pipe belongs should be relatively easy. We can then
   instead of spawning a new thread for each buffer just allocate the
   buffer_info struct and assign it to one of the per-cpu threads in ustd to
   poll on.

4. Replace poll with epoll which scales better, especially for
   events << (nr of fds). This is complete.

5. Allow UST to handle arbitrarily long unix socket names. This is done by
   carefull allocation of the socketaddr_un struct with a dynamic length.
   Truncating is ugly and dangerous.

There is a lot of work still left to be done. This is only the first of a
number of patches that I expect in this area. If someone feels like tackling
ustd head on to reduce the number of threads that would be great.

I have kept Pierre-Marc's form of error handling for the I/O wrapping functions
because I want to propagate return codes up to the apps that are using them
so they can close file-descriptors and free associated resources. If somebody
knows of a better approach please make yourself heard.

Signed-off-by: Nils Carlson <nils.carlson@ericsson.com>
Acked-by: David Goulet <david.goulet@polymtl.ca>
14 years agoFix a strange bash anomaly in test_functions.sh
Nils Carlson [Wed, 22 Sep 2010 07:05:03 +0000 (09:05 +0200)] 
Fix a strange bash anomaly in test_functions.sh

If anybody has time time to investigate this that would be great.
Unforunately, I don't.

Signed-off-by: Nils Carlson <nils.carlson@ericsson.com>
This page took 0.056862 seconds and 4 git commands to generate.