Samuel Martin [Mon, 17 Jun 2013 14:28:51 +0000 (10:28 -0400)]
Fix build and load against linux-2.6.33.x
* lttng-event.h declared but did not implement
lttng_add_perf_counter_to_ctx on kernel >=2.6.33, the implementation
was in lttng-context-perf-counters.c, which was only included for
kernel >=2.6.34. This prevented the module from being loaded.
* on kernel 2.6.33.x, lttng-context-perf-counters.c complains about
implicit declaration for {get,put}_online_cpus and
{,un}register_cpu_notifier; so fix header inclusion.
Signed-off-by: Samuel Martin <smartin@aldebaran-robotics.com> Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Implement a cache for the kernel metadata and a list of metadata
channels.
When new metadata is appended, all metadata channels are awakened so
they can return from poll and get the newly added metadata
This allows to request the metadata multiple times by creating multiple
metadata channels (useful for snapshots).
With this new feature, the poll and get_subbuf ring buffer operations
are now overridden by lttng-abi for the metadata channels, to check the
cache before doing these operations.
Jan Glauber [Thu, 23 May 2013 11:35:16 +0000 (07:35 -0400)]
Fix CPU hotplug section mismatches
Get rid of the following section mismatches:
WARNING: /home/jang/temp/lttng-modules-2.2.0-r0/git/lttng-tracer.o(.text+0x19dc0): Section mismatch in reference from the function lttng_add_perf_counter_to_ctx() to the function .cpuinit.text:lttng_perf_counter_cpu_hp_callback()
The function lttng_add_perf_counter_to_ctx() references
the function __cpuinit lttng_perf_counter_cpu_hp_callback().
This is often because lttng_add_perf_counter_to_ctx lacks a __cpuinit
annotation or the annotation of lttng_perf_counter_cpu_hp_callback is wrong.
WARNING: /home/jang/temp/lttng-modules-2.2.0-r0/git/lib/lttng-lib-ring-buffer.o(.text+0x1204): Section mismatch in reference from the function channel_backend_init() to the function .cpuinit.text:lib_ring_buffer_cpu_hp_callback()
The function channel_backend_init() references
the function __cpuinit lib_ring_buffer_cpu_hp_callback().
This is often because channel_backend_init lacks a __cpuinit
annotation or the annotation of lib_ring_buffer_cpu_hp_callback is wrong.
WARNING: /home/jang/temp/lttng-modules-2.2.0-r0/git/lib/lttng-lib-ring-buffer.o(.text+0x269c): Section mismatch in reference from the function channel_create() to the function .cpuinit.text:lib_ring_buffer_cpu_hp_callback()
The function channel_create() references
the function __cpuinit lib_ring_buffer_cpu_hp_callback().
This is often because channel_create lacks a __cpuinit
annotation or the annotation of lib_ring_buffer_cpu_hp_callback is wrong.
WARNING: /home/jang/temp/lttng-modules-2.2.0-r0/git/lib/lttng-lib-ring-buffer.o(.text+0x4a1c): Section mismatch in reference from the function channel_iterator_init() to the function .cpuinit.text:channel_iterator_cpu_hotplug()
The function channel_iterator_init() references
the function __cpuinit channel_iterator_cpu_hotplug().
This is often because channel_iterator_init lacks a __cpuinit
annotation or the annotation of channel_iterator_cpu_hotplug is wrong.
Signed-off-by: Jan Glauber <jan.glauber@gmail.com> Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Jon Bernard [Mon, 13 May 2013 15:38:17 +0000 (11:38 -0400)]
Remove bashism in lttng-syscalls-generate-headers.sh
Options to echo are not portable. In particular, the 'echo -e' option is
implemented by some shells, including bash, to expand escape sequences.
However, dash is one of the other family of shells that instead expands
escape sequences by default.
The printf command is portable and much more reliable.
We don't use this event anymore since we write the metadata directly
into the ring buffer, no need for an external event. This probe was
the only one in the lttng-probe-lttng module, so we can get rid of
this module as well.
Previously it just tries to compile with zero modules, which is
confusing if you thought you had configured everything correctly. Now it
throws an error which tells which went wrong.
We'll need to find a better way to instrument ARM-specific system calls
located at a far offset from the standard systems calls. A 16MB
lttng-modules kernel module is really not acceptable.
Removing this instrumentation for now. sys_set_tls will appear as
sys_unknown.
Fixes #472
CC: Ryan Kyser <Ryan.Kyser@jci.com>
Ref: http://lists.lttng.org/pipermail/lttng-dev/2013-April/019990.html Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Andrew Gabbasov [Tue, 2 Apr 2013 13:25:37 +0000 (09:25 -0400)]
Clean up using global_dirty_limit wrapper for writeback probe
Move the wrapper around reading of global_dirty_limit to /wrapper/
directory. Introduce a new kallsyms_lookup_dataptr function for
obtaining the address unchanged and use it in global_dirty_limit
wrapper. Since the data address is available only if
CONFIG_KALLSYMS_ALL is set, omit the whole probe from building if this
config is missing.
[ Edit by Mathieu Desnoyers: small coding style fixes ]
Signed-off-by: Andrew Gabbasov <andrew_gabbasov@mentor.com> Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Don't replicate internal structures from the kernel: this is asking for
serious trouble, and could lead to breakage if building on newer kernels
that have modified structures.
The proper approach, if we really need to extract this information,
would be to add APIs to the Linux kernel workqueue that allow getting
this information.
Don't replicate internal structures from the kernel: this is asking for
serious trouble, and could lead to breakage if building on newer kernels
that have modified structures.
The proper approach, if we really need to extract this information,
would be to add APIs to the Linux kernel workqueue that allow getting
this information.
Maxin B. John [Fri, 22 Mar 2013 13:56:13 +0000 (09:56 -0400)]
lttng-module: sched.h: Fix compilation on 3.9 kernel
With commit 8bd75c77b7c6a3954140dd2e20346aef3efe4a35
included in 3.9-rc1 kernel, rt specific bits in "linux/sched.h"
were moved into new header file "linux/sched/rt.h".
Fixes this compilation error:
CC [M] /home/majo/lttng/lttng-modules/probes/lttng-probe-sched.o
...
/home/majo/lttng/lttng-modules/probes/../instrumentation/events/lttng-module
/../../../probes/../instrumentation/events/lttng-module/sched.h:
In function '__event_probe__sched_switch':
/home/majo/lttng/lttng-modules/probes/../instrumentation/events/lttng-module
/../../../probes/../instrumentation/events/lttng-module/sched.h:164:1:
error: 'MAX_RT_PRIO' undeclared (first use in this function)
...
Signed-off-by: Maxin B. John <maxin.john@enea.com> Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fix: statedump hang/too early completion due to logic error
The previous "Fix: statedump hang due to incorrect wait/wakeup use" was
not actually fixing the real problem.
The issue is that we should pass the expected condition to wait_event()
rather than its contrary.
This bug has been sitting there for a while. I suspect that a recent
change in the Linux scheduler behavior for newly spawned worker threads
might have contributed to trigger the hang more reliably.
The effects of this bugs are:
- possible hang of the lttng-sessiond (within the kernel) at tracing
start,
- the statedump end event is traced before all worker threads have
actually completed, which can confuse LTTng viewer state systems.
Reported-by: Phil Wilshire <sysdcs@gmail.com> Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Andrew Gabbasov [Mon, 10 Dec 2012 16:12:14 +0000 (11:12 -0500)]
Update kernel probes to more detailed match to kernel versions
Some ifdef's are added to kernel probes instrumentation to make them
more close to original tracepoints in different kernel versions.
Supported kernel version are from 2.6.32 to 3.7.
Signed-off-by: Andrew Gabbasov <andrew_gabbasov@mentor.com> Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Andrew Gabbasov [Mon, 10 Dec 2012 16:01:52 +0000 (11:01 -0500)]
Fix possible kernel build errors with linux-patches
Kernel sources of version 2.6.32 - 2.6.34 with applied patches
from linux-patches may fail to compile if tracepoint samples
are configured to build. Some part of backported commits
are added to the kernel patches to avoid those errors.
Signed-off-by: Andrew Gabbasov <andrew_gabbasov@mentor.com> Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Andrew Gabbasov [Tue, 27 Nov 2012 16:43:38 +0000 (17:43 +0100)]
Make upper bound of kernel version checking macro exclusive
It's more usable to have the upper limit exclusive. It helps to avoid
hardcoding of stable branch highest version number, i.e. having a range
from 3.1.0 up to 3.2.0 (exclusively) gives us all 3.1.x versions.
Signed-off-by: Andrew Gabbasov <andrew_gabbasov@mentor.com> Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Andrew Gabbasov [Sun, 25 Nov 2012 21:13:16 +0000 (16:13 -0500)]
sock instrumentation: fix fields to get referenced values
Due to specific of passing values in lttng-modules, if it is supposed
to display the values, passing a pointer will not be enough,
we need to store the actual values.
Signed-off-by: Andrew Gabbasov <andrew_gabbasov@mentor.com> Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Andrew Gabbasov [Sun, 25 Nov 2012 21:12:46 +0000 (16:12 -0500)]
ext3 instrumentation: fix of assignment code conversion
Due to specifics of handling assignment code in lttng-modules,
plain code in TP_fast_assign (outside tp_* macros) will not be reached.
Everything should be enclosed into tp_* fragments.
Signed-off-by: Andrew Gabbasov <andrew_gabbasov@mentor.com> Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Simon Marchi [Fri, 23 Nov 2012 23:10:38 +0000 (18:10 -0500)]
Fix compilation for 3.0 branch (>= 3.0.39)
The isolate_mode_t type that appeared in 3.2 was backported to 3.0.39 so
the version check must be fixed. It was not backported to the 3.1 branch
though, so it must be excluded.
Signed-off-by: Simon Marchi <simon.marchi@polymtl.ca> Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
The current ABI does not work for compat 32/64 bits.
This patch moves the current ABI as old-abi and provides a new ABI in
which all the structures exchanged between user and kernel-space are
packed. Also this new ABI moves the "int overwrite" member of the
struct lttng_kernel_channel to remove the alignment added by the
compiler.
A patch for lttng-tools has been developed in parallel to this one to
support the new ABI. These 2 patches have been tested in all
possible configurations (applied or not) on 64-bit and 32-bit kernels
(with CONFIG_COMPAT) and a user-space in 32 and 64-bit.
Here are the results of the tests :
k 64 compat | u 32 compat | OK
k 64 compat | u 64 compat | OK
k 64 compat | u 32 non-compat | KO
k 64 compat | u 64 non-compat | OK
k 64 non-compat | u 64 compat | OK
k 64 non-compat | u 32 compat | KO
k 64 non-compat | u 64 non-compat | OK
k 64 non-compat | u 32 non-compat | KO
k 32 compat | u compat | OK
k 32 compat | u non-compat | OK
k 32 non-compat | u compat | OK
k 32 non-compat | u non-compat | OK
The results are as expected :
- on 32-bit user-space and kernel, every configuration works.
- on 64-bit user-space and kernel, every configuration works.
- with 32-bit user-space on a 64-bit kernel the only configuration
where it works is when the compat patch is applied everywhere.
The type of fields exchanged between kernel and userspace must be
compat_ulong_t instead of unsigned long in case of compat where
userspace is 32 bits and kernel is 64 bits.
Fix ring_buffer_frontend.c: missing include lttng-tracer-core.h
In lib/ringbuffer/ring_buffer_frontend.c, RING_BUFFER_ALIGN is undefined,
leading to no alignment offset being recorded after the call to
config->cb.record_header_size() in lib_ring_buffer_try_reserve_slow().
However, lttng-ring-buffer-client.h does define RING_BUFFER_ALIGN, so
the alignment offset will be produced when the packet header is written
in lttng_write_event_header().
This discrepancy may be observed on architectures that don't set
CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS, such as ARM, with a babeltrace
error such as:
indicating that the actual content size differs from the calculated one
due to the difference in alignment. Including the appropriate header
file in ring_buffer_frontend.c solves the problem.
fix timestamps on architectures without CONFIG_KTIME_SCALAR
trace_clock_monotonic_wrapper() should return a u64 representing the
number of nanoseconds since system startup.
ktime_get() provides that value directly within its .tv64 field only
on those architectures defining CONFIG_KTIME_SCALAR, whereas in all
other cases (e.g. PowerPC) a ktime_to_ns() conversion (which
translates back to .tv64 when CONFIG_KTIME_SCALAR is defined)
becomes necessary.
Julien Desfossez [Thu, 23 Aug 2012 21:11:35 +0000 (17:11 -0400)]
lttng_statedump_process_state for each PID NS
When a process is in a namespace, its pid, tid and ppid are relative to
the namespace. Since namespaces can be nested, we need to know the
representation of each process in each namespace.
This patch changes the lttng_enumerate_task_fd to iterate over each
PID namespace of a process if any, that way we generate, in the
statedump, an entry for each process in each namespace it belongs.
To know the nesting level, the field "level" is added to the
lttng_statedump_process_state event, 0 being the top-level.
For processes running on the top-level namespace, the statedump
behaviour is unchanged (except the added "level" field).
For example (no nesting, just one level of namespace) :
lttng_statedump_process_state: {
tid = 32185, vtid = 1, pid = 32185,
vpid = 1, ppid = 32173, vppid = 0,
level = 1, name = "init" }
lttng_statedump_process_state: {
tid = 32185, vtid = 32185, pid = 32185,
vpid = 32185, ppid = 32173, vppid = 32173,
level = 0, name = "init" }
Confirmed that the process 32173 in the top-level namespace is indeed
the lxc-start command that created the container and its namespace.
CC [M] drivers/staging/lttng/probes/lttng-probe-statedump.o
In file included from drivers/staging/lttng/probes/../instrumentation/events/lttng-module/../../../probes/lttng-events.h:221:0,
from drivers/staging/lttng/probes/../instrumentation/events/lttng-module/../../../probes/define_trace.h:117,
from drivers/staging/lttng/probes/../instrumentation/events/lttng-module/lttng-statedump.h:162,
from drivers/staging/lttng/probes/lttng-probe-statedump.c:41:
drivers/staging/lttng/probes/../instrumentation/events/lttng-module/../../../probes/../instrumentation/events/lttng-module/lttng-statedump.h:29:1: error: 'TASK_COMM_LEN' undeclared here (not in a function)
Makes write operation a parameter for tp_memcpy macro
Memcpy source can be either user-space or kernel-space. To avoid code
duplication, this patch makes the operation a parameter to the macros.
Available macros are thus: