ust.git
13 years agoversion update to 0.13 v0.13
Nils Carlson [Thu, 19 May 2011 07:32:10 +0000 (09:32 +0200)] 
version update to 0.13

13 years agoChangeLog updates for 0.13 v2
Nils Carlson [Wed, 18 May 2011 20:00:59 +0000 (22:00 +0200)] 
ChangeLog updates for 0.13 v2

13 years agoadd missing usterr_signal_safe.h to makefile
Nils Carlson [Thu, 19 May 2011 07:43:16 +0000 (09:43 +0200)] 
add missing usterr_signal_safe.h to makefile

Signed-off-by: Nils Carlson <nils.carlson@ericsson.com>
13 years agoNew fast-exit test-case
Nils Carlson [Tue, 17 May 2011 13:16:47 +0000 (15:16 +0200)] 
New fast-exit test-case

A fast-exit test-case that just writes one marker and exits,
tests that the consumer daemon maps the buffers before the
program exits. Exiting is tested both by normal return
and by commiting suicide (SIGKILL to self).

Signed-off-by: Nils Carlson <nils.carlson@ericsson.com>
Acked-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
13 years agoMake libustctl list only online pids v3
Nils Carlson [Mon, 16 May 2011 13:57:15 +0000 (15:57 +0200)] 
Make libustctl list only online pids v3

Changes since v2:
Botox.

Changes since v1:
Cosmetic surgery at a european cost

Previously libustctl would list all pids. This patch changes this
so only online pids are listed. This is done by appending on each
socket name the mtime from the proc/<pid> directory. This way a
socket can be checked to see if the appended mtime matches the
mtime of the proc dir for the current pid, thus allowing us to
distinguish between old and new socket files.

Signed-off-by: Nils Carlson <nils.carlson@ericsson.com>
Acked-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
13 years agochange runtests GPL version
Nils Carlson [Fri, 6 May 2011 12:32:54 +0000 (14:32 +0200)] 
change runtests GPL version

Signed-off-by: Nils Carlson <nils.carlson@ericsson.com>
13 years agoarmv5 archs require write alignment
Jason Wessel [Wed, 4 May 2011 19:35:20 +0000 (15:35 -0400)] 
armv5 archs require write alignment

Reads and writes to unsigned int 32 bit numbers must be address
aligned or the l2 cache can return junk in the high order 16 bits on
reads.

This patch activates the original work done for alignment in ltt for
the UST code.  The config.ac changes will isolate the use of alignment
to the known arch type with the problem.

Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
13 years agoOnly ignore the top config.h.in
Jason Wessel [Wed, 4 May 2011 19:32:59 +0000 (15:32 -0400)] 
Only ignore the top config.h.in

Only he top config.h.in is autogenerated the include/ust/config.h.in
is a source controled file.

Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
13 years agoadd mips support
Jason Wessel [Tue, 26 Apr 2011 21:55:55 +0000 (23:55 +0200)] 
add mips support

The recent changes to UST make it trivial to add MIPS support.

The trick for MIPS is that there are many different library formats
and the gcc 4.x compiler will correctly choose the default one so long
as the libust.ldscript.in does not not make a reference to the library
format.

Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
Signed-off-by: Nils Carlson <nils.carlson@ericsson.com>
13 years agosupport busybox for manual trace tests
Jason Wessel [Wed, 27 Apr 2011 20:22:16 +0000 (22:22 +0200)] 
support busybox for manual trace tests

The busybox version of find does not support using -L, and it does not
appear to be needed in order to pass the test.  In the interest of
being able to run internal UST tests on a busybox based rootfs,
appropriately detect if -L is available as an argument to find and use
it when it is available.

Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
Signed-off-by: Nils Carlson <nils.carlson@ericsson.com>
13 years agoust-consumerd: fix exit race log corruption
Jason Wessel [Wed, 27 Apr 2011 20:22:15 +0000 (22:22 +0200)] 
ust-consumerd: fix exit race log corruption

