| From compudj@mail.openrapids.net Thu Apr 5 07:40:26 2012 |
| From: Mathieu Desnoyers <mathieu.desnoyers@efficios.com> |
| Date: Thu, 5 Apr 2012 10:40:20 -0400 |
| Subject: [PATCH LTSI staging] LTTng update to v2.0.1 |
| To: Greg KH <gregkh@linuxfoundation.org> |
| Cc: Tim Bird <tim.bird@am.sony.com>, ltsi-dev@lists.linuxfoundation.org |
| Message-ID: <20120405144020.GA31482@Krystal> |
| Content-Disposition: inline |
| |
| |
| Update LTTng driver (in LTSI tree) to v2.0.1 from |
| git://git.lttng.org/lttng-modules.git, the external module package on which |
| development has continued. |
| |
| Changelog: |
| |
| 2012-03-29 LTTng modules 2.0.1 |
| * Fix: is_compat_task !CONFIG_COMPAT compile error on kernels >= 3.3 |
| |
| 2012-03-20 LTTng modules 2.0.0 |
| * First STABLE version |
| * Add version name |
| |
| 2012-03-20 LTTng modules 2.0.0-rc4 |
| * Update README and add version name place-holder |
| |
| 2012-03-16 LTTng modules 2.0.0-rc3 |
| * Fix clock offset 32-bit multiplication overflow |
| * Fix : wrong assign of fd in state dump |
| * License cleanup, ifdef namespace cleanup |
| * Fix: ensure power of 2 check handles 64-bit size_t entirely |
| |
| 2012-03-02 LTTng modules 2.0.0-rc2 |
| * Fix: dmesg printout should not print metadata warnings |
| * Fix: use transport name as channel name |
| * Fix: Return -EINVAL instead of print warning if non power of 2 size/num_subbuf |
| |
| 2012-02-20 LTTng modules 2.0.0-rc1 |
| * Standardize version across toolchain |
| * statedump: Use old macro name for kernel 2.6.38 |
| |
| 2012-02-16 LTTng modules 2.0-pre15 |
| * Add timer instrumentation |
| * fix: need to undef mainline define |
| * fix: Include signal.h instead of irq.h for prototype match check |
| * Add signal instrumentation |
| |
| 2012-02-16 LTTng modules 2.0-pre14 |
| * syscall tracing: sys_getcpu |
| * Add sys_clone x86 instrumentation |
| * statedump: fix include circular dep |
| * Implement state dump |
| |
| 2012-02-09 LTTng modules 2.0-pre13 |
| * Update README |
| * environment: write sysname, release, version, domain to metadata |
| * Allow open /proc/lttng for read & write |
| |
| 2012-02-02 LTTng modules 2.0-pre12 |
| * Add x86 32/64 execve syscall instrumentation override |
| * Remove unused defines |
| * Add padding to ABI |
| * Use LTTNG_KERNEL_SYM_NAME_LEN |
| * Update version to 1.9.9 |
| * Add missing double-quotes to clock uuid |
| * clock: read bootid as clock monotonic ID |
| * Fix comment |
| * Cleanup comment |
| * clock: output clock description in metadata |
| * Properly fix the timekeeping overflow detection |
| * Fix init bug |
| * rename lib-ring-buffer to lttng-lib-ring-buffer |
| * Remove #warning |
| * Mass rename: ltt_*/ltt-* to LTTNG_*/LTTNG-* |
| * Update TODO |
| * Update TODO |
| * Remove debugfs file (keep only proc file) |
| * Rename lttng-debugfs-abi files to lttng-abi |
| |
| 2011-12-13 LTTng modules 2.0-pre11 |
| * Fix OOPS caused by reference of config pointer |
| * Gather detailed info from x86 64 32-bit compat syscall instrumentation |
| * lttng lib: ring buffer move null pointer check to open |
| * lttng lib: ring buffer remove duplicate null pointer |
| * lttng lib: ring buffer: remove stale null-pointer |
| * lttng wrapper: add missing include to kallsyms wrapper |
| * lttng: cleanup one-bit signed bitfields |
| * Add TODO file |
| * Update symbol name length max size to 256 |
| * Fix last modifications to string_from_user operations |
| * Document that depmod needs to be executed by hand |
| * Fix strlen_user fault space reservation |
| * Fix tp_copy_string_from_user handling of faults |
| * Disable block layer tracing support for kernels < 2.6.38 |
| * lttng context: perf counter, fix 32-bit vs 64-bit field size bug |
| * Update trace clock warning to match the current development plan |
| * ringbuffer: make ring buffer printk less verbose |
| * Makefile: do not run depmod manually |
| |
| Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com> |
| CC: Greg KH <gregkh@linuxfoundation.org> |
| CC: Tim Bird <tim.bird@am.sony.com> |
| CC: ltsi-dev@lists.linuxfoundation.org |
| --- |
| drivers/staging/lttng/Makefile | 28 |
| drivers/staging/lttng/README | 43 |
| drivers/staging/lttng/TODO | 18 |
| drivers/staging/lttng/instrumentation/events/lttng-module/lttng-statedump.h | 162 + |
| drivers/staging/lttng/instrumentation/events/lttng-module/signal.h | 165 + |
| drivers/staging/lttng/instrumentation/events/lttng-module/timer.h | 333 ++ |
| drivers/staging/lttng/instrumentation/events/mainline/signal.h | 166 + |
| drivers/staging/lttng/instrumentation/events/mainline/timer.h | 329 ++ |
| drivers/staging/lttng/instrumentation/syscalls/headers/syscalls_pointers_override.h | 53 |
| drivers/staging/lttng/instrumentation/syscalls/headers/x86-32-syscalls-3.1.0-rc6_pointers_override.h | 46 |
| drivers/staging/lttng/instrumentation/syscalls/headers/x86-64-syscalls-3.0.4_integers_override.h | 3 |
| drivers/staging/lttng/instrumentation/syscalls/headers/x86-64-syscalls-3.0.4_pointers_override.h | 7 |
| drivers/staging/lttng/instrumentation/syscalls/lttng-syscalls-extractor/lttng-syscalls-extractor.c | 18 |
| drivers/staging/lttng/lib/Makefile | 4 |
| drivers/staging/lttng/lib/align.h | 16 |
| drivers/staging/lttng/lib/bitfield.h | 2 |
| drivers/staging/lttng/lib/bug.h | 16 |
| drivers/staging/lttng/lib/ringbuffer/api.h | 26 |
| drivers/staging/lttng/lib/ringbuffer/backend.h | 26 |
| drivers/staging/lttng/lib/ringbuffer/backend_internal.h | 26 |
| drivers/staging/lttng/lib/ringbuffer/backend_types.h | 33 |
| drivers/staging/lttng/lib/ringbuffer/config.h | 26 |
| drivers/staging/lttng/lib/ringbuffer/frontend.h | 28 |
| drivers/staging/lttng/lib/ringbuffer/frontend_api.h | 28 |
| drivers/staging/lttng/lib/ringbuffer/frontend_internal.h | 26 |
| drivers/staging/lttng/lib/ringbuffer/frontend_types.h | 34 |
| drivers/staging/lttng/lib/ringbuffer/iterator.h | 28 |
| drivers/staging/lttng/lib/ringbuffer/nohz.h | 24 |
| drivers/staging/lttng/lib/ringbuffer/ring_buffer_backend.c | 60 |
| drivers/staging/lttng/lib/ringbuffer/ring_buffer_frontend.c | 112 |
| drivers/staging/lttng/lib/ringbuffer/ring_buffer_iterator.c | 46 |
| drivers/staging/lttng/lib/ringbuffer/ring_buffer_mmap.c | 29 |
| drivers/staging/lttng/lib/ringbuffer/ring_buffer_splice.c | 23 |
| drivers/staging/lttng/lib/ringbuffer/ring_buffer_vfs.c | 24 |
| drivers/staging/lttng/lib/ringbuffer/vatomic.h | 24 |
| drivers/staging/lttng/lib/ringbuffer/vfs.h | 28 |
| drivers/staging/lttng/ltt-context.c | 93 |
| drivers/staging/lttng/ltt-debugfs-abi.c | 777 ------ |
| drivers/staging/lttng/ltt-debugfs-abi.h | 153 - |
| drivers/staging/lttng/ltt-endian.h | 31 |
| drivers/staging/lttng/ltt-events.c | 1009 -------- |
| drivers/staging/lttng/ltt-events.h | 452 ---- |
| drivers/staging/lttng/ltt-probes.c | 164 - |
| drivers/staging/lttng/ltt-ring-buffer-client-discard.c | 21 |
| drivers/staging/lttng/ltt-ring-buffer-client-mmap-discard.c | 21 |
| drivers/staging/lttng/ltt-ring-buffer-client-mmap-overwrite.c | 21 |
| drivers/staging/lttng/ltt-ring-buffer-client-overwrite.c | 21 |
| drivers/staging/lttng/ltt-ring-buffer-client.h | 569 ----- |
| drivers/staging/lttng/ltt-ring-buffer-metadata-client.c | 21 |
| drivers/staging/lttng/ltt-ring-buffer-metadata-client.h | 330 -- |
| drivers/staging/lttng/ltt-ring-buffer-metadata-mmap-client.c | 21 |
| drivers/staging/lttng/ltt-tracer-core.h | 28 |
| drivers/staging/lttng/ltt-tracer.h | 67 |
| drivers/staging/lttng/lttng-abi.c | 781 ++++++ |
| drivers/staging/lttng/lttng-abi.h | 176 + |
| drivers/staging/lttng/lttng-calibrate.c | 22 |
| drivers/staging/lttng/lttng-context-nice.c | 31 |
| drivers/staging/lttng/lttng-context-perf-counters.c | 31 |
| drivers/staging/lttng/lttng-context-pid.c | 31 |
| drivers/staging/lttng/lttng-context-ppid.c | 31 |
| drivers/staging/lttng/lttng-context-prio.c | 31 |
| drivers/staging/lttng/lttng-context-procname.c | 27 |
| drivers/staging/lttng/lttng-context-tid.c | 31 |
| drivers/staging/lttng/lttng-context-vpid.c | 31 |
| drivers/staging/lttng/lttng-context-vppid.c | 31 |
| drivers/staging/lttng/lttng-context-vtid.c | 31 |
| drivers/staging/lttng/lttng-context.c | 105 |
| drivers/staging/lttng/lttng-endian.h | 43 |
| drivers/staging/lttng/lttng-events.c | 1126 ++++++++++ |
| drivers/staging/lttng/lttng-events.h | 466 ++++ |
| drivers/staging/lttng/lttng-probes.c | 176 + |
| drivers/staging/lttng/lttng-ring-buffer-client-discard.c | 33 |
| drivers/staging/lttng/lttng-ring-buffer-client-mmap-discard.c | 33 |
| drivers/staging/lttng/lttng-ring-buffer-client-mmap-overwrite.c | 33 |
| drivers/staging/lttng/lttng-ring-buffer-client-overwrite.c | 33 |
| drivers/staging/lttng/lttng-ring-buffer-client.h | 598 +++++ |
| drivers/staging/lttng/lttng-ring-buffer-metadata-client.c | 33 |
| drivers/staging/lttng/lttng-ring-buffer-metadata-client.h | 342 +++ |
| drivers/staging/lttng/lttng-ring-buffer-metadata-mmap-client.c | 33 |
| drivers/staging/lttng/lttng-statedump-impl.c | 385 +++ |
| drivers/staging/lttng/lttng-syscalls.c | 69 |
| drivers/staging/lttng/lttng-tracer-core.h | 41 |
| drivers/staging/lttng/lttng-tracer.h | 80 |
| drivers/staging/lttng/probes/Makefile | 4 |
| drivers/staging/lttng/probes/define_trace.h | 16 |
| drivers/staging/lttng/probes/lttng-events-reset.h | 16 |
| drivers/staging/lttng/probes/lttng-events.h | 79 |
| drivers/staging/lttng/probes/lttng-ftrace.c | 43 |
| drivers/staging/lttng/probes/lttng-kprobes.c | 47 |
| drivers/staging/lttng/probes/lttng-kretprobes.c | 47 |
| drivers/staging/lttng/probes/lttng-probe-block.c | 18 |
| drivers/staging/lttng/probes/lttng-probe-irq.c | 18 |
| drivers/staging/lttng/probes/lttng-probe-kvm.c | 18 |
| drivers/staging/lttng/probes/lttng-probe-lttng.c | 18 |
| drivers/staging/lttng/probes/lttng-probe-sched.c | 18 |
| drivers/staging/lttng/probes/lttng-probe-signal.c | 42 |
| drivers/staging/lttng/probes/lttng-probe-statedump.c | 45 |
| drivers/staging/lttng/probes/lttng-probe-timer.c | 43 |
| drivers/staging/lttng/probes/lttng-type-list.h | 16 |
| drivers/staging/lttng/probes/lttng-types.c | 20 |
| drivers/staging/lttng/probes/lttng-types.h | 24 |
| drivers/staging/lttng/probes/lttng.h | 16 |
| drivers/staging/lttng/wrapper/ftrace.h | 24 |
| drivers/staging/lttng/wrapper/inline_memcpy.h | 16 |
| drivers/staging/lttng/wrapper/irqdesc.c | 58 |
| drivers/staging/lttng/wrapper/irqdesc.h | 33 |
| drivers/staging/lttng/wrapper/kallsyms.h | 45 |
| drivers/staging/lttng/wrapper/perf.h | 24 |
| drivers/staging/lttng/wrapper/poll.h | 24 |
| drivers/staging/lttng/wrapper/random.c | 77 |
| drivers/staging/lttng/wrapper/random.h | 32 |
| drivers/staging/lttng/wrapper/spinlock.h | 24 |
| drivers/staging/lttng/wrapper/splice.c | 20 |
| drivers/staging/lttng/wrapper/splice.h | 26 |
| drivers/staging/lttng/wrapper/trace-clock.h | 41 |
| drivers/staging/lttng/wrapper/uuid.h | 24 |
| drivers/staging/lttng/wrapper/vmalloc.h | 24 |
| 117 files changed, 7456 insertions(+), 4357 deletions(-) |
| |
| --- a/drivers/staging/lttng/Makefile |
| +++ b/drivers/staging/lttng/Makefile |
| @@ -2,28 +2,32 @@ |
| # Makefile for the LTTng modules. |
| # |
| |
| -obj-m += ltt-ring-buffer-client-discard.o |
| -obj-m += ltt-ring-buffer-client-overwrite.o |
| -obj-m += ltt-ring-buffer-metadata-client.o |
| -obj-m += ltt-ring-buffer-client-mmap-discard.o |
| -obj-m += ltt-ring-buffer-client-mmap-overwrite.o |
| -obj-m += ltt-ring-buffer-metadata-mmap-client.o |
| +obj-m += lttng-ring-buffer-client-discard.o |
| +obj-m += lttng-ring-buffer-client-overwrite.o |
| +obj-m += lttng-ring-buffer-metadata-client.o |
| +obj-m += lttng-ring-buffer-client-mmap-discard.o |
| +obj-m += lttng-ring-buffer-client-mmap-overwrite.o |
| +obj-m += lttng-ring-buffer-metadata-mmap-client.o |
| |
| -obj-m += ltt-relay.o |
| -ltt-relay-objs := ltt-events.o ltt-debugfs-abi.o \ |
| - ltt-probes.o ltt-context.o \ |
| +obj-m += lttng-relay.o |
| +lttng-relay-objs := lttng-events.o lttng-abi.o \ |
| + lttng-probes.o lttng-context.o \ |
| lttng-context-pid.o lttng-context-procname.o \ |
| lttng-context-prio.o lttng-context-nice.o \ |
| lttng-context-vpid.o lttng-context-tid.o \ |
| lttng-context-vtid.o lttng-context-ppid.o \ |
| - lttng-context-vppid.o lttng-calibrate.o |
| + lttng-context-vppid.o lttng-calibrate.o \ |
| + wrapper/random.o |
| + |
| +obj-m += lttng-statedump.o |
| +lttng-statedump-objs := lttng-statedump-impl.o wrapper/irqdesc.o |
| |
| ifneq ($(CONFIG_HAVE_SYSCALL_TRACEPOINTS),) |
| -ltt-relay-objs += lttng-syscalls.o |
| +lttng-relay-objs += lttng-syscalls.o |
| endif |
| |
| ifneq ($(CONFIG_PERF_EVENTS),) |
| -ltt-relay-objs += $(shell \ |
| +lttng-relay-objs += $(shell \ |
| if [ $(VERSION) -ge 3 \ |
| -o \( $(VERSION) -eq 2 -a $(PATCHLEVEL) -ge 6 -a $(SUBLEVEL) -ge 33 \) ] ; then \ |
| echo "lttng-context-perf-counters.o" ; fi;) |
| --- a/drivers/staging/lttng/README |
| +++ b/drivers/staging/lttng/README |
| @@ -1,10 +1,10 @@ |
| LTTng 2.0 modules |
| |
| Mathieu Desnoyers |
| -November 1st, 2011 |
| +February 8, 2012 |
| |
| -LTTng 2.0 kernel modules is currently part of the Linux kernel staging |
| -tree. It features (new features since LTTng 0.x): |
| +LTTng 2.0 kernel modules build against a vanilla or distribution kernel, without |
| +need for additional patches. Other features: |
| |
| - Produces CTF (Common Trace Format) natively, |
| (http://www.efficios.com/ctf) |
| @@ -17,28 +17,29 @@ tree. It features (new features since LT |
| optional, specified on a per-tracing-session basis (except for |
| timestamp and event id, which are mandatory). |
| |
| -To build and install, you need to select "Staging" modules, and the |
| -LTTng kernel tracer. |
| +To build and install, you will need to enable LTTng in your kernel |
| +configuration. |
| |
| -Use lttng-tools to control the tracer. LTTng tools should automatically |
| -load the kernel modules when needed. Use Babeltrace to print traces as a |
| +Use lttng-tools to control the tracer. LTTng tools should automatically load |
| +the kernel modules when needed. Use Babeltrace to print traces as a |
| human-readable text log. These tools are available at the following URL: |
| http://lttng.org/lttng2.0 |
| |
| -Please note that the LTTng-UST 2.0 (user-space tracing counterpart of |
| -LTTng 2.0) is now ready to be used, but still only available from the |
| -git repository. |
| - |
| -So far, it has been tested on vanilla Linux kernels 2.6.38, 2.6.39 and |
| -3.0 (on x86 32/64-bit, and powerpc 32-bit at the moment, build tested on |
| -ARM). It should work fine with newer kernels and other architectures, |
| -but expect build issues with kernels older than 2.6.36. The clock source |
| -currently used is the standard gettimeofday (slower, less scalable and |
| -less precise than the LTTng 0.x clocks). Support for LTTng 0.x clocks |
| -will be added back soon into LTTng 2.0. Please note that lttng-modules |
| -2.0 can build on a Linux kernel patched with the LTTng 0.x patchset, but |
| -the lttng-modules 2.0 replace the lttng-modules 0.x, so both tracers |
| -cannot be installed at the same time for a given kernel version. |
| +So far, it has been tested on vanilla Linux kernels 2.6.38, 2.6.39, 3.0, |
| +3.1, 3.2, 3.3 (on x86 32/64-bit, and powerpc 32-bit at the moment, build |
| +tested on ARM). It should work fine with newer kernels and other |
| +architectures, but expect build issues with kernels older than 2.6.36. |
| +The clock source currently used is the standard gettimeofday (slower, |
| +less scalable and less precise than the LTTng 0.x clocks). Support for |
| +LTTng 0.x clocks will be added back soon into LTTng 2.0. Please note |
| +that lttng-modules 2.0 can build on a Linux kernel patched with the |
| +LTTng 0.x patchset, but the lttng-modules 2.0 replace the lttng-modules |
| +0.x, so both tracers cannot be installed at the same time for a given |
| +kernel version. |
| + |
| +LTTng-modules depends on having kallsyms enabled in the kernel it is |
| +built against. Ideally, if you want to have system call tracing, the |
| +"Trace Syscalls" feature should be enabled too. |
| |
| * Note about Perf PMU counters support |
| |
| --- a/drivers/staging/lttng/TODO |
| +++ b/drivers/staging/lttng/TODO |
| @@ -10,20 +10,7 @@ TODO: |
| |
| A) Cleanup/Testing |
| |
| - 1) Remove debugfs "lttng" file (keep only procfs "lttng" file). |
| - The rationale for this is that this file is needed for |
| - user-level tracing support (LTTng-UST 2.0) intended to be |
| - used on production system, and therefore should be present as |
| - part of a "usually mounted" filesystem rather than a debug |
| - filesystem. |
| - |
| - 2) Cleanup wrappers. The drivers/staging/lttng/wrapper directory |
| - contains various wrapper headers that use kallsyms lookups to |
| - work around some missing EXPORT_SYMBOL_GPL() in the mainline |
| - kernel. Ideally, those few symbols should become exported to |
| - modules by the kernel. |
| - |
| - 3) Test lib ring buffer snapshot feature. |
| + 1) Test lib ring buffer snapshot feature. |
| When working on the lttngtop project, Julien Desfossez |
| reported that he needed to push the consumer position |
| forward explicitely with lib_ring_buffer_put_next_subbuf. |
| @@ -70,7 +57,6 @@ B) Features |
| |
| 3) Integrate the "statedump" module from LTTng 0.x into LTTng |
| 2.0. |
| - * Dependency: addition of "dynamic enumerations" type to CTF. |
| See: http://git.lttng.org/?p=lttng-modules.git;a=shortlog;h=refs/heads/v0.19-stable |
| ltt-statedump.c |
| |
| @@ -107,7 +93,7 @@ B) Features |
| allow integration between NOHZ and LTTng would be to add |
| support for such notifiers into NOHZ kernel infrastructure. |
| |
| - 10) Turn drivers/staging/lttng/ltt-probes.c probe_list into a |
| + 10) Turn lttng-probes.c probe_list into a |
| hash table. Turns O(n^2) trace systems registration (cost |
| for n systems) into O(n). (O(1) per system) |
| |
| --- /dev/null |
| +++ b/drivers/staging/lttng/instrumentation/events/lttng-module/lttng-statedump.h |
| @@ -0,0 +1,162 @@ |
| +#undef TRACE_SYSTEM |
| +#define TRACE_SYSTEM lttng_statedump |
| + |
| +#if !defined(_TRACE_LTTNG_STATEDUMP_H) || defined(TRACE_HEADER_MULTI_READ) |
| +#define _TRACE_LTTNG_STATEDUMP_H |
| + |
| +#include <linux/tracepoint.h> |
| + |
| +TRACE_EVENT(lttng_statedump_start, |
| + TP_PROTO(struct lttng_session *session), |
| + TP_ARGS(session), |
| + TP_STRUCT__entry( |
| + ), |
| + TP_fast_assign( |
| + ), |
| + TP_printk("") |
| +) |
| + |
| +TRACE_EVENT(lttng_statedump_end, |
| + TP_PROTO(struct lttng_session *session), |
| + TP_ARGS(session), |
| + TP_STRUCT__entry( |
| + ), |
| + TP_fast_assign( |
| + ), |
| + TP_printk("") |
| +) |
| + |
| +TRACE_EVENT(lttng_statedump_process_state, |
| + TP_PROTO(struct lttng_session *session, |
| + struct task_struct *p, |
| + int type, int mode, int submode, int status), |
| + TP_ARGS(session, p, type, mode, submode, status), |
| + TP_STRUCT__entry( |
| + __field(pid_t, tid) |
| + __field(pid_t, vtid) |
| + __field(pid_t, pid) |
| + __field(pid_t, vpid) |
| + __field(pid_t, ppid) |
| + __field(pid_t, vppid) |
| + __array_text(char, name, TASK_COMM_LEN) |
| + __field(int, type) |
| + __field(int, mode) |
| + __field(int, submode) |
| + __field(int, status) |
| + ), |
| + TP_fast_assign( |
| + tp_assign(tid, p->pid) |
| + tp_assign(vtid, !p->nsproxy ? 0 : task_pid_vnr(p)) |
| + tp_assign(pid, p->tgid) |
| + tp_assign(vpid, !p->nsproxy ? 0 : task_tgid_vnr(p)) |
| + tp_assign(ppid, |
| + ({ |
| + pid_t ret; |
| + |
| + rcu_read_lock(); |
| + ret = task_tgid_nr(p->real_parent); |
| + rcu_read_unlock(); |
| + ret; |
| + })) |
| + tp_assign(vppid, |
| + ({ |
| + struct task_struct *parent; |
| + pid_t ret; |
| + |
| + rcu_read_lock(); |
| + parent = rcu_dereference(current->real_parent); |
| + if (!parent->nsproxy) |
| + ret = 0; |
| + else |
| + ret = task_tgid_nr(parent); |
| + rcu_read_unlock(); |
| + ret; |
| + })) |
| + tp_memcpy(name, p->comm, TASK_COMM_LEN) |
| + tp_assign(type, type) |
| + tp_assign(mode, mode) |
| + tp_assign(submode, submode) |
| + tp_assign(status, status) |
| + ), |
| + TP_printk("") |
| +) |
| + |
| +TRACE_EVENT(lttng_statedump_file_descriptor, |
| + TP_PROTO(struct lttng_session *session, |
| + struct task_struct *p, int fd, const char *filename), |
| + TP_ARGS(session, p, fd, filename), |
| + TP_STRUCT__entry( |
| + __field(pid_t, pid) |
| + __field(int, fd) |
| + __string(filename, filename) |
| + ), |
| + TP_fast_assign( |
| + tp_assign(pid, p->tgid) |
| + tp_assign(fd, fd) |
| + tp_strcpy(filename, filename) |
| + ), |
| + TP_printk("") |
| +) |
| + |
| +TRACE_EVENT(lttng_statedump_vm_map, |
| + TP_PROTO(struct lttng_session *session, |
| + struct task_struct *p, struct vm_area_struct *map, |
| + unsigned long inode), |
| + TP_ARGS(session, p, map, inode), |
| + TP_STRUCT__entry( |
| + __field(pid_t, pid) |
| + __field_hex(unsigned long, start) |
| + __field_hex(unsigned long, end) |
| + __field_hex(unsigned long, flags) |
| + __field(unsigned long, inode) |
| + __field(unsigned long, pgoff) |
| + ), |
| + TP_fast_assign( |
| + tp_assign(pid, p->tgid) |
| + tp_assign(start, map->vm_start) |
| + tp_assign(end, map->vm_end) |
| + tp_assign(flags, map->vm_flags) |
| + tp_assign(inode, inode) |
| + tp_assign(pgoff, map->vm_pgoff << PAGE_SHIFT) |
| + ), |
| + TP_printk("") |
| +) |
| + |
| +TRACE_EVENT(lttng_statedump_network_interface, |
| + TP_PROTO(struct lttng_session *session, |
| + struct net_device *dev, struct in_ifaddr *ifa), |
| + TP_ARGS(session, dev, ifa), |
| + TP_STRUCT__entry( |
| + __string(name, dev->name) |
| + __field_network_hex(uint32_t, address_ipv4) |
| + ), |
| + TP_fast_assign( |
| + tp_strcpy(name, dev->name) |
| + tp_assign(address_ipv4, ifa ? ifa->ifa_address : 0U) |
| + ), |
| + TP_printk("") |
| +) |
| + |
| +/* Called with desc->lock held */ |
| +TRACE_EVENT(lttng_statedump_interrupt, |
| + TP_PROTO(struct lttng_session *session, |
| + unsigned int irq, const char *chip_name, |
| + struct irqaction *action), |
| + TP_ARGS(session, irq, chip_name, action), |
| + TP_STRUCT__entry( |
| + __field(unsigned int, irq) |
| + __string(name, chip_name) |
| + __string(action, action->name) |
| + ), |
| + TP_fast_assign( |
| + tp_assign(irq, irq) |
| + tp_strcpy(name, chip_name) |
| + tp_strcpy(action, action->name) |
| + ), |
| + TP_printk("") |
| +) |
| + |
| +#endif /* _TRACE_LTTNG_STATEDUMP_H */ |
| + |
| +/* This part must be outside protection */ |
| +#include "../../../probes/define_trace.h" |
| --- /dev/null |
| +++ b/drivers/staging/lttng/instrumentation/events/lttng-module/signal.h |
| @@ -0,0 +1,165 @@ |
| +#undef TRACE_SYSTEM |
| +#define TRACE_SYSTEM signal |
| + |
| +#if !defined(_TRACE_SIGNAL_H) || defined(TRACE_HEADER_MULTI_READ) |
| +#define _TRACE_SIGNAL_H |
| + |
| +#include <linux/tracepoint.h> |
| + |
| +#ifndef _TRACE_SIGNAL_DEF |
| +#define _TRACE_SIGNAL_DEF |
| +#include <linux/signal.h> |
| +#include <linux/sched.h> |
| +#undef TP_STORE_SIGINFO |
| +#define TP_STORE_SIGINFO(info) \ |
| + tp_assign(errno, \ |
| + (info == SEND_SIG_NOINFO || info == SEND_SIG_FORCED || info == SEND_SIG_PRIV) ? \ |
| + 0 : \ |
| + info->si_errno) \ |
| + tp_assign(code, \ |
| + (info == SEND_SIG_NOINFO || info == SEND_SIG_FORCED) ? \ |
| + SI_USER : \ |
| + ((info == SEND_SIG_PRIV) ? SI_KERNEL : info->si_code)) |
| +#endif /* _TRACE_SIGNAL_DEF */ |
| + |
| +/** |
| + * signal_generate - called when a signal is generated |
| + * @sig: signal number |
| + * @info: pointer to struct siginfo |
| + * @task: pointer to struct task_struct |
| + * |
| + * Current process sends a 'sig' signal to 'task' process with |
| + * 'info' siginfo. If 'info' is SEND_SIG_NOINFO or SEND_SIG_PRIV, |
| + * 'info' is not a pointer and you can't access its field. Instead, |
| + * SEND_SIG_NOINFO means that si_code is SI_USER, and SEND_SIG_PRIV |
| + * means that si_code is SI_KERNEL. |
| + */ |
| +TRACE_EVENT(signal_generate, |
| + |
| + TP_PROTO(int sig, struct siginfo *info, struct task_struct *task), |
| + |
| + TP_ARGS(sig, info, task), |
| + |
| + TP_STRUCT__entry( |
| + __field( int, sig ) |
| + __field( int, errno ) |
| + __field( int, code ) |
| + __array( char, comm, TASK_COMM_LEN ) |
| + __field( pid_t, pid ) |
| + ), |
| + |
| + TP_fast_assign( |
| + tp_assign(sig, sig) |
| + TP_STORE_SIGINFO(info) |
| + tp_memcpy(comm, task->comm, TASK_COMM_LEN) |
| + tp_assign(pid, task->pid) |
| + ), |
| + |
| + TP_printk("sig=%d errno=%d code=%d comm=%s pid=%d", |
| + __entry->sig, __entry->errno, __entry->code, |
| + __entry->comm, __entry->pid) |
| +) |
| + |
| +/** |
| + * signal_deliver - called when a signal is delivered |
| + * @sig: signal number |
| + * @info: pointer to struct siginfo |
| + * @ka: pointer to struct k_sigaction |
| + * |
| + * A 'sig' signal is delivered to current process with 'info' siginfo, |
| + * and it will be handled by 'ka'. ka->sa.sa_handler can be SIG_IGN or |
| + * SIG_DFL. |
| + * Note that some signals reported by signal_generate tracepoint can be |
| + * lost, ignored or modified (by debugger) before hitting this tracepoint. |
| + * This means, this can show which signals are actually delivered, but |
| + * matching generated signals and delivered signals may not be correct. |
| + */ |
| +TRACE_EVENT(signal_deliver, |
| + |
| + TP_PROTO(int sig, struct siginfo *info, struct k_sigaction *ka), |
| + |
| + TP_ARGS(sig, info, ka), |
| + |
| + TP_STRUCT__entry( |
| + __field( int, sig ) |
| + __field( int, errno ) |
| + __field( int, code ) |
| + __field( unsigned long, sa_handler ) |
| + __field( unsigned long, sa_flags ) |
| + ), |
| + |
| + TP_fast_assign( |
| + tp_assign(sig, sig) |
| + TP_STORE_SIGINFO(info) |
| + tp_assign(sa_handler, (unsigned long)ka->sa.sa_handler) |
| + tp_assign(sa_flags, ka->sa.sa_flags) |
| + ), |
| + |
| + TP_printk("sig=%d errno=%d code=%d sa_handler=%lx sa_flags=%lx", |
| + __entry->sig, __entry->errno, __entry->code, |
| + __entry->sa_handler, __entry->sa_flags) |
| +) |
| + |
| +DECLARE_EVENT_CLASS(signal_queue_overflow, |
| + |
| + TP_PROTO(int sig, int group, struct siginfo *info), |
| + |
| + TP_ARGS(sig, group, info), |
| + |
| + TP_STRUCT__entry( |
| + __field( int, sig ) |
| + __field( int, group ) |
| + __field( int, errno ) |
| + __field( int, code ) |
| + ), |
| + |
| + TP_fast_assign( |
| + tp_assign(sig, sig) |
| + tp_assign(group, group) |
| + TP_STORE_SIGINFO(info) |
| + ), |
| + |
| + TP_printk("sig=%d group=%d errno=%d code=%d", |
| + __entry->sig, __entry->group, __entry->errno, __entry->code) |
| +) |
| + |
| +/** |
| + * signal_overflow_fail - called when signal queue is overflow |
| + * @sig: signal number |
| + * @group: signal to process group or not (bool) |
| + * @info: pointer to struct siginfo |
| + * |
| + * Kernel fails to generate 'sig' signal with 'info' siginfo, because |
| + * siginfo queue is overflow, and the signal is dropped. |
| + * 'group' is not 0 if the signal will be sent to a process group. |
| + * 'sig' is always one of RT signals. |
| + */ |
| +DEFINE_EVENT(signal_queue_overflow, signal_overflow_fail, |
| + |
| + TP_PROTO(int sig, int group, struct siginfo *info), |
| + |
| + TP_ARGS(sig, group, info) |
| +) |
| + |
| +/** |
| + * signal_lose_info - called when siginfo is lost |
| + * @sig: signal number |
| + * @group: signal to process group or not (bool) |
| + * @info: pointer to struct siginfo |
| + * |
| + * Kernel generates 'sig' signal but loses 'info' siginfo, because siginfo |
| + * queue is overflow. |
| + * 'group' is not 0 if the signal will be sent to a process group. |
| + * 'sig' is always one of non-RT signals. |
| + */ |
| +DEFINE_EVENT(signal_queue_overflow, signal_lose_info, |
| + |
| + TP_PROTO(int sig, int group, struct siginfo *info), |
| + |
| + TP_ARGS(sig, group, info) |
| +) |
| + |
| +#endif /* _TRACE_SIGNAL_H */ |
| + |
| +/* This part must be outside protection */ |
| +#include "../../../probes/define_trace.h" |
| --- /dev/null |
| +++ b/drivers/staging/lttng/instrumentation/events/lttng-module/timer.h |
| @@ -0,0 +1,333 @@ |
| +#undef TRACE_SYSTEM |
| +#define TRACE_SYSTEM timer |
| + |
| +#if !defined(_TRACE_TIMER_H) || defined(TRACE_HEADER_MULTI_READ) |
| +#define _TRACE_TIMER_H |
| + |
| +#include <linux/tracepoint.h> |
| + |
| +#ifndef _TRACE_TIMER_DEF_ |
| +#define _TRACE_TIMER_DEF_ |
| +#include <linux/hrtimer.h> |
| +#include <linux/timer.h> |
| +#endif /* _TRACE_TIMER_DEF_ */ |
| + |
| +DECLARE_EVENT_CLASS(timer_class, |
| + |
| + TP_PROTO(struct timer_list *timer), |
| + |
| + TP_ARGS(timer), |
| + |
| + TP_STRUCT__entry( |
| + __field( void *, timer ) |
| + ), |
| + |
| + TP_fast_assign( |
| + tp_assign(timer, timer) |
| + ), |
| + |
| + TP_printk("timer=%p", __entry->timer) |
| +) |
| + |
| +/** |
| + * timer_init - called when the timer is initialized |
| + * @timer: pointer to struct timer_list |
| + */ |
| +DEFINE_EVENT(timer_class, timer_init, |
| + |
| + TP_PROTO(struct timer_list *timer), |
| + |
| + TP_ARGS(timer) |
| +) |
| + |
| +/** |
| + * timer_start - called when the timer is started |
| + * @timer: pointer to struct timer_list |
| + * @expires: the timers expiry time |
| + */ |
| +TRACE_EVENT(timer_start, |
| + |
| + TP_PROTO(struct timer_list *timer, unsigned long expires), |
| + |
| + TP_ARGS(timer, expires), |
| + |
| + TP_STRUCT__entry( |
| + __field( void *, timer ) |
| + __field( void *, function ) |
| + __field( unsigned long, expires ) |
| + __field( unsigned long, now ) |
| + ), |
| + |
| + TP_fast_assign( |
| + tp_assign(timer, timer) |
| + tp_assign(function, timer->function) |
| + tp_assign(expires, expires) |
| + tp_assign(now, jiffies) |
| + ), |
| + |
| + TP_printk("timer=%p function=%pf expires=%lu [timeout=%ld]", |
| + __entry->timer, __entry->function, __entry->expires, |
| + (long)__entry->expires - __entry->now) |
| +) |
| + |
| +/** |
| + * timer_expire_entry - called immediately before the timer callback |
| + * @timer: pointer to struct timer_list |
| + * |
| + * Allows to determine the timer latency. |
| + */ |
| +TRACE_EVENT(timer_expire_entry, |
| + |
| + TP_PROTO(struct timer_list *timer), |
| + |
| + TP_ARGS(timer), |
| + |
| + TP_STRUCT__entry( |
| + __field( void *, timer ) |
| + __field( unsigned long, now ) |
| + __field( void *, function) |
| + ), |
| + |
| + TP_fast_assign( |
| + tp_assign(timer, timer) |
| + tp_assign(now, jiffies) |
| + tp_assign(function, timer->function) |
| + ), |
| + |
| + TP_printk("timer=%p function=%pf now=%lu", __entry->timer, __entry->function,__entry->now) |
| +) |
| + |
| +/** |
| + * timer_expire_exit - called immediately after the timer callback returns |
| + * @timer: pointer to struct timer_list |
| + * |
| + * When used in combination with the timer_expire_entry tracepoint we can |
| + * determine the runtime of the timer callback function. |
| + * |
| + * NOTE: Do NOT derefernce timer in TP_fast_assign. The pointer might |
| + * be invalid. We solely track the pointer. |
| + */ |
| +DEFINE_EVENT(timer_class, timer_expire_exit, |
| + |
| + TP_PROTO(struct timer_list *timer), |
| + |
| + TP_ARGS(timer) |
| +) |
| + |
| +/** |
| + * timer_cancel - called when the timer is canceled |
| + * @timer: pointer to struct timer_list |
| + */ |
| +DEFINE_EVENT(timer_class, timer_cancel, |
| + |
| + TP_PROTO(struct timer_list *timer), |
| + |
| + TP_ARGS(timer) |
| +) |
| + |
| +/** |
| + * hrtimer_init - called when the hrtimer is initialized |
| + * @timer: pointer to struct hrtimer |
| + * @clockid: the hrtimers clock |
| + * @mode: the hrtimers mode |
| + */ |
| +TRACE_EVENT(hrtimer_init, |
| + |
| + TP_PROTO(struct hrtimer *hrtimer, clockid_t clockid, |
| + enum hrtimer_mode mode), |
| + |
| + TP_ARGS(hrtimer, clockid, mode), |
| + |
| + TP_STRUCT__entry( |
| + __field( void *, hrtimer ) |
| + __field( clockid_t, clockid ) |
| + __field( enum hrtimer_mode, mode ) |
| + ), |
| + |
| + TP_fast_assign( |
| + tp_assign(hrtimer, hrtimer) |
| + tp_assign(clockid, clockid) |
| + tp_assign(mode, mode) |
| + ), |
| + |
| + TP_printk("hrtimer=%p clockid=%s mode=%s", __entry->hrtimer, |
| + __entry->clockid == CLOCK_REALTIME ? |
| + "CLOCK_REALTIME" : "CLOCK_MONOTONIC", |
| + __entry->mode == HRTIMER_MODE_ABS ? |
| + "HRTIMER_MODE_ABS" : "HRTIMER_MODE_REL") |
| +) |
| + |
| +/** |
| + * hrtimer_start - called when the hrtimer is started |
| + * @timer: pointer to struct hrtimer |
| + */ |
| +TRACE_EVENT(hrtimer_start, |
| + |
| + TP_PROTO(struct hrtimer *hrtimer), |
| + |
| + TP_ARGS(hrtimer), |
| + |
| + TP_STRUCT__entry( |
| + __field( void *, hrtimer ) |
| + __field( void *, function ) |
| + __field( s64, expires ) |
| + __field( s64, softexpires ) |
| + ), |
| + |
| + TP_fast_assign( |
| + tp_assign(hrtimer, hrtimer) |
| + tp_assign(function, hrtimer->function) |
| + tp_assign(expires, hrtimer_get_expires(hrtimer).tv64) |
| + tp_assign(softexpires, hrtimer_get_softexpires(hrtimer).tv64) |
| + ), |
| + |
| + TP_printk("hrtimer=%p function=%pf expires=%llu softexpires=%llu", |
| + __entry->hrtimer, __entry->function, |
| + (unsigned long long)ktime_to_ns((ktime_t) { |
| + .tv64 = __entry->expires }), |
| + (unsigned long long)ktime_to_ns((ktime_t) { |
| + .tv64 = __entry->softexpires })) |
| +) |
| + |
| +/** |
| + * htimmer_expire_entry - called immediately before the hrtimer callback |
| + * @timer: pointer to struct hrtimer |
| + * @now: pointer to variable which contains current time of the |
| + * timers base. |
| + * |
| + * Allows to determine the timer latency. |
| + */ |
| +TRACE_EVENT(hrtimer_expire_entry, |
| + |
| + TP_PROTO(struct hrtimer *hrtimer, ktime_t *now), |
| + |
| + TP_ARGS(hrtimer, now), |
| + |
| + TP_STRUCT__entry( |
| + __field( void *, hrtimer ) |
| + __field( s64, now ) |
| + __field( void *, function) |
| + ), |
| + |
| + TP_fast_assign( |
| + tp_assign(hrtimer, hrtimer) |
| + tp_assign(now, now->tv64) |
| + tp_assign(function, hrtimer->function) |
| + ), |
| + |
| + TP_printk("hrtimer=%p function=%pf now=%llu", __entry->hrtimer, __entry->function, |
| + (unsigned long long)ktime_to_ns((ktime_t) { .tv64 = __entry->now })) |
| +) |
| + |
| +DECLARE_EVENT_CLASS(hrtimer_class, |
| + |
| + TP_PROTO(struct hrtimer *hrtimer), |
| + |
| + TP_ARGS(hrtimer), |
| + |
| + TP_STRUCT__entry( |
| + __field( void *, hrtimer ) |
| + ), |
| + |
| + TP_fast_assign( |
| + tp_assign(hrtimer, hrtimer) |
| + ), |
| + |
| + TP_printk("hrtimer=%p", __entry->hrtimer) |
| +) |
| + |
| +/** |
| + * hrtimer_expire_exit - called immediately after the hrtimer callback returns |
| + * @timer: pointer to struct hrtimer |
| + * |
| + * When used in combination with the hrtimer_expire_entry tracepoint we can |
| + * determine the runtime of the callback function. |
| + */ |
| +DEFINE_EVENT(hrtimer_class, hrtimer_expire_exit, |
| + |
| + TP_PROTO(struct hrtimer *hrtimer), |
| + |
| + TP_ARGS(hrtimer) |
| +) |
| + |
| +/** |
| + * hrtimer_cancel - called when the hrtimer is canceled |
| + * @hrtimer: pointer to struct hrtimer |
| + */ |
| +DEFINE_EVENT(hrtimer_class, hrtimer_cancel, |
| + |
| + TP_PROTO(struct hrtimer *hrtimer), |
| + |
| + TP_ARGS(hrtimer) |
| +) |
| + |
| +/** |
| + * itimer_state - called when itimer is started or canceled |
| + * @which: name of the interval timer |
| + * @value: the itimers value, itimer is canceled if value->it_value is |
| + * zero, otherwise it is started |
| + * @expires: the itimers expiry time |
| + */ |
| +TRACE_EVENT(itimer_state, |
| + |
| + TP_PROTO(int which, const struct itimerval *const value, |
| + cputime_t expires), |
| + |
| + TP_ARGS(which, value, expires), |
| + |
| + TP_STRUCT__entry( |
| + __field( int, which ) |
| + __field( cputime_t, expires ) |
| + __field( long, value_sec ) |
| + __field( long, value_usec ) |
| + __field( long, interval_sec ) |
| + __field( long, interval_usec ) |
| + ), |
| + |
| + TP_fast_assign( |
| + tp_assign(which, which) |
| + tp_assign(expires, expires) |
| + tp_assign(value_sec, value->it_value.tv_sec) |
| + tp_assign(value_usec, value->it_value.tv_usec) |
| + tp_assign(interval_sec, value->it_interval.tv_sec) |
| + tp_assign(interval_usec, value->it_interval.tv_usec) |
| + ), |
| + |
| + TP_printk("which=%d expires=%llu it_value=%ld.%ld it_interval=%ld.%ld", |
| + __entry->which, (unsigned long long)__entry->expires, |
| + __entry->value_sec, __entry->value_usec, |
| + __entry->interval_sec, __entry->interval_usec) |
| +) |
| + |
| +/** |
| + * itimer_expire - called when itimer expires |
| + * @which: type of the interval timer |
| + * @pid: pid of the process which owns the timer |
| + * @now: current time, used to calculate the latency of itimer |
| + */ |
| +TRACE_EVENT(itimer_expire, |
| + |
| + TP_PROTO(int which, struct pid *pid, cputime_t now), |
| + |
| + TP_ARGS(which, pid, now), |
| + |
| + TP_STRUCT__entry( |
| + __field( int , which ) |
| + __field( pid_t, pid ) |
| + __field( cputime_t, now ) |
| + ), |
| + |
| + TP_fast_assign( |
| + tp_assign(which, which) |
| + tp_assign(now, now) |
| + tp_assign(pid, pid_nr(pid)) |
| + ), |
| + |
| + TP_printk("which=%d pid=%d now=%llu", __entry->which, |
| + (int) __entry->pid, (unsigned long long)__entry->now) |
| +) |
| + |
| +#endif /* _TRACE_TIMER_H */ |
| + |
| +/* This part must be outside protection */ |
| +#include "../../../probes/define_trace.h" |
| --- /dev/null |
| +++ b/drivers/staging/lttng/instrumentation/events/mainline/signal.h |
| @@ -0,0 +1,166 @@ |
| +#undef TRACE_SYSTEM |
| +#define TRACE_SYSTEM signal |
| + |
| +#if !defined(_TRACE_SIGNAL_H) || defined(TRACE_HEADER_MULTI_READ) |
| +#define _TRACE_SIGNAL_H |
| + |
| +#include <linux/signal.h> |
| +#include <linux/sched.h> |
| +#include <linux/tracepoint.h> |
| + |
| +#define TP_STORE_SIGINFO(__entry, info) \ |
| + do { \ |
| + if (info == SEND_SIG_NOINFO || \ |
| + info == SEND_SIG_FORCED) { \ |
| + __entry->errno = 0; \ |
| + __entry->code = SI_USER; \ |
| + } else if (info == SEND_SIG_PRIV) { \ |
| + __entry->errno = 0; \ |
| + __entry->code = SI_KERNEL; \ |
| + } else { \ |
| + __entry->errno = info->si_errno; \ |
| + __entry->code = info->si_code; \ |
| + } \ |
| + } while (0) |
| + |
| +/** |
| + * signal_generate - called when a signal is generated |
| + * @sig: signal number |
| + * @info: pointer to struct siginfo |
| + * @task: pointer to struct task_struct |
| + * |
| + * Current process sends a 'sig' signal to 'task' process with |
| + * 'info' siginfo. If 'info' is SEND_SIG_NOINFO or SEND_SIG_PRIV, |
| + * 'info' is not a pointer and you can't access its field. Instead, |
| + * SEND_SIG_NOINFO means that si_code is SI_USER, and SEND_SIG_PRIV |
| + * means that si_code is SI_KERNEL. |
| + */ |
| +TRACE_EVENT(signal_generate, |
| + |
| + TP_PROTO(int sig, struct siginfo *info, struct task_struct *task), |
| + |
| + TP_ARGS(sig, info, task), |
| + |
| + TP_STRUCT__entry( |
| + __field( int, sig ) |
| + __field( int, errno ) |
| + __field( int, code ) |
| + __array( char, comm, TASK_COMM_LEN ) |
| + __field( pid_t, pid ) |
| + ), |
| + |
| + TP_fast_assign( |
| + __entry->sig = sig; |
| + TP_STORE_SIGINFO(__entry, info); |
| + memcpy(__entry->comm, task->comm, TASK_COMM_LEN); |
| + __entry->pid = task->pid; |
| + ), |
| + |
| + TP_printk("sig=%d errno=%d code=%d comm=%s pid=%d", |
| + __entry->sig, __entry->errno, __entry->code, |
| + __entry->comm, __entry->pid) |
| +); |
| + |
| +/** |
| + * signal_deliver - called when a signal is delivered |
| + * @sig: signal number |
| + * @info: pointer to struct siginfo |
| + * @ka: pointer to struct k_sigaction |
| + * |
| + * A 'sig' signal is delivered to current process with 'info' siginfo, |
| + * and it will be handled by 'ka'. ka->sa.sa_handler can be SIG_IGN or |
| + * SIG_DFL. |
| + * Note that some signals reported by signal_generate tracepoint can be |
| + * lost, ignored or modified (by debugger) before hitting this tracepoint. |
| + * This means, this can show which signals are actually delivered, but |
| + * matching generated signals and delivered signals may not be correct. |
| + */ |
| +TRACE_EVENT(signal_deliver, |
| + |
| + TP_PROTO(int sig, struct siginfo *info, struct k_sigaction *ka), |
| + |
| + TP_ARGS(sig, info, ka), |
| + |
| + TP_STRUCT__entry( |
| + __field( int, sig ) |
| + __field( int, errno ) |
| + __field( int, code ) |
| + __field( unsigned long, sa_handler ) |
| + __field( unsigned long, sa_flags ) |
| + ), |
| + |
| + TP_fast_assign( |
| + __entry->sig = sig; |
| + TP_STORE_SIGINFO(__entry, info); |
| + __entry->sa_handler = (unsigned long)ka->sa.sa_handler; |
| + __entry->sa_flags = ka->sa.sa_flags; |
| + ), |
| + |
| + TP_printk("sig=%d errno=%d code=%d sa_handler=%lx sa_flags=%lx", |
| + __entry->sig, __entry->errno, __entry->code, |
| + __entry->sa_handler, __entry->sa_flags) |
| +); |
| + |
| +DECLARE_EVENT_CLASS(signal_queue_overflow, |
| + |
| + TP_PROTO(int sig, int group, struct siginfo *info), |
| + |
| + TP_ARGS(sig, group, info), |
| + |
| + TP_STRUCT__entry( |
| + __field( int, sig ) |
| + __field( int, group ) |
| + __field( int, errno ) |
| + __field( int, code ) |
| + ), |
| + |
| + TP_fast_assign( |
| + __entry->sig = sig; |
| + __entry->group = group; |
| + TP_STORE_SIGINFO(__entry, info); |
| + ), |
| + |
| + TP_printk("sig=%d group=%d errno=%d code=%d", |
| + __entry->sig, __entry->group, __entry->errno, __entry->code) |
| +); |
| + |
| +/** |
| + * signal_overflow_fail - called when signal queue is overflow |
| + * @sig: signal number |
| + * @group: signal to process group or not (bool) |
| + * @info: pointer to struct siginfo |
| + * |
| + * Kernel fails to generate 'sig' signal with 'info' siginfo, because |
| + * siginfo queue is overflow, and the signal is dropped. |
| + * 'group' is not 0 if the signal will be sent to a process group. |
| + * 'sig' is always one of RT signals. |
| + */ |
| +DEFINE_EVENT(signal_queue_overflow, signal_overflow_fail, |
| + |
| + TP_PROTO(int sig, int group, struct siginfo *info), |
| + |
| + TP_ARGS(sig, group, info) |
| +); |
| + |
| +/** |
| + * signal_lose_info - called when siginfo is lost |
| + * @sig: signal number |
| + * @group: signal to process group or not (bool) |
| + * @info: pointer to struct siginfo |
| + * |
| + * Kernel generates 'sig' signal but loses 'info' siginfo, because siginfo |
| + * queue is overflow. |
| + * 'group' is not 0 if the signal will be sent to a process group. |
| + * 'sig' is always one of non-RT signals. |
| + */ |
| +DEFINE_EVENT(signal_queue_overflow, signal_lose_info, |
| + |
| + TP_PROTO(int sig, int group, struct siginfo *info), |
| + |
| + TP_ARGS(sig, group, info) |
| +); |
| + |
| +#endif /* _TRACE_SIGNAL_H */ |
| + |
| +/* This part must be outside protection */ |
| +#include <trace/define_trace.h> |
| --- /dev/null |
| +++ b/drivers/staging/lttng/instrumentation/events/mainline/timer.h |
| @@ -0,0 +1,329 @@ |
| +#undef TRACE_SYSTEM |
| +#define TRACE_SYSTEM timer |
| + |
| +#if !defined(_TRACE_TIMER_H) || defined(TRACE_HEADER_MULTI_READ) |
| +#define _TRACE_TIMER_H |
| + |
| +#include <linux/tracepoint.h> |
| +#include <linux/hrtimer.h> |
| +#include <linux/timer.h> |
| + |
| +DECLARE_EVENT_CLASS(timer_class, |
| + |
| + TP_PROTO(struct timer_list *timer), |
| + |
| + TP_ARGS(timer), |
| + |
| + TP_STRUCT__entry( |
| + __field( void *, timer ) |
| + ), |
| + |
| + TP_fast_assign( |
| + __entry->timer = timer; |
| + ), |
| + |
| + TP_printk("timer=%p", __entry->timer) |
| +); |
| + |
| +/** |
| + * timer_init - called when the timer is initialized |
| + * @timer: pointer to struct timer_list |
| + */ |
| +DEFINE_EVENT(timer_class, timer_init, |
| + |
| + TP_PROTO(struct timer_list *timer), |
| + |
| + TP_ARGS(timer) |
| +); |
| + |
| +/** |
| + * timer_start - called when the timer is started |
| + * @timer: pointer to struct timer_list |
| + * @expires: the timers expiry time |
| + */ |
| +TRACE_EVENT(timer_start, |
| + |
| + TP_PROTO(struct timer_list *timer, unsigned long expires), |
| + |
| + TP_ARGS(timer, expires), |
| + |
| + TP_STRUCT__entry( |
| + __field( void *, timer ) |
| + __field( void *, function ) |
| + __field( unsigned long, expires ) |
| + __field( unsigned long, now ) |
| + ), |
| + |
| + TP_fast_assign( |
| + __entry->timer = timer; |
| + __entry->function = timer->function; |
| + __entry->expires = expires; |
| + __entry->now = jiffies; |
| + ), |
| + |
| + TP_printk("timer=%p function=%pf expires=%lu [timeout=%ld]", |
| + __entry->timer, __entry->function, __entry->expires, |
| + (long)__entry->expires - __entry->now) |
| +); |
| + |
| +/** |
| + * timer_expire_entry - called immediately before the timer callback |
| + * @timer: pointer to struct timer_list |
| + * |
| + * Allows to determine the timer latency. |
| + */ |
| +TRACE_EVENT(timer_expire_entry, |
| + |
| + TP_PROTO(struct timer_list *timer), |
| + |
| + TP_ARGS(timer), |
| + |
| + TP_STRUCT__entry( |
| + __field( void *, timer ) |
| + __field( unsigned long, now ) |
| + __field( void *, function) |
| + ), |
| + |
| + TP_fast_assign( |
| + __entry->timer = timer; |
| + __entry->now = jiffies; |
| + __entry->function = timer->function; |
| + ), |
| + |
| + TP_printk("timer=%p function=%pf now=%lu", __entry->timer, __entry->function,__entry->now) |
| +); |
| + |
| +/** |
| + * timer_expire_exit - called immediately after the timer callback returns |
| + * @timer: pointer to struct timer_list |
| + * |
| + * When used in combination with the timer_expire_entry tracepoint we can |
| + * determine the runtime of the timer callback function. |
| + * |
| + * NOTE: Do NOT derefernce timer in TP_fast_assign. The pointer might |
| + * be invalid. We solely track the pointer. |
| + */ |
| +DEFINE_EVENT(timer_class, timer_expire_exit, |
| + |
| + TP_PROTO(struct timer_list *timer), |
| + |
| + TP_ARGS(timer) |
| +); |
| + |
| +/** |
| + * timer_cancel - called when the timer is canceled |
| + * @timer: pointer to struct timer_list |
| + */ |
| +DEFINE_EVENT(timer_class, timer_cancel, |
| + |
| + TP_PROTO(struct timer_list *timer), |
| + |
| + TP_ARGS(timer) |
| +); |
| + |
| +/** |
| + * hrtimer_init - called when the hrtimer is initialized |
| + * @timer: pointer to struct hrtimer |
| + * @clockid: the hrtimers clock |
| + * @mode: the hrtimers mode |
| + */ |
| +TRACE_EVENT(hrtimer_init, |
| + |
| + TP_PROTO(struct hrtimer *hrtimer, clockid_t clockid, |
| + enum hrtimer_mode mode), |
| + |
| + TP_ARGS(hrtimer, clockid, mode), |
| + |
| + TP_STRUCT__entry( |
| + __field( void *, hrtimer ) |
| + __field( clockid_t, clockid ) |
| + __field( enum hrtimer_mode, mode ) |
| + ), |
| + |
| + TP_fast_assign( |
| + __entry->hrtimer = hrtimer; |
| + __entry->clockid = clockid; |
| + __entry->mode = mode; |
| + ), |
| + |
| + TP_printk("hrtimer=%p clockid=%s mode=%s", __entry->hrtimer, |
| + __entry->clockid == CLOCK_REALTIME ? |
| + "CLOCK_REALTIME" : "CLOCK_MONOTONIC", |
| + __entry->mode == HRTIMER_MODE_ABS ? |
| + "HRTIMER_MODE_ABS" : "HRTIMER_MODE_REL") |
| +); |
| + |
| +/** |
| + * hrtimer_start - called when the hrtimer is started |
| + * @timer: pointer to struct hrtimer |
| + */ |
| +TRACE_EVENT(hrtimer_start, |
| + |
| + TP_PROTO(struct hrtimer *hrtimer), |
| + |
| + TP_ARGS(hrtimer), |
| + |
| + TP_STRUCT__entry( |
| + __field( void *, hrtimer ) |
| + __field( void *, function ) |
| + __field( s64, expires ) |
| + __field( s64, softexpires ) |
| + ), |
| + |
| + TP_fast_assign( |
| + __entry->hrtimer = hrtimer; |
| + __entry->function = hrtimer->function; |
| + __entry->expires = hrtimer_get_expires(hrtimer).tv64; |
| + __entry->softexpires = hrtimer_get_softexpires(hrtimer).tv64; |
| + ), |
| + |
| + TP_printk("hrtimer=%p function=%pf expires=%llu softexpires=%llu", |
| + __entry->hrtimer, __entry->function, |
| + (unsigned long long)ktime_to_ns((ktime_t) { |
| + .tv64 = __entry->expires }), |
| + (unsigned long long)ktime_to_ns((ktime_t) { |
| + .tv64 = __entry->softexpires })) |
| +); |
| + |
| +/** |
| + * htimmer_expire_entry - called immediately before the hrtimer callback |
| + * @timer: pointer to struct hrtimer |
| + * @now: pointer to variable which contains current time of the |
| + * timers base. |
| + * |
| + * Allows to determine the timer latency. |
| + */ |
| +TRACE_EVENT(hrtimer_expire_entry, |
| + |
| + TP_PROTO(struct hrtimer *hrtimer, ktime_t *now), |
| + |
| + TP_ARGS(hrtimer, now), |
| + |
| + TP_STRUCT__entry( |
| + __field( void *, hrtimer ) |
| + __field( s64, now ) |
| + __field( void *, function) |
| + ), |
| + |
| + TP_fast_assign( |
| + __entry->hrtimer = hrtimer; |
| + __entry->now = now->tv64; |
| + __entry->function = hrtimer->function; |
| + ), |
| + |
| + TP_printk("hrtimer=%p function=%pf now=%llu", __entry->hrtimer, __entry->function, |
| + (unsigned long long)ktime_to_ns((ktime_t) { .tv64 = __entry->now })) |
| + ); |
| + |
| +DECLARE_EVENT_CLASS(hrtimer_class, |
| + |
| + TP_PROTO(struct hrtimer *hrtimer), |
| + |
| + TP_ARGS(hrtimer), |
| + |
| + TP_STRUCT__entry( |
| + __field( void *, hrtimer ) |
| + ), |
| + |
| + TP_fast_assign( |
| + __entry->hrtimer = hrtimer; |
| + ), |
| + |
| + TP_printk("hrtimer=%p", __entry->hrtimer) |
| +); |
| + |
| +/** |
| + * hrtimer_expire_exit - called immediately after the hrtimer callback returns |
| + * @timer: pointer to struct hrtimer |
| + * |
| + * When used in combination with the hrtimer_expire_entry tracepoint we can |
| + * determine the runtime of the callback function. |
| + */ |
| +DEFINE_EVENT(hrtimer_class, hrtimer_expire_exit, |
| + |
| + TP_PROTO(struct hrtimer *hrtimer), |
| + |
| + TP_ARGS(hrtimer) |
| +); |
| + |
| +/** |
| + * hrtimer_cancel - called when the hrtimer is canceled |
| + * @hrtimer: pointer to struct hrtimer |
| + */ |
| +DEFINE_EVENT(hrtimer_class, hrtimer_cancel, |
| + |
| + TP_PROTO(struct hrtimer *hrtimer), |
| + |
| + TP_ARGS(hrtimer) |
| +); |
| + |
| +/** |
| + * itimer_state - called when itimer is started or canceled |
| + * @which: name of the interval timer |
| + * @value: the itimers value, itimer is canceled if value->it_value is |
| + * zero, otherwise it is started |
| + * @expires: the itimers expiry time |
| + */ |
| +TRACE_EVENT(itimer_state, |
| + |
| + TP_PROTO(int which, const struct itimerval *const value, |
| + cputime_t expires), |
| + |
| + TP_ARGS(which, value, expires), |
| + |
| + TP_STRUCT__entry( |
| + __field( int, which ) |
| + __field( cputime_t, expires ) |
| + __field( long, value_sec ) |
| + __field( long, value_usec ) |
| + __field( long, interval_sec ) |
| + __field( long, interval_usec ) |
| + ), |
| + |
| + TP_fast_assign( |
| + __entry->which = which; |
| + __entry->expires = expires; |
| + __entry->value_sec = value->it_value.tv_sec; |
| + __entry->value_usec = value->it_value.tv_usec; |
| + __entry->interval_sec = value->it_interval.tv_sec; |
| + __entry->interval_usec = value->it_interval.tv_usec; |
| + ), |
| + |
| + TP_printk("which=%d expires=%llu it_value=%ld.%ld it_interval=%ld.%ld", |
| + __entry->which, (unsigned long long)__entry->expires, |
| + __entry->value_sec, __entry->value_usec, |
| + __entry->interval_sec, __entry->interval_usec) |
| +); |
| + |
| +/** |
| + * itimer_expire - called when itimer expires |
| + * @which: type of the interval timer |
| + * @pid: pid of the process which owns the timer |
| + * @now: current time, used to calculate the latency of itimer |
| + */ |
| +TRACE_EVENT(itimer_expire, |
| + |
| + TP_PROTO(int which, struct pid *pid, cputime_t now), |
| + |
| + TP_ARGS(which, pid, now), |
| + |
| + TP_STRUCT__entry( |
| + __field( int , which ) |
| + __field( pid_t, pid ) |
| + __field( cputime_t, now ) |
| + ), |
| + |
| + TP_fast_assign( |
| + __entry->which = which; |
| + __entry->now = now; |
| + __entry->pid = pid_nr(pid); |
| + ), |
| + |
| + TP_printk("which=%d pid=%d now=%llu", __entry->which, |
| + (int) __entry->pid, (unsigned long long)__entry->now) |
| +); |
| + |
| +#endif /* _TRACE_TIMER_H */ |
| + |
| +/* This part must be outside protection */ |
| +#include <trace/define_trace.h> |
| --- a/drivers/staging/lttng/instrumentation/syscalls/headers/syscalls_pointers_override.h |
| +++ b/drivers/staging/lttng/instrumentation/syscalls/headers/syscalls_pointers_override.h |
| @@ -1,3 +1,56 @@ |
| +#define OVERRIDE_32_sys_execve |
| +#define OVERRIDE_64_sys_execve |
| + |
| +#ifndef CREATE_SYSCALL_TABLE |
| + |
| +SC_TRACE_EVENT(sys_execve, |
| + TP_PROTO(const char *filename, char *const *argv, char *const *envp), |
| + TP_ARGS(filename, argv, envp), |
| + TP_STRUCT__entry(__string_from_user(filename, filename) |
| + __field_hex(char *const *, argv) |
| + __field_hex(char *const *, envp)), |
| + TP_fast_assign(tp_copy_string_from_user(filename, filename) |
| + tp_assign(argv, argv) |
| + tp_assign(envp, envp)), |
| + TP_printk() |
| +) |
| + |
| +SC_TRACE_EVENT(sys_clone, |
| + TP_PROTO(unsigned long clone_flags, unsigned long newsp, |
| + void __user *parent_tid, |
| + void __user *child_tid), |
| + TP_ARGS(clone_flags, newsp, parent_tid, child_tid), |
| + TP_STRUCT__entry( |
| + __field_hex(unsigned long, clone_flags) |
| + __field_hex(unsigned long, newsp) |
| + __field_hex(void *, parent_tid) |
| + __field_hex(void *, child_tid)), |
| + TP_fast_assign( |
| + tp_assign(clone_flags, clone_flags) |
| + tp_assign(newsp, newsp) |
| + tp_assign(parent_tid, parent_tid) |
| + tp_assign(child_tid, child_tid)), |
| + TP_printk() |
| +) |
| + |
| +/* present in 32, missing in 64 due to old kernel headers */ |
| +#define OVERRIDE_32_sys_getcpu |
| +#define OVERRIDE_64_sys_getcpu |
| +SC_TRACE_EVENT(sys_getcpu, |
| + TP_PROTO(unsigned __user *cpup, unsigned __user *nodep, void *tcache), |
| + TP_ARGS(cpup, nodep, tcache), |
| + TP_STRUCT__entry( |
| + __field_hex(unsigned *, cpup) |
| + __field_hex(unsigned *, nodep) |
| + __field_hex(void *, tcache)), |
| + TP_fast_assign( |
| + tp_assign(cpup, cpup) |
| + tp_assign(nodep, nodep) |
| + tp_assign(tcache, tcache)), |
| + TP_printk() |
| +) |
| + |
| +#endif /* CREATE_SYSCALL_TABLE */ |
| /* |
| * This is a place-holder for override defines for system calls with |
| * pointers (all architectures). |
| --- a/drivers/staging/lttng/instrumentation/syscalls/headers/x86-32-syscalls-3.1.0-rc6_pointers_override.h |
| +++ b/drivers/staging/lttng/instrumentation/syscalls/headers/x86-32-syscalls-3.1.0-rc6_pointers_override.h |
| @@ -1,17 +1,33 @@ |
| -#ifndef CONFIG_UID16 |
| |
| -#define OVERRIDE_32_sys_getgroups16 |
| -#define OVERRIDE_32_sys_setgroups16 |
| -#define OVERRIDE_32_sys_lchown16 |
| -#define OVERRIDE_32_sys_getresuid16 |
| -#define OVERRIDE_32_sys_getresgid16 |
| -#define OVERRIDE_32_sys_chown16 |
| - |
| -#define OVERRIDE_TABLE_32_sys_getgroups16 |
| -#define OVERRIDE_TABLE_32_sys_setgroups16 |
| -#define OVERRIDE_TABLE_32_sys_lchown16 |
| -#define OVERRIDE_TABLE_32_sys_getresuid16 |
| -#define OVERRIDE_TABLE_32_sys_getresgid16 |
| -#define OVERRIDE_TABLE_32_sys_chown16 |
| +#ifndef CREATE_SYSCALL_TABLE |
| + |
| +# ifndef CONFIG_UID16 |
| +# define OVERRIDE_32_sys_getgroups16 |
| +# define OVERRIDE_32_sys_setgroups16 |
| +# define OVERRIDE_32_sys_lchown16 |
| +# define OVERRIDE_32_sys_getresuid16 |
| +# define OVERRIDE_32_sys_getresgid16 |
| +# define OVERRIDE_32_sys_chown16 |
| +# endif |
| + |
| +#else /* CREATE_SYSCALL_TABLE */ |
| + |
| +# ifndef CONFIG_UID16 |
| +# define OVERRIDE_TABLE_32_sys_getgroups16 |
| +# define OVERRIDE_TABLE_32_sys_setgroups16 |
| +# define OVERRIDE_TABLE_32_sys_lchown16 |
| +# define OVERRIDE_TABLE_32_sys_getresuid16 |
| +# define OVERRIDE_TABLE_32_sys_getresgid16 |
| +# define OVERRIDE_TABLE_32_sys_chown16 |
| +# endif |
| + |
| +#define OVERRIDE_TABLE_32_sys_execve |
| +TRACE_SYSCALL_TABLE(sys_execve, sys_execve, 11, 3) |
| +#define OVERRIDE_TABLE_32_sys_clone |
| +TRACE_SYSCALL_TABLE(sys_clone, sys_clone, 120, 5) |
| +#define OVERRIDE_TABLE_32_sys_getcpu |
| +TRACE_SYSCALL_TABLE(sys_getcpu, sys_getcpu, 318, 3) |
| + |
| +#endif /* CREATE_SYSCALL_TABLE */ |
| + |
| |
| -#endif |
| --- a/drivers/staging/lttng/instrumentation/syscalls/headers/x86-64-syscalls-3.0.4_integers_override.h |
| +++ b/drivers/staging/lttng/instrumentation/syscalls/headers/x86-64-syscalls-3.0.4_integers_override.h |
| @@ -1,3 +1,6 @@ |
| /* |
| * this is a place-holder for x86_64 interger syscall definition override. |
| */ |
| +/* |
| + * this is a place-holder for x86_64 interger syscall definition override. |
| + */ |
| --- a/drivers/staging/lttng/instrumentation/syscalls/headers/x86-64-syscalls-3.0.4_pointers_override.h |
| +++ b/drivers/staging/lttng/instrumentation/syscalls/headers/x86-64-syscalls-3.0.4_pointers_override.h |
| @@ -2,4 +2,11 @@ |
| |
| #else /* CREATE_SYSCALL_TABLE */ |
| |
| +#define OVERRIDE_TABLE_64_sys_clone |
| +TRACE_SYSCALL_TABLE(sys_clone, sys_clone, 56, 5) |
| +#define OVERRIDE_TABLE_64_sys_execve |
| +TRACE_SYSCALL_TABLE(sys_execve, sys_execve, 59, 3) |
| +#define OVERRIDE_TABLE_64_sys_getcpu |
| +TRACE_SYSCALL_TABLE(sys_getcpu, sys_getcpu, 309, 3) |
| + |
| #endif /* CREATE_SYSCALL_TABLE */ |
| --- a/drivers/staging/lttng/instrumentation/syscalls/lttng-syscalls-extractor/lttng-syscalls-extractor.c |
| +++ b/drivers/staging/lttng/instrumentation/syscalls/lttng-syscalls-extractor/lttng-syscalls-extractor.c |
| @@ -1,10 +1,24 @@ |
| /* |
| + * lttng-syscalls-extractor.c |
| + * |
| + * Dump syscall metadata to console. |
| + * |
| * Copyright 2011 - Mathieu Desnoyers <mathieu.desnoyers@efficios.com> |
| * Copyright 2011 - Julien Desfossez <julien.desfossez@polymtl.ca> |
| * |
| - * Dump syscall metadata to console. |
| + * This program is free software; you can redistribute it and/or modify |
| + * it under the terms of the GNU General Public License as published by |
| + * the Free Software Foundation; either version 2 of the License, or |
| + * (at your option) any later version. |
| + * |
| + * This program is distributed in the hope that it will be useful, |
| + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| + * GNU General Public License for more details. |
| * |
| - * GPLv2 license. |
| + * You should have received a copy of the GNU General Public License along |
| + * with this program; if not, write to the Free Software Foundation, Inc., |
| + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
| */ |
| |
| #include <linux/module.h> |
| --- a/drivers/staging/lttng/lib/Makefile |
| +++ b/drivers/staging/lttng/lib/Makefile |
| @@ -1,6 +1,6 @@ |
| -obj-m += lib-ring-buffer.o |
| +obj-m += lttng-lib-ring-buffer.o |
| |
| -lib-ring-buffer-objs := \ |
| +lttng-lib-ring-buffer-objs := \ |
| ringbuffer/ring_buffer_backend.o \ |
| ringbuffer/ring_buffer_frontend.o \ |
| ringbuffer/ring_buffer_iterator.o \ |
| --- a/drivers/staging/lttng/lib/align.h |
| +++ b/drivers/staging/lttng/lib/align.h |
| @@ -4,9 +4,21 @@ |
| /* |
| * lib/align.h |
| * |
| - * (C) Copyright 2010-2011 - Mathieu Desnoyers <mathieu.desnoyers@efficios.com> |
| + * Copyright (C) 2010-2012 Mathieu Desnoyers <mathieu.desnoyers@efficios.com> |
| * |
| - * Dual LGPL v2.1/GPL v2 license. |
| + * This library is free software; you can redistribute it and/or |
| + * modify it under the terms of the GNU Lesser General Public |
| + * License as published by the Free Software Foundation; only |
| + * version 2.1 of the License. |
| + * |
| + * This library is distributed in the hope that it will be useful, |
| + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| + * Lesser General Public License for more details. |
| + * |
| + * You should have received a copy of the GNU Lesser General Public |
| + * License along with this library; if not, write to the Free Software |
| + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| */ |
| |
| #ifdef __KERNEL__ |
| --- a/drivers/staging/lttng/lib/bitfield.h |
| +++ b/drivers/staging/lttng/lib/bitfield.h |
| @@ -19,7 +19,7 @@ |
| * all copies or substantial portions of the Software. |
| */ |
| |
| -#include "../ltt-endian.h" |
| +#include "../lttng-endian.h" |
| |
| #ifndef CHAR_BIT |
| #define CHAR_BIT 8 |
| --- a/drivers/staging/lttng/lib/bug.h |
| +++ b/drivers/staging/lttng/lib/bug.h |
| @@ -4,9 +4,21 @@ |
| /* |
| * lib/bug.h |
| * |
| - * (C) Copyright 2010-2011 - Mathieu Desnoyers <mathieu.desnoyers@efficios.com> |
| + * Copyright (C) 2010-2012 Mathieu Desnoyers <mathieu.desnoyers@efficios.com> |
| * |
| - * Dual LGPL v2.1/GPL v2 license. |
| + * This library is free software; you can redistribute it and/or |
| + * modify it under the terms of the GNU Lesser General Public |
| + * License as published by the Free Software Foundation; only |
| + * version 2.1 of the License. |
| + * |
| + * This library is distributed in the hope that it will be useful, |
| + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| + * Lesser General Public License for more details. |
| + * |
| + * You should have received a copy of the GNU Lesser General Public |
| + * License along with this library; if not, write to the Free Software |
| + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| */ |
| |
| /** |
| --- a/drivers/staging/lttng/lib/ringbuffer/api.h |
| +++ b/drivers/staging/lttng/lib/ringbuffer/api.h |
| @@ -1,14 +1,26 @@ |
| -#ifndef _LINUX_RING_BUFFER_API_H |
| -#define _LINUX_RING_BUFFER_API_H |
| +#ifndef _LIB_RING_BUFFER_API_H |
| +#define _LIB_RING_BUFFER_API_H |
| |
| /* |
| - * linux/ringbuffer/api.h |
| - * |
| - * Copyright (C) 2010 - Mathieu Desnoyers "mathieu.desnoyers@efficios.com" |
| + * lib/ringbuffer/api.h |
| * |
| * Ring Buffer API. |
| * |
| - * Dual LGPL v2.1/GPL v2 license. |
| + * Copyright (C) 2010-2012 Mathieu Desnoyers <mathieu.desnoyers@efficios.com> |
| + * |
| + * This library is free software; you can redistribute it and/or |
| + * modify it under the terms of the GNU Lesser General Public |
| + * License as published by the Free Software Foundation; only |
| + * version 2.1 of the License. |
| + * |
| + * This library is distributed in the hope that it will be useful, |
| + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| + * Lesser General Public License for more details. |
| + * |
| + * You should have received a copy of the GNU Lesser General Public |
| + * License along with this library; if not, write to the Free Software |
| + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| */ |
| |
| #include "../../wrapper/ringbuffer/backend.h" |
| @@ -22,4 +34,4 @@ |
| */ |
| #include "../../wrapper/ringbuffer/frontend_api.h" |
| |
| -#endif /* _LINUX_RING_BUFFER_API_H */ |
| +#endif /* _LIB_RING_BUFFER_API_H */ |
| --- a/drivers/staging/lttng/lib/ringbuffer/backend.h |
| +++ b/drivers/staging/lttng/lib/ringbuffer/backend.h |
| @@ -1,14 +1,26 @@ |
| -#ifndef _LINUX_RING_BUFFER_BACKEND_H |
| -#define _LINUX_RING_BUFFER_BACKEND_H |
| +#ifndef _LIB_RING_BUFFER_BACKEND_H |
| +#define _LIB_RING_BUFFER_BACKEND_H |
| |
| /* |
| - * linux/ringbuffer/backend.h |
| - * |
| - * Copyright (C) 2008-2010 - Mathieu Desnoyers <mathieu.desnoyers@efficios.com> |
| + * lib/ringbuffer/backend.h |
| * |
| * Ring buffer backend (API). |
| * |
| - * Dual LGPL v2.1/GPL v2 license. |
| + * Copyright (C) 2010-2012 Mathieu Desnoyers <mathieu.desnoyers@efficios.com> |
| + * |
| + * This library is free software; you can redistribute it and/or |
| + * modify it under the terms of the GNU Lesser General Public |
| + * License as published by the Free Software Foundation; only |
| + * version 2.1 of the License. |
| + * |
| + * This library is distributed in the hope that it will be useful, |
| + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| + * Lesser General Public License for more details. |
| + * |
| + * You should have received a copy of the GNU Lesser General Public |
| + * License along with this library; if not, write to the Free Software |
| + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| * |
| * Credits to Steven Rostedt for proposing to use an extra-subbuffer owned by |
| * the reader in flight recorder mode. |
| @@ -247,4 +259,4 @@ ssize_t lib_ring_buffer_file_splice_read |
| size_t len, unsigned int flags); |
| loff_t lib_ring_buffer_no_llseek(struct file *file, loff_t offset, int origin); |
| |
| -#endif /* _LINUX_RING_BUFFER_BACKEND_H */ |
| +#endif /* _LIB_RING_BUFFER_BACKEND_H */ |
| --- a/drivers/staging/lttng/lib/ringbuffer/backend_internal.h |
| +++ b/drivers/staging/lttng/lib/ringbuffer/backend_internal.h |
| @@ -1,14 +1,26 @@ |
| -#ifndef _LINUX_RING_BUFFER_BACKEND_INTERNAL_H |
| -#define _LINUX_RING_BUFFER_BACKEND_INTERNAL_H |
| +#ifndef _LIB_RING_BUFFER_BACKEND_INTERNAL_H |
| +#define _LIB_RING_BUFFER_BACKEND_INTERNAL_H |
| |
| /* |
| - * linux/ringbuffer/backend_internal.h |
| - * |
| - * Copyright (C) 2008-2010 - Mathieu Desnoyers <mathieu.desnoyers@efficios.com> |
| + * lib/ringbuffer/backend_internal.h |
| * |
| * Ring buffer backend (internal helpers). |
| * |
| - * Dual LGPL v2.1/GPL v2 license. |
| + * Copyright (C) 2008-2012 Mathieu Desnoyers <mathieu.desnoyers@efficios.com> |
| + * |
| + * This library is free software; you can redistribute it and/or |
| + * modify it under the terms of the GNU Lesser General Public |
| + * License as published by the Free Software Foundation; only |
| + * version 2.1 of the License. |
| + * |
| + * This library is distributed in the hope that it will be useful, |
| + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| + * Lesser General Public License for more details. |
| + * |
| + * You should have received a copy of the GNU Lesser General Public |
| + * License along with this library; if not, write to the Free Software |
| + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| */ |
| |
| #include "../../wrapper/ringbuffer/config.h" |
| @@ -446,4 +458,4 @@ void lib_ring_buffer_do_memset(char *des |
| dest[i] = c; |
| } |
| |
| -#endif /* _LINUX_RING_BUFFER_BACKEND_INTERNAL_H */ |
| +#endif /* _LIB_RING_BUFFER_BACKEND_INTERNAL_H */ |
| --- a/drivers/staging/lttng/lib/ringbuffer/backend_types.h |
| +++ b/drivers/staging/lttng/lib/ringbuffer/backend_types.h |
| @@ -1,14 +1,26 @@ |
| -#ifndef _LINUX_RING_BUFFER_BACKEND_TYPES_H |
| -#define _LINUX_RING_BUFFER_BACKEND_TYPES_H |
| +#ifndef _LIB_RING_BUFFER_BACKEND_TYPES_H |
| +#define _LIB_RING_BUFFER_BACKEND_TYPES_H |
| |
| /* |
| - * linux/ringbuffer/backend_types.h |
| - * |
| - * Copyright (C) 2008-2010 - Mathieu Desnoyers <mathieu.desnoyers@efficios.com> |
| + * lib/ringbuffer/backend_types.h |
| * |
| * Ring buffer backend (types). |
| * |
| - * Dual LGPL v2.1/GPL v2 license. |
| + * Copyright (C) 2008-2012 Mathieu Desnoyers <mathieu.desnoyers@efficios.com> |
| + * |
| + * This library is free software; you can redistribute it and/or |
| + * modify it under the terms of the GNU Lesser General Public |
| + * License as published by the Free Software Foundation; only |
| + * version 2.1 of the License. |
| + * |
| + * This library is distributed in the hope that it will be useful, |
| + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| + * Lesser General Public License for more details. |
| + * |
| + * You should have received a copy of the GNU Lesser General Public |
| + * License along with this library; if not, write to the Free Software |
| + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| */ |
| |
| #include <linux/cpumask.h> |
| @@ -72,9 +84,14 @@ struct channel_backend { |
| u64 start_tsc; /* Channel creation TSC value */ |
| void *priv; /* Client-specific information */ |
| struct notifier_block cpu_hp_notifier; /* CPU hotplug notifier */ |
| - const struct lib_ring_buffer_config *config; /* Ring buffer configuration */ |
| + /* |
| + * We need to copy config because the module containing the |
| + * source config can vanish before the last reference to this |
| + * channel's streams is released. |
| + */ |
| + struct lib_ring_buffer_config config; /* Ring buffer configuration */ |
| cpumask_var_t cpumask; /* Allocated per-cpu buffers cpumask */ |
| char name[NAME_MAX]; /* Channel name */ |
| }; |
| |
| -#endif /* _LINUX_RING_BUFFER_BACKEND_TYPES_H */ |
| +#endif /* _LIB_RING_BUFFER_BACKEND_TYPES_H */ |
| --- a/drivers/staging/lttng/lib/ringbuffer/config.h |
| +++ b/drivers/staging/lttng/lib/ringbuffer/config.h |
| @@ -1,15 +1,27 @@ |
| -#ifndef _LINUX_RING_BUFFER_CONFIG_H |
| -#define _LINUX_RING_BUFFER_CONFIG_H |
| +#ifndef _LIB_RING_BUFFER_CONFIG_H |
| +#define _LIB_RING_BUFFER_CONFIG_H |
| |
| /* |
| - * linux/ringbuffer/config.h |
| - * |
| - * Copyright (C) 2010 - Mathieu Desnoyers <mathieu.desnoyers@efficios.com> |
| + * lib/ringbuffer/config.h |
| * |
| * Ring buffer configuration header. Note: after declaring the standard inline |
| * functions, clients should also include linux/ringbuffer/api.h. |
| * |
| - * Dual LGPL v2.1/GPL v2 license. |
| + * Copyright (C) 2010-2012 Mathieu Desnoyers <mathieu.desnoyers@efficios.com> |
| + * |
| + * This library is free software; you can redistribute it and/or |
| + * modify it under the terms of the GNU Lesser General Public |
| + * License as published by the Free Software Foundation; only |
| + * version 2.1 of the License. |
| + * |
| + * This library is distributed in the hope that it will be useful, |
| + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| + * Lesser General Public License for more details. |
| + * |
| + * You should have received a copy of the GNU Lesser General Public |
| + * License along with this library; if not, write to the Free Software |
| + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| */ |
| |
| #include <linux/types.h> |
| @@ -295,4 +307,4 @@ int lib_ring_buffer_check_config(const s |
| |
| #include "../../wrapper/ringbuffer/vatomic.h" |
| |
| -#endif /* _LINUX_RING_BUFFER_CONFIG_H */ |
| +#endif /* _LIB_RING_BUFFER_CONFIG_H */ |
| --- a/drivers/staging/lttng/lib/ringbuffer/frontend.h |
| +++ b/drivers/staging/lttng/lib/ringbuffer/frontend.h |
| @@ -1,19 +1,31 @@ |
| -#ifndef _LINUX_RING_BUFFER_FRONTEND_H |
| -#define _LINUX_RING_BUFFER_FRONTEND_H |
| +#ifndef _LIB_RING_BUFFER_FRONTEND_H |
| +#define _LIB_RING_BUFFER_FRONTEND_H |
| |
| /* |
| - * linux/ringbuffer/frontend.h |
| - * |
| - * (C) Copyright 2005-2010 - Mathieu Desnoyers <mathieu.desnoyers@efficios.com> |
| + * lib/ringbuffer/frontend.h |
| * |
| * Ring Buffer Library Synchronization Header (API). |
| * |
| + * Copyright (C) 2005-2012 Mathieu Desnoyers <mathieu.desnoyers@efficios.com> |
| + * |
| + * This library is free software; you can redistribute it and/or |
| + * modify it under the terms of the GNU Lesser General Public |
| + * License as published by the Free Software Foundation; only |
| + * version 2.1 of the License. |
| + * |
| + * This library is distributed in the hope that it will be useful, |
| + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| + * Lesser General Public License for more details. |
| + * |
| + * You should have received a copy of the GNU Lesser General Public |
| + * License along with this library; if not, write to the Free Software |
| + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| + * |
| * Author: |
| * Mathieu Desnoyers <mathieu.desnoyers@efficios.com> |
| * |
| * See ring_buffer_frontend.c for more information on wait-free algorithms. |
| - * |
| - * Dual LGPL v2.1/GPL v2 license. |
| */ |
| |
| #include <linux/pipe_fs_i.h> |
| @@ -225,4 +237,4 @@ unsigned long lib_ring_buffer_get_record |
| return v_read(config, &buf->backend.records_read); |
| } |
| |
| -#endif /* _LINUX_RING_BUFFER_FRONTEND_H */ |
| +#endif /* _LIB_RING_BUFFER_FRONTEND_H */ |
| --- a/drivers/staging/lttng/lib/ringbuffer/frontend_api.h |
| +++ b/drivers/staging/lttng/lib/ringbuffer/frontend_api.h |
| @@ -1,20 +1,32 @@ |
| -#ifndef _LINUX_RING_BUFFER_FRONTEND_API_H |
| -#define _LINUX_RING_BUFFER_FRONTEND_API_H |
| +#ifndef _LIB_RING_BUFFER_FRONTEND_API_H |
| +#define _LIB_RING_BUFFER_FRONTEND_API_H |
| |
| /* |
| - * linux/ringbuffer/frontend_api.h |
| - * |
| - * (C) Copyright 2005-2010 - Mathieu Desnoyers <mathieu.desnoyers@efficios.com> |
| + * lib/ringbuffer/frontend_api.h |
| * |
| * Ring Buffer Library Synchronization Header (buffer write API). |
| * |
| + * Copyright (C) 2005-2012 Mathieu Desnoyers <mathieu.desnoyers@efficios.com> |
| + * |
| + * This library is free software; you can redistribute it and/or |
| + * modify it under the terms of the GNU Lesser General Public |
| + * License as published by the Free Software Foundation; only |
| + * version 2.1 of the License. |
| + * |
| + * This library is distributed in the hope that it will be useful, |
| + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| + * Lesser General Public License for more details. |
| + * |
| + * You should have received a copy of the GNU Lesser General Public |
| + * License along with this library; if not, write to the Free Software |
| + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| + * |
| * Author: |
| * Mathieu Desnoyers <mathieu.desnoyers@efficios.com> |
| * |
| * See ring_buffer_frontend.c for more information on wait-free algorithms. |
| * See linux/ringbuffer/frontend.h for channel allocation and read-side API. |
| - * |
| - * Dual LGPL v2.1/GPL v2 license. |
| */ |
| |
| #include "../../wrapper/ringbuffer/frontend.h" |
| @@ -355,4 +367,4 @@ void lib_ring_buffer_record_enable(const |
| atomic_dec(&buf->record_disabled); |
| } |
| |
| -#endif /* _LINUX_RING_BUFFER_FRONTEND_API_H */ |
| +#endif /* _LIB_RING_BUFFER_FRONTEND_API_H */ |
| --- a/drivers/staging/lttng/lib/ringbuffer/frontend_internal.h |
| +++ b/drivers/staging/lttng/lib/ringbuffer/frontend_internal.h |
| @@ -1,19 +1,31 @@ |
| -#ifndef _LINUX_RING_BUFFER_FRONTEND_INTERNAL_H |
| -#define _LINUX_RING_BUFFER_FRONTEND_INTERNAL_H |
| +#ifndef _LIB_RING_BUFFER_FRONTEND_INTERNAL_H |
| +#define _LIB_RING_BUFFER_FRONTEND_INTERNAL_H |
| |
| /* |
| * linux/ringbuffer/frontend_internal.h |
| * |
| - * (C) Copyright 2005-2010 - Mathieu Desnoyers <mathieu.desnoyers@efficios.com> |
| - * |
| * Ring Buffer Library Synchronization Header (internal helpers). |
| * |
| + * Copyright (C) 2005-2012 Mathieu Desnoyers <mathieu.desnoyers@efficios.com> |
| + * |
| + * This library is free software; you can redistribute it and/or |
| + * modify it under the terms of the GNU Lesser General Public |
| + * License as published by the Free Software Foundation; only |
| + * version 2.1 of the License. |
| + * |
| + * This library is distributed in the hope that it will be useful, |
| + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| + * Lesser General Public License for more details. |
| + * |
| + * You should have received a copy of the GNU Lesser General Public |
| + * License along with this library; if not, write to the Free Software |
| + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| + * |
| * Author: |
| * Mathieu Desnoyers <mathieu.desnoyers@efficios.com> |
| * |
| * See ring_buffer_frontend.c for more information on wait-free algorithms. |
| - * |
| - * Dual LGPL v2.1/GPL v2 license. |
| */ |
| |
| #include "../../wrapper/ringbuffer/config.h" |
| @@ -421,4 +433,4 @@ extern void lib_ring_buffer_free(struct |
| /* Keep track of trap nesting inside ring buffer code */ |
| DECLARE_PER_CPU(unsigned int, lib_ring_buffer_nesting); |
| |
| -#endif /* _LINUX_RING_BUFFER_FRONTEND_INTERNAL_H */ |
| +#endif /* _LIB_RING_BUFFER_FRONTEND_INTERNAL_H */ |
| --- a/drivers/staging/lttng/lib/ringbuffer/frontend_types.h |
| +++ b/drivers/staging/lttng/lib/ringbuffer/frontend_types.h |
| @@ -1,19 +1,31 @@ |
| -#ifndef _LINUX_RING_BUFFER_FRONTEND_TYPES_H |
| -#define _LINUX_RING_BUFFER_FRONTEND_TYPES_H |
| +#ifndef _LIB_RING_BUFFER_FRONTEND_TYPES_H |
| +#define _LIB_RING_BUFFER_FRONTEND_TYPES_H |
| |
| /* |
| - * linux/ringbuffer/frontend_types.h |
| - * |
| - * (C) Copyright 2005-2010 - Mathieu Desnoyers <mathieu.desnoyers@efficios.com> |
| + * lib/ringbuffer/frontend_types.h |
| * |
| * Ring Buffer Library Synchronization Header (types). |
| * |
| + * Copyright (C) 2010-2012 Mathieu Desnoyers <mathieu.desnoyers@efficios.com> |
| + * |
| + * This library is free software; you can redistribute it and/or |
| + * modify it under the terms of the GNU Lesser General Public |
| + * License as published by the Free Software Foundation; only |
| + * version 2.1 of the License. |
| + * |
| + * This library is distributed in the hope that it will be useful, |
| + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| + * Lesser General Public License for more details. |
| + * |
| + * You should have received a copy of the GNU Lesser General Public |
| + * License along with this library; if not, write to the Free Software |
| + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| + * |
| * Author: |
| * Mathieu Desnoyers <mathieu.desnoyers@efficios.com> |
| * |
| * See ring_buffer_frontend.c for more information on wait-free algorithms. |
| - * |
| - * Dual LGPL v2.1/GPL v2 license. |
| */ |
| |
| #include <linux/kref.h> |
| @@ -138,9 +150,9 @@ struct lib_ring_buffer { |
| unsigned long get_subbuf_consumed; /* Read-side consumed */ |
| unsigned long prod_snapshot; /* Producer count snapshot */ |
| unsigned long cons_snapshot; /* Consumer count snapshot */ |
| - uint get_subbuf:1; /* Sub-buffer being held by reader */ |
| - uint switch_timer_enabled:1; /* Protected by ring_buffer_nohz_lock */ |
| - uint read_timer_enabled:1; /* Protected by ring_buffer_nohz_lock */ |
| + uint get_subbuf:1, /* Sub-buffer being held by reader */ |
| + switch_timer_enabled:1, /* Protected by ring_buffer_nohz_lock */ |
| + read_timer_enabled:1; /* Protected by ring_buffer_nohz_lock */ |
| }; |
| |
| static inline |
| @@ -173,4 +185,4 @@ void *channel_get_private(struct channel |
| _____ret; \ |
| }) |
| |
| -#endif /* _LINUX_RING_BUFFER_FRONTEND_TYPES_H */ |
| +#endif /* _LIB_RING_BUFFER_FRONTEND_TYPES_H */ |
| --- a/drivers/staging/lttng/lib/ringbuffer/iterator.h |
| +++ b/drivers/staging/lttng/lib/ringbuffer/iterator.h |
| @@ -1,17 +1,29 @@ |
| -#ifndef _LINUX_RING_BUFFER_ITERATOR_H |
| -#define _LINUX_RING_BUFFER_ITERATOR_H |
| +#ifndef _LIB_RING_BUFFER_ITERATOR_H |
| +#define _LIB_RING_BUFFER_ITERATOR_H |
| |
| /* |
| - * linux/ringbuffer/iterator.h |
| - * |
| - * (C) Copyright 2010 - Mathieu Desnoyers <mathieu.desnoyers@efficios.com> |
| + * lib/ringbuffer/iterator.h |
| * |
| * Ring buffer and channel iterators. |
| * |
| + * Copyright (C) 2010-2012 Mathieu Desnoyers <mathieu.desnoyers@efficios.com> |
| + * |
| + * This library is free software; you can redistribute it and/or |
| + * modify it under the terms of the GNU Lesser General Public |
| + * License as published by the Free Software Foundation; only |
| + * version 2.1 of the License. |
| + * |
| + * This library is distributed in the hope that it will be useful, |
| + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| + * Lesser General Public License for more details. |
| + * |
| + * You should have received a copy of the GNU Lesser General Public |
| + * License along with this library; if not, write to the Free Software |
| + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| + * |
| * Author: |
| * Mathieu Desnoyers <mathieu.desnoyers@efficios.com> |
| - * |
| - * Dual LGPL v2.1/GPL v2 license. |
| */ |
| |
| #include "../../wrapper/ringbuffer/backend.h" |
| @@ -67,4 +79,4 @@ void channel_iterator_free(struct channe |
| void channel_iterator_reset(struct channel *chan); |
| void lib_ring_buffer_iterator_reset(struct lib_ring_buffer *buf); |
| |
| -#endif /* _LINUX_RING_BUFFER_ITERATOR_H */ |
| +#endif /* _LIB_RING_BUFFER_ITERATOR_H */ |
| --- a/drivers/staging/lttng/lib/ringbuffer/nohz.h |
| +++ b/drivers/staging/lttng/lib/ringbuffer/nohz.h |
| @@ -1,12 +1,24 @@ |
| -#ifndef _LINUX_RING_BUFFER_NOHZ_H |
| -#define _LINUX_RING_BUFFER_NOHZ_H |
| +#ifndef _LIB_RING_BUFFER_NOHZ_H |
| +#define _LIB_RING_BUFFER_NOHZ_H |
| |
| /* |
| - * ringbuffer/nohz.h |
| + * lib/ringbuffer/nohz.h |
| * |
| - * Copyright (C) 2011 Mathieu Desnoyers <mathieu.desnoyers@efficios.com> |
| + * Copyright (C) 2011-2012 Mathieu Desnoyers <mathieu.desnoyers@efficios.com> |
| * |
| - * Dual LGPL v2.1/GPL v2 license. |
| + * This library is free software; you can redistribute it and/or |
| + * modify it under the terms of the GNU Lesser General Public |
| + * License as published by the Free Software Foundation; only |
| + * version 2.1 of the License. |
| + * |
| + * This library is distributed in the hope that it will be useful, |
| + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| + * Lesser General Public License for more details. |
| + * |
| + * You should have received a copy of the GNU Lesser General Public |
| + * License along with this library; if not, write to the Free Software |
| + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| */ |
| |
| #ifdef CONFIG_LIB_RING_BUFFER |
| @@ -27,4 +39,4 @@ static inline void lib_ring_buffer_tick_ |
| } |
| #endif |
| |
| -#endif /* _LINUX_RING_BUFFER_NOHZ_H */ |
| +#endif /* _LIB_RING_BUFFER_NOHZ_H */ |
| --- a/drivers/staging/lttng/lib/ringbuffer/ring_buffer_backend.c |
| +++ b/drivers/staging/lttng/lib/ringbuffer/ring_buffer_backend.c |
| @@ -1,9 +1,21 @@ |
| /* |
| * ring_buffer_backend.c |
| * |
| - * Copyright (C) 2005-2010 - Mathieu Desnoyers <mathieu.desnoyers@efficios.com> |
| + * Copyright (C) 2005-2012 Mathieu Desnoyers <mathieu.desnoyers@efficios.com> |
| * |
| - * Dual LGPL v2.1/GPL v2 license. |
| + * This library is free software; you can redistribute it and/or |
| + * modify it under the terms of the GNU Lesser General Public |
| + * License as published by the Free Software Foundation; only |
| + * version 2.1 of the License. |
| + * |
| + * This library is distributed in the hope that it will be useful, |
| + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| + * Lesser General Public License for more details. |
| + * |
| + * You should have received a copy of the GNU Lesser General Public |
| + * License along with this library; if not, write to the Free Software |
| + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| */ |
| |
| #include <linux/stddef.h> |
| @@ -155,7 +167,7 @@ pages_error: |
| int lib_ring_buffer_backend_create(struct lib_ring_buffer_backend *bufb, |
| struct channel_backend *chanb, int cpu) |
| { |
| - const struct lib_ring_buffer_config *config = chanb->config; |
| + const struct lib_ring_buffer_config *config = &chanb->config; |
| |
| bufb->chan = container_of(chanb, struct channel, backend); |
| bufb->cpu = cpu; |
| @@ -187,7 +199,7 @@ void lib_ring_buffer_backend_free(struct |
| void lib_ring_buffer_backend_reset(struct lib_ring_buffer_backend *bufb) |
| { |
| struct channel_backend *chanb = &bufb->chan->backend; |
| - const struct lib_ring_buffer_config *config = chanb->config; |
| + const struct lib_ring_buffer_config *config = &chanb->config; |
| unsigned long num_subbuf_alloc; |
| unsigned int i; |
| |
| @@ -221,7 +233,7 @@ void lib_ring_buffer_backend_reset(struc |
| void channel_backend_reset(struct channel_backend *chanb) |
| { |
| struct channel *chan = container_of(chanb, struct channel, backend); |
| - const struct lib_ring_buffer_config *config = chanb->config; |
| + const struct lib_ring_buffer_config *config = &chanb->config; |
| |
| /* |
| * Don't reset buf_size, subbuf_size, subbuf_size_order, |
| @@ -248,7 +260,7 @@ int __cpuinit lib_ring_buffer_cpu_hp_cal |
| unsigned int cpu = (unsigned long)hcpu; |
| struct channel_backend *chanb = container_of(nb, struct channel_backend, |
| cpu_hp_notifier); |
| - const struct lib_ring_buffer_config *config = chanb->config; |
| + const struct lib_ring_buffer_config *config = &chanb->config; |
| struct lib_ring_buffer *buf; |
| int ret; |
| |
| @@ -307,18 +319,18 @@ int channel_backend_init(struct channel_ |
| if (!name) |
| return -EPERM; |
| |
| - if (!(subbuf_size && num_subbuf)) |
| - return -EPERM; |
| - |
| /* Check that the subbuffer size is larger than a page. */ |
| if (subbuf_size < PAGE_SIZE) |
| return -EINVAL; |
| |
| /* |
| - * Make sure the number of subbuffers and subbuffer size are power of 2. |
| + * Make sure the number of subbuffers and subbuffer size are |
| + * power of 2 and nonzero. |
| */ |
| - CHAN_WARN_ON(chanb, hweight32(subbuf_size) != 1); |
| - CHAN_WARN_ON(chanb, hweight32(num_subbuf) != 1); |
| + if (!subbuf_size || (subbuf_size & (subbuf_size - 1))) |
| + return -EINVAL; |
| + if (!num_subbuf || (num_subbuf & (num_subbuf - 1))) |
| + return -EINVAL; |
| |
| ret = subbuffer_id_check_index(config, num_subbuf); |
| if (ret) |
| @@ -334,7 +346,7 @@ int channel_backend_init(struct channel_ |
| (config->mode == RING_BUFFER_OVERWRITE) ? 1 : 0; |
| chanb->num_subbuf = num_subbuf; |
| strlcpy(chanb->name, name, NAME_MAX); |
| - chanb->config = config; |
| + memcpy(&chanb->config, config, sizeof(chanb->config)); |
| |
| if (config->alloc == RING_BUFFER_ALLOC_PER_CPU) { |
| if (!zalloc_cpumask_var(&chanb->cpumask, GFP_KERNEL)) |
| @@ -421,7 +433,7 @@ free_cpumask: |
| */ |
| void channel_backend_unregister_notifiers(struct channel_backend *chanb) |
| { |
| - const struct lib_ring_buffer_config *config = chanb->config; |
| + const struct lib_ring_buffer_config *config = &chanb->config; |
| |
| if (config->alloc == RING_BUFFER_ALLOC_PER_CPU) |
| unregister_hotcpu_notifier(&chanb->cpu_hp_notifier); |
| @@ -435,7 +447,7 @@ void channel_backend_unregister_notifier |
| */ |
| void channel_backend_free(struct channel_backend *chanb) |
| { |
| - const struct lib_ring_buffer_config *config = chanb->config; |
| + const struct lib_ring_buffer_config *config = &chanb->config; |
| unsigned int i; |
| |
| if (config->alloc == RING_BUFFER_ALLOC_PER_CPU) { |
| @@ -469,7 +481,7 @@ void _lib_ring_buffer_write(struct lib_r |
| const void *src, size_t len, ssize_t pagecpy) |
| { |
| struct channel_backend *chanb = &bufb->chan->backend; |
| - const struct lib_ring_buffer_config *config = chanb->config; |
| + const struct lib_ring_buffer_config *config = &chanb->config; |
| size_t sbidx, index; |
| struct lib_ring_buffer_backend_pages *rpages; |
| unsigned long sb_bindex, id; |
| @@ -515,7 +527,7 @@ void _lib_ring_buffer_memset(struct lib_ |
| int c, size_t len, ssize_t pagecpy) |
| { |
| struct channel_backend *chanb = &bufb->chan->backend; |
| - const struct lib_ring_buffer_config *config = chanb->config; |
| + const struct lib_ring_buffer_config *config = &chanb->config; |
| size_t sbidx, index; |
| struct lib_ring_buffer_backend_pages *rpages; |
| unsigned long sb_bindex, id; |
| @@ -564,7 +576,7 @@ void _lib_ring_buffer_copy_from_user(str |
| ssize_t pagecpy) |
| { |
| struct channel_backend *chanb = &bufb->chan->backend; |
| - const struct lib_ring_buffer_config *config = chanb->config; |
| + const struct lib_ring_buffer_config *config = &chanb->config; |
| size_t sbidx, index; |
| struct lib_ring_buffer_backend_pages *rpages; |
| unsigned long sb_bindex, id; |
| @@ -616,7 +628,7 @@ size_t lib_ring_buffer_read(struct lib_r |
| void *dest, size_t len) |
| { |
| struct channel_backend *chanb = &bufb->chan->backend; |
| - const struct lib_ring_buffer_config *config = chanb->config; |
| + const struct lib_ring_buffer_config *config = &chanb->config; |
| size_t index; |
| ssize_t pagecpy, orig_len; |
| struct lib_ring_buffer_backend_pages *rpages; |
| @@ -668,7 +680,7 @@ int __lib_ring_buffer_copy_to_user(struc |
| size_t offset, void __user *dest, size_t len) |
| { |
| struct channel_backend *chanb = &bufb->chan->backend; |
| - const struct lib_ring_buffer_config *config = chanb->config; |
| + const struct lib_ring_buffer_config *config = &chanb->config; |
| size_t index; |
| ssize_t pagecpy; |
| struct lib_ring_buffer_backend_pages *rpages; |
| @@ -719,7 +731,7 @@ int lib_ring_buffer_read_cstr(struct lib |
| void *dest, size_t len) |
| { |
| struct channel_backend *chanb = &bufb->chan->backend; |
| - const struct lib_ring_buffer_config *config = chanb->config; |
| + const struct lib_ring_buffer_config *config = &chanb->config; |
| size_t index; |
| ssize_t pagecpy, pagelen, strpagelen, orig_offset; |
| char *str; |
| @@ -777,7 +789,7 @@ struct page **lib_ring_buffer_read_get_p |
| size_t index; |
| struct lib_ring_buffer_backend_pages *rpages; |
| struct channel_backend *chanb = &bufb->chan->backend; |
| - const struct lib_ring_buffer_config *config = chanb->config; |
| + const struct lib_ring_buffer_config *config = &chanb->config; |
| unsigned long sb_bindex, id; |
| |
| offset &= chanb->buf_size - 1; |
| @@ -808,7 +820,7 @@ void *lib_ring_buffer_read_offset_addres |
| size_t index; |
| struct lib_ring_buffer_backend_pages *rpages; |
| struct channel_backend *chanb = &bufb->chan->backend; |
| - const struct lib_ring_buffer_config *config = chanb->config; |
| + const struct lib_ring_buffer_config *config = &chanb->config; |
| unsigned long sb_bindex, id; |
| |
| offset &= chanb->buf_size - 1; |
| @@ -838,7 +850,7 @@ void *lib_ring_buffer_offset_address(str |
| size_t sbidx, index; |
| struct lib_ring_buffer_backend_pages *rpages; |
| struct channel_backend *chanb = &bufb->chan->backend; |
| - const struct lib_ring_buffer_config *config = chanb->config; |
| + const struct lib_ring_buffer_config *config = &chanb->config; |
| unsigned long sb_bindex, id; |
| |
| offset &= chanb->buf_size - 1; |
| --- a/drivers/staging/lttng/lib/ringbuffer/ring_buffer_frontend.c |
| +++ b/drivers/staging/lttng/lib/ringbuffer/ring_buffer_frontend.c |
| @@ -1,7 +1,22 @@ |
| /* |
| * ring_buffer_frontend.c |
| * |
| - * (C) Copyright 2005-2010 - Mathieu Desnoyers <mathieu.desnoyers@efficios.com> |
| + * Copyright (C) 2005-2012 Mathieu Desnoyers <mathieu.desnoyers@efficios.com> |
| + * |
| + * This library is free software; you can redistribute it and/or |
| + * modify it under the terms of the GNU Lesser General Public |
| + * License as published by the Free Software Foundation; only |
| + * version 2.1 of the License. |
| + * |
| + * This library is distributed in the hope that it will be useful, |
| + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| + * Lesser General Public License for more details. |
| + * |
| + * You should have received a copy of the GNU Lesser General Public |
| + * License along with this library; if not, write to the Free Software |
| + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| + * |
| * |
| * Ring buffer wait-free buffer synchronization. Producer-consumer and flight |
| * recorder (overwrite) modes. See thesis: |
| @@ -34,8 +49,6 @@ |
| * - splice one subbuffer worth of data to a pipe |
| * - splice the data from pipe to disk/network |
| * - put_subbuf |
| - * |
| - * Dual LGPL v2.1/GPL v2 license. |
| */ |
| |
| #include <linux/delay.h> |
| @@ -103,7 +116,7 @@ void lib_ring_buffer_free(struct lib_rin |
| void lib_ring_buffer_reset(struct lib_ring_buffer *buf) |
| { |
| struct channel *chan = buf->backend.chan; |
| - const struct lib_ring_buffer_config *config = chan->backend.config; |
| + const struct lib_ring_buffer_config *config = &chan->backend.config; |
| unsigned int i; |
| |
| /* |
| @@ -161,7 +174,7 @@ EXPORT_SYMBOL_GPL(channel_reset); |
| int lib_ring_buffer_create(struct lib_ring_buffer *buf, |
| struct channel_backend *chanb, int cpu) |
| { |
| - const struct lib_ring_buffer_config *config = chanb->config; |
| + const struct lib_ring_buffer_config *config = &chanb->config; |
| struct channel *chan = container_of(chanb, struct channel, backend); |
| void *priv = chanb->priv; |
| size_t subbuf_header_size; |
| @@ -253,7 +266,7 @@ static void switch_buffer_timer(unsigned |
| { |
| struct lib_ring_buffer *buf = (struct lib_ring_buffer *)data; |
| struct channel *chan = buf->backend.chan; |
| - const struct lib_ring_buffer_config *config = chan->backend.config; |
| + const struct lib_ring_buffer_config *config = &chan->backend.config; |
| |
| /* |
| * Only flush buffers periodically if readers are active. |
| @@ -275,7 +288,7 @@ static void switch_buffer_timer(unsigned |
| static void lib_ring_buffer_start_switch_timer(struct lib_ring_buffer *buf) |
| { |
| struct channel *chan = buf->backend.chan; |
| - const struct lib_ring_buffer_config *config = chan->backend.config; |
| + const struct lib_ring_buffer_config *config = &chan->backend.config; |
| |
| if (!chan->switch_timer_interval || buf->switch_timer_enabled) |
| return; |
| @@ -311,7 +324,7 @@ static void read_buffer_timer(unsigned l |
| { |
| struct lib_ring_buffer *buf = (struct lib_ring_buffer *)data; |
| struct channel *chan = buf->backend.chan; |
| - const struct lib_ring_buffer_config *config = chan->backend.config; |
| + const struct lib_ring_buffer_config *config = &chan->backend.config; |
| |
| CHAN_WARN_ON(chan, !buf->backend.allocated); |
| |
| @@ -335,7 +348,7 @@ static void read_buffer_timer(unsigned l |
| static void lib_ring_buffer_start_read_timer(struct lib_ring_buffer *buf) |
| { |
| struct channel *chan = buf->backend.chan; |
| - const struct lib_ring_buffer_config *config = chan->backend.config; |
| + const struct lib_ring_buffer_config *config = &chan->backend.config; |
| |
| if (config->wakeup != RING_BUFFER_WAKEUP_BY_TIMER |
| || !chan->read_timer_interval |
| @@ -360,7 +373,7 @@ static void lib_ring_buffer_start_read_t |
| static void lib_ring_buffer_stop_read_timer(struct lib_ring_buffer *buf) |
| { |
| struct channel *chan = buf->backend.chan; |
| - const struct lib_ring_buffer_config *config = chan->backend.config; |
| + const struct lib_ring_buffer_config *config = &chan->backend.config; |
| |
| if (config->wakeup != RING_BUFFER_WAKEUP_BY_TIMER |
| || !chan->read_timer_interval |
| @@ -397,7 +410,7 @@ int __cpuinit lib_ring_buffer_cpu_hp_cal |
| struct channel *chan = container_of(nb, struct channel, |
| cpu_hp_notifier); |
| struct lib_ring_buffer *buf = per_cpu_ptr(chan->backend.buf, cpu); |
| - const struct lib_ring_buffer_config *config = chan->backend.config; |
| + const struct lib_ring_buffer_config *config = &chan->backend.config; |
| |
| if (!chan->cpu_hp_enable) |
| return NOTIFY_DONE; |
| @@ -452,7 +465,7 @@ static int notrace ring_buffer_tick_nohz |
| { |
| struct channel *chan = container_of(nb, struct channel, |
| tick_nohz_notifier); |
| - const struct lib_ring_buffer_config *config = chan->backend.config; |
| + const struct lib_ring_buffer_config *config = &chan->backend.config; |
| struct lib_ring_buffer *buf; |
| int cpu = smp_processor_id(); |
| |
| @@ -524,7 +537,7 @@ void notrace lib_ring_buffer_tick_nohz_r |
| */ |
| static void channel_unregister_notifiers(struct channel *chan) |
| { |
| - const struct lib_ring_buffer_config *config = chan->backend.config; |
| + const struct lib_ring_buffer_config *config = &chan->backend.config; |
| int cpu; |
| |
| channel_iterator_unregister_notifiers(chan); |
| @@ -708,7 +721,7 @@ void channel_release(struct kref *kref) |
| void *channel_destroy(struct channel *chan) |
| { |
| int cpu; |
| - const struct lib_ring_buffer_config *config = chan->backend.config; |
| + const struct lib_ring_buffer_config *config = &chan->backend.config; |
| void *priv; |
| |
| channel_unregister_notifiers(chan); |
| @@ -818,7 +831,7 @@ int lib_ring_buffer_snapshot(struct lib_ |
| unsigned long *consumed, unsigned long *produced) |
| { |
| struct channel *chan = buf->backend.chan; |
| - const struct lib_ring_buffer_config *config = chan->backend.config; |
| + const struct lib_ring_buffer_config *config = &chan->backend.config; |
| unsigned long consumed_cur, write_offset; |
| int finalized; |
| |
| @@ -909,7 +922,7 @@ int lib_ring_buffer_get_subbuf(struct li |
| unsigned long consumed) |
| { |
| struct channel *chan = buf->backend.chan; |
| - const struct lib_ring_buffer_config *config = chan->backend.config; |
| + const struct lib_ring_buffer_config *config = &chan->backend.config; |
| unsigned long consumed_cur, consumed_idx, commit_count, write_offset; |
| int ret; |
| int finalized; |
| @@ -1055,7 +1068,7 @@ void lib_ring_buffer_put_subbuf(struct l |
| { |
| struct lib_ring_buffer_backend *bufb = &buf->backend; |
| struct channel *chan = bufb->chan; |
| - const struct lib_ring_buffer_config *config = chan->backend.config; |
| + const struct lib_ring_buffer_config *config = &chan->backend.config; |
| unsigned long read_sb_bindex, consumed_idx, consumed; |
| |
| CHAN_WARN_ON(chan, atomic_long_read(&buf->active_readers) != 1); |
| @@ -1114,7 +1127,7 @@ void lib_ring_buffer_print_subbuffer_err |
| unsigned long cons_offset, |
| int cpu) |
| { |
| - const struct lib_ring_buffer_config *config = chan->backend.config; |
| + const struct lib_ring_buffer_config *config = &chan->backend.config; |
| unsigned long cons_idx, commit_count, commit_count_sb; |
| |
| cons_idx = subbuf_index(cons_offset, chan); |
| @@ -1140,7 +1153,7 @@ void lib_ring_buffer_print_buffer_errors |
| struct channel *chan, |
| void *priv, int cpu) |
| { |
| - const struct lib_ring_buffer_config *config = chan->backend.config; |
| + const struct lib_ring_buffer_config *config = &chan->backend.config; |
| unsigned long write_offset, cons_offset; |
| |
| /* |
| @@ -1170,27 +1183,34 @@ static |
| void lib_ring_buffer_print_errors(struct channel *chan, |
| struct lib_ring_buffer *buf, int cpu) |
| { |
| - const struct lib_ring_buffer_config *config = chan->backend.config; |
| + const struct lib_ring_buffer_config *config = &chan->backend.config; |
| void *priv = chan->backend.priv; |
| |
| - printk(KERN_DEBUG "ring buffer %s, cpu %d: %lu records written, " |
| - "%lu records overrun\n", |
| - chan->backend.name, cpu, |
| - v_read(config, &buf->records_count), |
| - v_read(config, &buf->records_overrun)); |
| - |
| - if (v_read(config, &buf->records_lost_full) |
| - || v_read(config, &buf->records_lost_wrap) |
| - || v_read(config, &buf->records_lost_big)) |
| - printk(KERN_WARNING |
| - "ring buffer %s, cpu %d: records were lost. Caused by:\n" |
| - " [ %lu buffer full, %lu nest buffer wrap-around, " |
| - "%lu event too big ]\n", |
| - chan->backend.name, cpu, |
| - v_read(config, &buf->records_lost_full), |
| - v_read(config, &buf->records_lost_wrap), |
| - v_read(config, &buf->records_lost_big)); |
| - |
| + if (!strcmp(chan->backend.name, "relay-metadata")) { |
| + printk(KERN_DEBUG "ring buffer %s: %lu records written, " |
| + "%lu records overrun\n", |
| + chan->backend.name, |
| + v_read(config, &buf->records_count), |
| + v_read(config, &buf->records_overrun)); |
| + } else { |
| + printk(KERN_DEBUG "ring buffer %s, cpu %d: %lu records written, " |
| + "%lu records overrun\n", |
| + chan->backend.name, cpu, |
| + v_read(config, &buf->records_count), |
| + v_read(config, &buf->records_overrun)); |
| + |
| + if (v_read(config, &buf->records_lost_full) |
| + || v_read(config, &buf->records_lost_wrap) |
| + || v_read(config, &buf->records_lost_big)) |
| + printk(KERN_WARNING |
| + "ring buffer %s, cpu %d: records were lost. Caused by:\n" |
| + " [ %lu buffer full, %lu nest buffer wrap-around, " |
| + "%lu event too big ]\n", |
| + chan->backend.name, cpu, |
| + v_read(config, &buf->records_lost_full), |
| + v_read(config, &buf->records_lost_wrap), |
| + v_read(config, &buf->records_lost_big)); |
| + } |
| lib_ring_buffer_print_buffer_errors(buf, chan, priv, cpu); |
| } |
| |
| @@ -1205,7 +1225,7 @@ void lib_ring_buffer_switch_old_start(st |
| struct switch_offsets *offsets, |
| u64 tsc) |
| { |
| - const struct lib_ring_buffer_config *config = chan->backend.config; |
| + const struct lib_ring_buffer_config *config = &chan->backend.config; |
| unsigned long oldidx = subbuf_index(offsets->old, chan); |
| unsigned long commit_count; |
| |
| @@ -1249,7 +1269,7 @@ void lib_ring_buffer_switch_old_end(stru |
| struct switch_offsets *offsets, |
| u64 tsc) |
| { |
| - const struct lib_ring_buffer_config *config = chan->backend.config; |
| + const struct lib_ring_buffer_config *config = &chan->backend.config; |
| unsigned long oldidx = subbuf_index(offsets->old - 1, chan); |
| unsigned long commit_count, padding_size, data_size; |
| |
| @@ -1292,7 +1312,7 @@ void lib_ring_buffer_switch_new_start(st |
| struct switch_offsets *offsets, |
| u64 tsc) |
| { |
| - const struct lib_ring_buffer_config *config = chan->backend.config; |
| + const struct lib_ring_buffer_config *config = &chan->backend.config; |
| unsigned long beginidx = subbuf_index(offsets->begin, chan); |
| unsigned long commit_count; |
| |
| @@ -1334,7 +1354,7 @@ void lib_ring_buffer_switch_new_end(stru |
| struct switch_offsets *offsets, |
| u64 tsc) |
| { |
| - const struct lib_ring_buffer_config *config = chan->backend.config; |
| + const struct lib_ring_buffer_config *config = &chan->backend.config; |
| unsigned long endidx = subbuf_index(offsets->end - 1, chan); |
| unsigned long commit_count, padding_size, data_size; |
| |
| @@ -1376,7 +1396,7 @@ int lib_ring_buffer_try_switch_slow(enum |
| struct switch_offsets *offsets, |
| u64 *tsc) |
| { |
| - const struct lib_ring_buffer_config *config = chan->backend.config; |
| + const struct lib_ring_buffer_config *config = &chan->backend.config; |
| unsigned long off; |
| |
| offsets->begin = v_read(config, &buf->offset); |
| @@ -1435,7 +1455,7 @@ int lib_ring_buffer_try_switch_slow(enum |
| void lib_ring_buffer_switch_slow(struct lib_ring_buffer *buf, enum switch_mode mode) |
| { |
| struct channel *chan = buf->backend.chan; |
| - const struct lib_ring_buffer_config *config = chan->backend.config; |
| + const struct lib_ring_buffer_config *config = &chan->backend.config; |
| struct switch_offsets offsets; |
| unsigned long oldidx; |
| u64 tsc; |
| @@ -1496,7 +1516,7 @@ int lib_ring_buffer_try_reserve_slow(str |
| struct switch_offsets *offsets, |
| struct lib_ring_buffer_ctx *ctx) |
| { |
| - const struct lib_ring_buffer_config *config = chan->backend.config; |
| + const struct lib_ring_buffer_config *config = &chan->backend.config; |
| unsigned long reserve_commit_diff; |
| |
| offsets->begin = v_read(config, &buf->offset); |
| @@ -1631,7 +1651,7 @@ int lib_ring_buffer_try_reserve_slow(str |
| int lib_ring_buffer_reserve_slow(struct lib_ring_buffer_ctx *ctx) |
| { |
| struct channel *chan = ctx->chan; |
| - const struct lib_ring_buffer_config *config = chan->backend.config; |
| + const struct lib_ring_buffer_config *config = &chan->backend.config; |
| struct lib_ring_buffer *buf; |
| struct switch_offsets offsets; |
| int ret; |
| --- a/drivers/staging/lttng/lib/ringbuffer/ring_buffer_iterator.c |
| +++ b/drivers/staging/lttng/lib/ringbuffer/ring_buffer_iterator.c |
| @@ -1,16 +1,28 @@ |
| /* |
| * ring_buffer_iterator.c |
| * |
| - * (C) Copyright 2010 - Mathieu Desnoyers <mathieu.desnoyers@efficios.com> |
| - * |
| * Ring buffer and channel iterators. Get each event of a channel in order. Uses |
| * a prio heap for per-cpu buffers, giving a O(log(NR_CPUS)) algorithmic |
| * complexity for the "get next event" operation. |
| * |
| + * Copyright (C) 2010-2012 Mathieu Desnoyers <mathieu.desnoyers@efficios.com> |
| + * |
| + * This library is free software; you can redistribute it and/or |
| + * modify it under the terms of the GNU Lesser General Public |
| + * License as published by the Free Software Foundation; only |
| + * version 2.1 of the License. |
| + * |
| + * This library is distributed in the hope that it will be useful, |
| + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| + * Lesser General Public License for more details. |
| + * |
| + * You should have received a copy of the GNU Lesser General Public |
| + * License along with this library; if not, write to the Free Software |
| + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| + * |
| * Author: |
| * Mathieu Desnoyers <mathieu.desnoyers@efficios.com> |
| - * |
| - * Dual LGPL v2.1/GPL v2 license. |
| */ |
| |
| #include "../../wrapper/ringbuffer/iterator.h" |
| @@ -40,7 +52,7 @@ |
| ssize_t lib_ring_buffer_get_next_record(struct channel *chan, |
| struct lib_ring_buffer *buf) |
| { |
| - const struct lib_ring_buffer_config *config = chan->backend.config; |
| + const struct lib_ring_buffer_config *config = &chan->backend.config; |
| struct lib_ring_buffer_iter *iter = &buf->iter; |
| int ret; |
| |
| @@ -225,7 +237,7 @@ void lib_ring_buffer_wait_for_qs(const s |
| ssize_t channel_get_next_record(struct channel *chan, |
| struct lib_ring_buffer **ret_buf) |
| { |
| - const struct lib_ring_buffer_config *config = chan->backend.config; |
| + const struct lib_ring_buffer_config *config = &chan->backend.config; |
| struct lib_ring_buffer *buf; |
| struct lttng_ptr_heap *heap; |
| ssize_t len; |
| @@ -333,7 +345,7 @@ void lib_ring_buffer_iterator_init(struc |
| } |
| |
| /* Add to list of buffers without any current record */ |
| - if (chan->backend.config->alloc == RING_BUFFER_ALLOC_PER_CPU) |
| + if (chan->backend.config.alloc == RING_BUFFER_ALLOC_PER_CPU) |
| list_add(&buf->iter.empty_node, &chan->iter.empty_head); |
| } |
| |
| @@ -347,7 +359,7 @@ int __cpuinit channel_iterator_cpu_hotpl |
| struct channel *chan = container_of(nb, struct channel, |
| hp_iter_notifier); |
| struct lib_ring_buffer *buf = per_cpu_ptr(chan->backend.buf, cpu); |
| - const struct lib_ring_buffer_config *config = chan->backend.config; |
| + const struct lib_ring_buffer_config *config = &chan->backend.config; |
| |
| if (!chan->hp_iter_enable) |
| return NOTIFY_DONE; |
| @@ -369,7 +381,7 @@ int __cpuinit channel_iterator_cpu_hotpl |
| |
| int channel_iterator_init(struct channel *chan) |
| { |
| - const struct lib_ring_buffer_config *config = chan->backend.config; |
| + const struct lib_ring_buffer_config *config = &chan->backend.config; |
| struct lib_ring_buffer *buf; |
| |
| if (config->alloc == RING_BUFFER_ALLOC_PER_CPU) { |
| @@ -413,7 +425,7 @@ int channel_iterator_init(struct channel |
| |
| void channel_iterator_unregister_notifiers(struct channel *chan) |
| { |
| - const struct lib_ring_buffer_config *config = chan->backend.config; |
| + const struct lib_ring_buffer_config *config = &chan->backend.config; |
| |
| if (config->alloc == RING_BUFFER_ALLOC_PER_CPU) { |
| chan->hp_iter_enable = 0; |
| @@ -423,7 +435,7 @@ void channel_iterator_unregister_notifie |
| |
| void channel_iterator_free(struct channel *chan) |
| { |
| - const struct lib_ring_buffer_config *config = chan->backend.config; |
| + const struct lib_ring_buffer_config *config = &chan->backend.config; |
| |
| if (config->alloc == RING_BUFFER_ALLOC_PER_CPU) |
| lttng_heap_free(&chan->iter.heap); |
| @@ -432,7 +444,7 @@ void channel_iterator_free(struct channe |
| int lib_ring_buffer_iterator_open(struct lib_ring_buffer *buf) |
| { |
| struct channel *chan = buf->backend.chan; |
| - const struct lib_ring_buffer_config *config = chan->backend.config; |
| + const struct lib_ring_buffer_config *config = &chan->backend.config; |
| CHAN_WARN_ON(chan, config->output != RING_BUFFER_ITERATOR); |
| return lib_ring_buffer_open_read(buf); |
| } |
| @@ -451,7 +463,7 @@ EXPORT_SYMBOL_GPL(lib_ring_buffer_iterat |
| |
| int channel_iterator_open(struct channel *chan) |
| { |
| - const struct lib_ring_buffer_config *config = chan->backend.config; |
| + const struct lib_ring_buffer_config *config = &chan->backend.config; |
| struct lib_ring_buffer *buf; |
| int ret = 0, cpu; |
| |
| @@ -484,7 +496,7 @@ EXPORT_SYMBOL_GPL(channel_iterator_open) |
| |
| void channel_iterator_release(struct channel *chan) |
| { |
| - const struct lib_ring_buffer_config *config = chan->backend.config; |
| + const struct lib_ring_buffer_config *config = &chan->backend.config; |
| struct lib_ring_buffer *buf; |
| int cpu; |
| |
| @@ -527,7 +539,7 @@ void lib_ring_buffer_iterator_reset(stru |
| |
| void channel_iterator_reset(struct channel *chan) |
| { |
| - const struct lib_ring_buffer_config *config = chan->backend.config; |
| + const struct lib_ring_buffer_config *config = &chan->backend.config; |
| struct lib_ring_buffer *buf; |
| int cpu; |
| |
| @@ -558,7 +570,7 @@ ssize_t channel_ring_buffer_file_read(st |
| struct lib_ring_buffer *buf, |
| int fusionmerge) |
| { |
|