In the following scenario on an SMP system the ust-consumerd can end
up not properly closing out file handles which leads to log
corruption:
  * usttrace -m -l small_quick_app_lots_of_malloc_and_free
  * The app completes and usttrace sees and sends the SIGTERM to ust-consumerd
  * The ust-consumerd main thread will exit and the _exit() handlers
    kills off the remaining pthreads without everything getting closed out

The solution to the problem is to introduce an active_thread count for
the private ustconsumer_instance.  This counter will be zeroed out
when it is safe to completely shutdown the main thread, which will
subsequently run the _exit() handlers.

Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
Signed-off-by: Nils Carlson <nils.carlson@ericsson.com>
13 years agoust-consumerd: fix exit race crashes
Jason Wessel [Wed, 27 Apr 2011 20:22:14 +0000 (22:22 +0200)] 
ust-consumerd: fix exit race crashes

The ust-consumerd gets shutdown by the SIGTERM signal and a number of
places in the ust-consumerd did not properly deal with the case where
a system call returns EINTR in errno as a result of a signal to the
process.  The failure to handle EINTR properly was leading to some
data corruption in the buffer code and causing some random "victim"
crashes in lowlevel.c

The way all the offending functions were tracked down was to
temporarily add an abort() in the SIGTERM signal handler.  Then it was
a matter of looking at what threads were blocked on system calls at
the time outside of the thread that received the signal.

Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
Signed-off-by: Nils Carlson <nils.carlson@ericsson.com>
13 years agoMarkers: temporarily remove GDB support
Mathieu Desnoyers [Tue, 26 Apr 2011 21:31:35 +0000 (17:31 -0400)] 
Markers: temporarily remove GDB support

Remove GDB support temporarily, awaiting a better implementation that
does not require so much asm trickery. Imported the kernel LTTng code
back into UST to use C declarations for the marker structures.

The plan is to move to a SDT-based implementation (using variable
number of arguments).

This patch is required to make the MIPS port work. Tested by Jason
Wessel.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Tested-by: Jason Wessel <jason.wessel@windriver.com>
13 years agoTracepoint: make tracepoint ptrs section rw
Mathieu Desnoyers [Tue, 26 Apr 2011 16:18:45 +0000 (12:18 -0400)] 
Tracepoint: make tracepoint ptrs section rw

The pointer section needs to be rw so that the linker can update the
pointers at link-time, thus allowing the code to be compiled with -fPIC.

The previous behavior would cause section flag mismatch, because
TRACEPOINT_LIB declared the ptr with "= NULL", which is not a void *
const, but rather a void *, which forces the element it is assigned to
to become non-const.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
13 years agoAdd missing string.h include in libustctl_function_tests
Mathieu Desnoyers [Tue, 26 Apr 2011 15:52:31 +0000 (11:52 -0400)] 
Add missing string.h include in libustctl_function_tests

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
13 years agoMarkers: ust_marker_[A-Z] -> UST_MARKER_[A-Z] cleanup
Mathieu Desnoyers [Mon, 25 Apr 2011 19:02:50 +0000 (15:02 -0400)] 
Markers: ust_marker_[A-Z] -> UST_MARKER_[A-Z] cleanup

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
13 years agoMarkers: Add MARKER_LIB backward compatibility
Mathieu Desnoyers [Mon, 25 Apr 2011 17:53:18 +0000 (13:53 -0400)] 
Markers: Add MARKER_LIB backward compatibility

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
13 years agoMarkers: trace_mark should not pass "ust" to ust_mark
Mathieu Desnoyers [Mon, 25 Apr 2011 17:44:46 +0000 (13:44 -0400)] 
Markers: trace_mark should not pass "ust" to ust_mark

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
13 years agoMarkers: fix compatility trace_mark
Mathieu Desnoyers [Mon, 25 Apr 2011 17:38:52 +0000 (13:38 -0400)] 
Markers: fix compatility trace_mark

When providing no args, we need to paste args with ## args.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
13 years agoAdd MARK_NOARGS compatibility API, marked for deprecation.
Mathieu Desnoyers [Mon, 25 Apr 2011 17:34:40 +0000 (13:34 -0400)] 
Add MARK_NOARGS compatibility API, marked for deprecation.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
13 years agoAdd "trace_mark()" compatibility API (progressive deprecation)
Mathieu Desnoyers [Mon, 25 Apr 2011 17:25:41 +0000 (13:25 -0400)] 
Add "trace_mark()" compatibility API (progressive deprecation)

Add back the trace_mark() API for backward compability, tagging it as
being slowly being deprecated.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
13 years agoUpdate manual
Mathieu Desnoyers [Fri, 22 Apr 2011 18:25:49 +0000 (14:25 -0400)] 
Update manual

Update info manual to reflect the latest instrumentation API changes for
both tracepoints and markers.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
13 years agoTracepoints: Introduce DEFINE/DECLARE_TRACEPOINT, TRACEPOINT_EVENT...
Mathieu Desnoyers [Fri, 22 Apr 2011 18:22:44 +0000 (14:22 -0400)] 
Tracepoints: Introduce DEFINE/DECLARE_TRACEPOINT, TRACEPOINT_EVENT...

* Instrumentation API change *

Introduce the upcoming "TRACEPOINT_EVENT" API:

TRACEPOINT_EVENT
TRACEPOINT_CREATE_PROBES
TRACEPOINT_EVENT_LIB

And move the current tracepoint declaration/definition to a more
standard name (these will become internal API when we switch to
TRACEPOINT_EVENT):

DEFINE_TRACEPOINT
DECLARE_TRACEPOINT

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
13 years agoRemove #define _LGPL_SOURCE from public headers
Mathieu Desnoyers [Fri, 22 Apr 2011 17:19:18 +0000 (13:19 -0400)] 
Remove #define _LGPL_SOURCE from public headers

this header can be included by non-LGPL applications. Ensure that
use it.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
13 years agoMarkers: make __ust_marker_ptrs PIC
Mathieu Desnoyers [Tue, 19 Apr 2011 01:21:31 +0000 (21:21 -0400)] 
Markers: make __ust_marker_ptrs PIC

> As I prepared the 0.12 release for Debian, I noticed that libust.so was
> not PIC:
>
>     $ readelf -d libust/.libs/libust.so.0.0.0 | grep TEXTREL
>     0x0000000000000016 (TEXTREL)            0x0
>
> Since all of the objects in libust are built with -fPIC, I thought
> perhaps there was some assembly added between 0.11 and 0.12 that
> contained text relocations. I bisected the two tags down to the
> offending commit:
>
>     eb5d20c68aaf73661ffc02ba8fea3683c0358702
>
> Within that commit, it seems to be a problem in include/ust/marker.h
> with these lines:
>
> @@ -129,7 +124,12 @@ struct marker {
> [...]
> +                       /*".section __markers_ptrs\n\t"*/ \
> +                       ".section __markers_ptrs,\"a\",@progbits\n\t"                           \
>
> If I make the __markers_ptrs section writable, with:
>
>                         ".section __markers_ptrs,\"aw\"\n\t
>
> TEXTREL goes away and everything seems okay, tests pass. Is this
> a correct solution? I don't understand why the section must be writable
> to avoid relocations, can anyone explain?

Oh.. I think I see. __markers_ptrs contains pointers to another section
that must be populated by the dynamic linker (thus at runtime). If the
section is read-only, the linker cannot update them at load time, so a
relocation table is probably needed.

Reported-by: Jon Bernard <jbernard@debian.org>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
13 years agoLGPLv2.1 relicensing agreements
Mathieu Desnoyers [Wed, 13 Apr 2011 20:45:38 +0000 (16:45 -0400)] 
LGPLv2.1 relicensing agreements

Steven just stated clearly that he only accepts relicencing to
LGPLv2.1 (not later). So I think we might have been interpreting his
previous acceptance a little too broadly when specifying "LGPLV2.1+".
Change the licensing text to reflect this.

If some of the contributors specifically said they were OK with "or
later", we could add this back upon rechecking their original acceptance
email. The pointers to the original public emails should have been
present in the relicensing file to make our current job easier, but this
is unfortunately not the case.

Also updated the stringify.h, tracepoint.c, marker.c and trace_event.c
files.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
13 years agoTracepoints: namespace cleanups
Mathieu Desnoyers [Wed, 13 Apr 2011 20:17:57 +0000 (16:17 -0400)] 
Tracepoints: namespace cleanups

All internal symbols, no API change. Enforce "tracepoint_" or "tp_"
prefixes to local symbols, as well as rename struct probes to struct
tracepoint_probes.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
13 years agoRemove "struct module" from tracepoint.h (unused)
Mathieu Desnoyers [Wed, 13 Apr 2011 20:00:34 +0000 (16:00 -0400)] 
Remove "struct module" from tracepoint.h (unused)

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
13 years agoRemove immediate values code (non-effective anyway)
Mathieu Desnoyers [Wed, 13 Apr 2011 19:57:39 +0000 (15:57 -0400)] 
Remove immediate values code (non-effective anyway)

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
13 years agoMarkers: Namespace cleanup, with API change.
Mathieu Desnoyers [Wed, 13 Apr 2011 19:45:48 +0000 (15:45 -0400)] 
Markers: Namespace cleanup, with API change.

** API change: MARK_NOARGS becomes UST_MARKER_NOARGS **

Cleanup the "marker" namespace by using "ust_marker/UST_MARKER".

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
13 years agoTest empty argument tracepoint
Mathieu Desnoyers [Wed, 13 Apr 2011 18:01:01 +0000 (14:01 -0400)] 
Test empty argument tracepoint

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Acked-by: Nils Carlson <nils.carlson@ericsson.com>
13 years agoTracepoints: add noargs support
Mathieu Desnoyers [Wed, 13 Apr 2011 18:00:21 +0000 (14:00 -0400)] 
Tracepoints: add noargs support

Add support for tracepoints receiving no argument as parameters. Copied
from Linux kernel:

commit 38516ab59fbc5b3bb278cf5e1fe2867c70cff32e
Author: Steven Rostedt <srostedt@redhat.com>
Date:   Tue Apr 20 17:04:50 2010 -0400

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
CC: Nils Carlson <nils.carlson@ericsson.com>
CC: Steven Rostedt <rostedt@goodmis.org>
13 years agoTracepoints: add wrapper tracepoint() macro
Mathieu Desnoyers [Wed, 13 Apr 2011 17:59:16 +0000 (13:59 -0400)] 
Tracepoints: add wrapper tracepoint() macro

** Instrumentation API change **

Moving tracepoints from

trace_name(args)
register_trace_name(...)
unregister_trace_name(...)

to

tracepoint(name, args)
register_tracepoint(name, ...)
unregister_tracepoint(name, ...)

This will allow doing macro tricks at the "tracepoint()" macro expansion
site. This will be useful for integration with SystemTAP probes, which
needs to expand an inline assembly with constraints on the arguments.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
CC: Nils Carlson <nils.carlson@ericsson.com>
CC: Steven Rostedt <srostedt@redhat.com>
CC: Josh Stone <jistone@redhat.com>
13 years agoMarkers: API change: rename trace_mark() to ust_marker()
Mathieu Desnoyers [Wed, 13 Apr 2011 17:46:23 +0000 (13:46 -0400)] 
Markers: API change: rename trace_mark() to ust_marker()

Given that the markers will stay as debug-only "quick and dirty"
tracing interface, make them UST-specific. Make it clear by turning the
API to ust_marker().

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
13 years agoMerge branch 'master' of ssh://git.lttng.org/home/git/ust
Mathieu Desnoyers [Wed, 13 Apr 2011 17:28:53 +0000 (13:28 -0400)] 
Merge branch 'master' of ssh://git.lttng.org/home/git/ust

13 years agoFix up all use of /dev/stderr for portability to busybox /bin/sh
Jason Wessel [Tue, 12 Apr 2011 19:11:36 +0000 (21:11 +0200)] 
Fix up all use of /dev/stderr for portability to busybox /bin/sh

The typical shell on a small embedded target using busybox does
not have support for /dev/stderr.  A more portable way to send
output to stderr with echo is to redirect stdout to stderr with
1>&2.

In the usttrace script it did something that was effectively
a NOP.  The result of echo "" 2>/dev/stderr is not actually
going to send anything to stderr because the echo is going
to write to stdout.  This case was also fixed.

Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
Signed-off-by: Nils Carlson <nils.carlson@ericsson.com>
13 years agoMarkers: remove channel name from trace_mark()
Mathieu Desnoyers [Sun, 10 Apr 2011 22:15:40 +0000 (15:15 -0700)] 
Markers: remove channel name from trace_mark()

*** This is an instrumentation API change ***

Given that UST will gradually move to a scheme where channels are
dynamically associated with markers on a per tracing session basis (and
thus associated dynamically rather than fixed statically), it does not
make sense to specify the "channel name" in addition to the marker name
in the trace_mark() arguments.

API touched:

GET_MARKER()
DEFINE_MARKER()
DEFINE_MARKER_TP()
trace_mark()
_trace_mark()

I'm introducing this API change without changing the underlying
implementation, trying to minimize the impact of API changes by doing
them sooner than later.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
13 years agoMake only libust and libustconsumer use a signal safe usterr.h
Nils Carlson [Mon, 4 Apr 2011 10:49:56 +0000 (12:49 +0200)] 
Make only libust and libustconsumer use a signal safe usterr.h

Copy usterr.h to usterr_signal_safe.h and rewrite those parts of
usterr.h that depended on libustsnprintf. This removes the dependency
on libustsnprintf from all parts of ust except libust.

Signed-off-by: Nils Carlson <nils.carlson@ericsson.com>
Acked-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
13 years agolibustctl: cleanup ustctl_get_online_pids functions
Nils Carlson [Fri, 1 Apr 2011 12:38:38 +0000 (14:38 +0200)] 
libustctl: cleanup ustctl_get_online_pids functions

Cleanup the ustctl_get_online_pids functions, checking more errors
and making the allocation strategy sane.

Signed-off-by: Nils Carlson <nils.carlson@ericsson.com>
13 years agoMake root able to connect to any traceable app
Nils Carlson [Thu, 31 Mar 2011 08:25:11 +0000 (10:25 +0200)] 
Make root able to connect to any traceable app

Make root able to connect to any traceable app, checking
(geteuid == 0).

Signed-off-by: Nils Carlson <nils.carlson@ericsson.com>
13 years agoMake root see all available pids v2
Nils Carlson [Wed, 30 Mar 2011 14:55:38 +0000 (16:55 +0200)] 
Make root see all available pids v2

Changes since v1:
* Fix a whitespace
* Make functions that should be static static

Allow root (geteuid() == 0) to see all pids. This way the super-user
can connect to any program. A step on the way of carefully outlining
what UST does and doesn't.

Signed-off-by: Nils Carlson <nils.carlson@ericsson.com>
13 years agoAdd list-pids command to ustctl v2
Nils Carlson [Tue, 29 Mar 2011 13:15:44 +0000 (15:15 +0200)] 
Add list-pids command to ustctl v2

Changes since v1:
* Case pid_t to long

Signed-off-by: Nils Carlson <nils.carlson@ericsson.com>
13 years agoRestructure the ustctl_get_online_pids command v2
Nils Carlson [Tue, 29 Mar 2011 13:11:33 +0000 (15:11 +0200)] 
Restructure the ustctl_get_online_pids command v2

Changes since v1:
* Use list length, not the size in bytes
* Fix a possible bug for pid_t in a sscanf
* Use list length in the dir scanning function

Restructure the command to separate the pid gathering.
This will allow a root user to gather pid from multiple user
directories.

Signed-off-by: Nils Carlson <nils.carlson@ericsson.com>
13 years agoAdd mode setting to socket directory creation
Nils Carlson [Tue, 29 Mar 2011 09:27:55 +0000 (11:27 +0200)] 
Add mode setting to socket directory creation

Set the mode when creating the personal socket directory,
this way all app sockets are private.

Signed-off-by: Nils Carlson <nils.carlson@ericsson.com>
13 years agoMake app socket directories per-user v2
Nils Carlson [Tue, 29 Mar 2011 08:27:46 +0000 (10:27 +0200)] 
Make app socket directories per-user v2

Changes since v1:
* Document memory allocation

Make a separate app socket directories for each user, providing
some basic security and also the possibility of consistent cleanup.

Signed-off-by: Nils Carlson <nils.carlson@ericsson.com>
13 years agoRename local variables "m" and "regs" to less conflicting names
Mathieu Desnoyers [Mon, 28 Mar 2011 22:12:29 +0000 (18:12 -0400)] 
Rename local variables "m" and "regs" to less conflicting names

Rename "m" local macro variable to "__marker_counter_ptr".
Rename "regs" local macro variable to "__marker_regs".

Initial report:

The following trivial piece of code will result in corrupt events:

void dump_ackerman_current( int m, int n )
{
    trace_mark( ackerman, current, "m %d n %d", m, n );
}

This is because in ust/marker.h line 173 the definition of the
__trace_mark_counter macro uses a temporary named m (which shadows the
original m). It might be a good idea to use underscore variable names
inside these macros to make naming conflicts less likely.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Reported-by: Paul Wögerer <paul_woegerer@mentor.com>
13 years agolibust: Remove lots of dead code and comments in tracer.c
Nils Carlson [Tue, 15 Mar 2011 14:08:33 +0000 (15:08 +0100)] 
libust: Remove lots of dead code and comments in tracer.c

Remove lots of code that wasn't being called or did nothing
as well as lots of commented code and unnecessary comments.

Signed-off-by: Nils Carlson <nils.carlson@ericsson.com>
Acked-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
13 years agolibust: New transport mutex v2
Nils Carlson [Tue, 15 Mar 2011 13:17:34 +0000 (14:17 +0100)] 
libust: New transport mutex v2

Changes since v1:
Add a nesting comment

Make the locking around the transport list more intelligent, give
it its own mutex.

Signed-off-by: Nils Carlson <nils.carlson@ericsson.com>
13 years agoChangelog and version updates for v0.12 v0.12
Nils Carlson [Tue, 15 Mar 2011 09:49:17 +0000 (10:49 +0100)] 
Changelog and version updates for v0.12

13 years agolibustfork: link against libust
Nils Carlson [Thu, 10 Mar 2011 12:55:27 +0000 (13:55 +0100)] 
libustfork: link against libust

libustfork needs to link against libust as it makes calls into
libust.

Signed-off-by: Nils Carlson <nils.carlson@ericsson.com>
13 years agolibust: Remove some unused variables
Nils Carlson [Thu, 10 Mar 2011 10:27:42 +0000 (11:27 +0100)] 
libust: Remove some unused variables

More spring cleaning.

Signed-off-by: Nils Carlson <nils.carlson@ericsson.com>
13 years agolibust: Remove the now useless open_buffers list.
Nils Carlson [Thu, 10 Mar 2011 10:23:24 +0000 (11:23 +0100)] 
libust: Remove the now useless open_buffers list.

Signed-off-by: Nils Carlson <nils.carlson@ericsson.com>
13 years agolibust: remove process_simple_client_cmd function
Nils Carlson [Thu, 10 Mar 2011 10:12:35 +0000 (11:12 +0100)] 
libust: remove process_simple_client_cmd function

It was only used by one command, so move the command into
the big case statement and remove a now unnecessary function.

Spring cleaning.

Signed-off-by: Nils Carlson <nils.carlson@ericsson.com>
13 years agoChange force_subbuffer switch to be per trace
Nils Carlson [Thu, 10 Mar 2011 09:58:44 +0000 (10:58 +0100)] 
Change force_subbuffer switch to be per trace

Change force_subbuffer switch to act on a per trace basis becuase this
is what we want almost all the time. This will simplify periodic flushing
of some traces and other features we might want in the future.

Signed-off-by: Nils Carlson <nils.carlson@ericsson.com>
13 years agolibustconsumer: Fix a fd leak of the pipe_fd
Nils Carlson [Mon, 7 Mar 2011 16:20:34 +0000 (17:20 +0100)] 
libustconsumer: Fix a fd leak of the pipe_fd

libustconsumer wasn't properly closing pipe_fds sent by
libust. Make it do so.

Signed-off-by: Nils Carlson <nils.carlson@ericsson.com>
13 years agoAdd a test for urcu 0.5.4 which we now depends on
Yannick Brosseau [Fri, 4 Mar 2011 18:53:40 +0000 (13:53 -0500)] 
Add a test for urcu 0.5.4 which we now depends on

Signed-off-by: Yannick Brosseau <yannick.brosseau@gmail.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
13 years agoUpdate liburcu dependency to 0.5.4
Mathieu Desnoyers [Fri, 4 Mar 2011 17:32:35 +0000 (12:32 -0500)] 
Update liburcu dependency to 0.5.4

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
13 years agoUse liburcu-bp before/after fork (parent/child) callbacks
Mathieu Desnoyers [Fri, 4 Mar 2011 17:31:32 +0000 (12:31 -0500)] 
Use liburcu-bp before/after fork (parent/child) callbacks

Handle fork() gracefully with urcu-bp. Dependency on urcu-bp 0.5.4.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
13 years agotest: fix the valgrind test-case to not hang if valgrind crashes
Nils Carlson [Fri, 4 Mar 2011 15:08:39 +0000 (16:08 +0100)] 
test: fix the valgrind test-case to not hang if valgrind crashes

In previous version of the test-case the test-case would hang forever
if valgrind crashes (which it does on my debian squeeze PPC).

Fix this by checking that valgrind is alive.

Also cleanup leftover fifos in /tmp

Signed-off-by: Nils Carlson <nils.carlson@ericsson.com>
13 years agoRemove duplicated marker id dump
Mathieu Desnoyers [Fri, 4 Mar 2011 14:13:15 +0000 (09:13 -0500)] 
Remove duplicated marker id dump

Marker ID is already dumped at:
- trace start (with marker dump)
- when a marker is enabled (probe callback associated with marker).

So this should cover all cases:
- either we have a marker in a lib/program that is already enabled, and start
  tracing after a library is loaded, for which the marker dump will catch the
  marker id.
- or we have a marker in a lib/program that is not enabled, and start tracing
  after a library is loaded. If after that we enable the marker, an event
  describing the marker ID will be generated.
- or if have tracing running, and then we enable a marker (connect probe to
  marker) for a marker located in a yet-unloaded library. In this case, the
  marker ID event is generated when we connect the probe to the marker, even if
  the library is not yet loaded.

The cases are similar for the marker format, except that it is valid to have an
unknown marker format when we connect a marker probe. In that case, the format
will be written into the trace by marker_set_format, called upon library load.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
13 years agoFix off-by-one in open_memstream
Mathieu Desnoyers [Fri, 4 Mar 2011 14:10:40 +0000 (09:10 -0500)] 
Fix off-by-one in open_memstream

size returned by open_memstream does not include the final \0. We have to add
1 to the size of the message sent.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
13 years agoDebug message cleanup
Mathieu Desnoyers [Fri, 4 Mar 2011 13:01:50 +0000 (08:01 -0500)] 
Debug message cleanup

We cannot use the number of pointers - 1 to know the number of markers/tp/tc,
because we can have more than one NULL pointer per shared object.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
13 years agoAdd pthread cleanup to listener (to cleanup mutex)
Mathieu Desnoyers [Thu, 3 Mar 2011 23:21:52 +0000 (18:21 -0500)] 
Add pthread cleanup to listener (to cleanup mutex)

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
13 years agoRemove dummy markers/tracepoints/trace events
Mathieu Desnoyers [Thu, 3 Mar 2011 20:57:14 +0000 (15:57 -0500)] 
Remove dummy markers/tracepoints/trace events

Add a null pointer in the marker/tp/te tables instead of a full-blown dummy
marker. Skip the null pointers in the marker/tp/te iterators.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
13 years agofinish_consuming_dead_subbuffer: cleanup
Mathieu Desnoyers [Thu, 3 Mar 2011 18:17:16 +0000 (13:17 -0500)] 
finish_consuming_dead_subbuffer: cleanup

Use the same iterator as error printing to iterate on the last subbuffers.
Removes a lot of iterator duplication and extra unneeded modulo operations.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
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>
This page took 0.04243 seconds and 4 git commands to generate.