Mirror of the lttng-dev mailing list
 help / color / mirror / Atom feed
* [lttng-dev] LTTng wrapper cleanup
@ 2011-11-30 18:34 Mathieu Desnoyers
  2011-11-30 18:34 ` [lttng-dev] [PATCH 01/15] lttng lib: ring buffer: remove stale null-pointer Mathieu Desnoyers
                   ` (15 more replies)
  0 siblings, 16 replies; 18+ messages in thread
From: Mathieu Desnoyers @ 2011-11-30 18:34 UTC (permalink / raw)



Hi Greg,

Here is the cleanup of the LTTng wrappers that used kallsyms to lookup
some kernel symbols. I introduce the missing symbols in the mainline
kernel, trying to follow the local exports already in place when it
comes to choosing between EXPORT_SYMBOL and EXPORT_SYMBOL_GPL. I also
removed wrappers that deal with API changes across kernel versions (for
older kernels). Only few wrapper files are left at this point (TODO),
but those are less repulsive than those that used kallsyms:

- inline_memcpy.h: ensures that inline_memcpy is declared on all
  architectures.
- poll.h: see TODO file, "Features" section.
- trace-clock.h: see TODO file, "Features" section.
- ringbuffer: those are internal to the driver. They were there to make
  it easier to switch between the ringbuffer deployed in my own kernel
  tree and the module-specific ringbuffer.

The 3 first patches are small cleanups recommended to me by a static
checker.

Diffstat:

 b/drivers/staging/lttng/lib/ringbuffer/ring_buffer_frontend.c |    6 
 b/drivers/staging/lttng/lib/ringbuffer/ring_buffer_mmap.c     |    3 
 drivers/staging/lttng/lib/ringbuffer/ring_buffer_mmap.c       |    3 
 b/drivers/staging/lttng/lib/ringbuffer/ring_buffer_vfs.c      |    3 
 b/mm/nommu.c                                                  |    1 
 b/mm/vmalloc.c                                                |    1 
 b/drivers/staging/lttng/wrapper/kallsyms.h                    |    2 
 b/drivers/staging/lttng/lib/ringbuffer/ring_buffer_backend.c  |    3 
 b/drivers/staging/lttng/ltt-context.c                         |    1 
 b/drivers/staging/lttng/ltt-debugfs-abi.c                     |    3 
 b/drivers/staging/lttng/ltt-events.c                          |    3 
 b/drivers/staging/lttng/ltt-ring-buffer-client.h              |    3 
 b/drivers/staging/lttng/ltt-ring-buffer-metadata-client.h     |    3 
 b/drivers/staging/lttng/lttng-context-nice.c                  |    3 
 b/drivers/staging/lttng/lttng-context-perf-counters.c         |    3 
 b/drivers/staging/lttng/lttng-context-pid.c                   |    3 
 b/drivers/staging/lttng/lttng-context-ppid.c                  |    3 
 b/drivers/staging/lttng/lttng-context-prio.c                  |    3 
 b/drivers/staging/lttng/lttng-context-procname.c              |    3 
 b/drivers/staging/lttng/lttng-context-tid.c                   |    3 
 b/drivers/staging/lttng/lttng-context-vpid.c                  |    3 
 b/drivers/staging/lttng/lttng-context-vppid.c                 |    3 
 b/drivers/staging/lttng/lttng-context-vtid.c                  |    3 
 b/drivers/staging/lttng/lttng-syscalls.c                      |    2 
 b/drivers/staging/lttng/probes/lttng-events.h                 |    3 
 b/drivers/staging/lttng/probes/lttng-ftrace.c                 |    5 
 b/drivers/staging/lttng/probes/lttng-kprobes.c                |    3 
 b/drivers/staging/lttng/probes/lttng-kretprobes.c             |    3 
 b/drivers/staging/lttng/probes/lttng-types.c                  |    3 
 drivers/staging/lttng/wrapper/vmalloc.h                       |   49 --
 b/fs/splice.c                                                 |    1 
 b/drivers/staging/lttng/lib/Makefile                          |    3 
 b/drivers/staging/lttng/lib/ringbuffer/ring_buffer_splice.c   |    3 
 drivers/staging/lttng/wrapper/splice.c                        |   46 --
 drivers/staging/lttng/wrapper/splice.h                        |   23 -
 drivers/staging/lttng/lttng-context-perf-counters.c           |    9 
 drivers/staging/lttng/wrapper/perf.h                          |   32 -
 b/drivers/staging/lttng/README                                |    4 
 drivers/staging/lttng/ltt-events.c                            |   11 
 b/drivers/staging/lttng/probes/Makefile                       |    4 
 a/drivers/staging/lttng/probes/lttng-ftrace.c                 |  187 ----------
 drivers/staging/lttng/wrapper/ftrace.h                        |   70 ---
 b/drivers/staging/lttng/lib/ringbuffer/frontend_types.h       |    1 
 drivers/staging/lttng/wrapper/spinlock.h                      |   26 -
 b/drivers/staging/lttng/ltt-events.h                          |    3 
 drivers/staging/lttng/wrapper/uuid.h                          |   29 -
 b/kernel/sched.c                                              |    1 
 drivers/staging/lttng/lttng-context-prio.c                    |   23 -
 a/drivers/staging/lttng/wrapper/kallsyms.h                    |   30 -
 49 files changed, 44 insertions(+), 595 deletions(-)

Thanks,

Mathieu



^ permalink raw reply	[flat|nested] 18+ messages in thread

* [lttng-dev] [PATCH 01/15] lttng lib: ring buffer: remove stale null-pointer
  2011-11-30 18:34 [lttng-dev] LTTng wrapper cleanup Mathieu Desnoyers
@ 2011-11-30 18:34 ` Mathieu Desnoyers
  2011-11-30 18:34 ` [lttng-dev] [PATCH 02/15] lttng lib: ring buffer remove duplicate null pointer Mathieu Desnoyers
                   ` (14 subsequent siblings)
  15 siblings, 0 replies; 18+ messages in thread
From: Mathieu Desnoyers @ 2011-11-30 18:34 UTC (permalink / raw)


* Dan Carpenter <dan.carpenter at oracle.com> wrote:
[...]
> The patch c844b2f5cfea: "lttng lib: ring buffer" from Nov 28, 2011,
> leads to the following Smatch complaint:
>
> drivers/staging/lttng/lib/ringbuffer/ring_buffer_frontend.c +1150
> +lib_ring_buffer_print_buffer_errors()
>          warn: variable dereferenced before check 'chan' (see line 1143)
>
> drivers/staging/lttng/lib/ringbuffer/ring_buffer_frontend.c
>   1142  {
>   1143          const struct lib_ring_buffer_config *config =
> +chan->backend.config;
>
> +^^^^^^^^^^^^^^^^^^^^
> Dereference.
>
>   1144          unsigned long write_offset, cons_offset;
>   1145
>   1146          /*
>   1147           * Can be called in the error path of allocation when
>   1148           * trans_channel_data is not yet set.
>   1149           */
>   1150          if (!chan)
>                 ^^^^^^^^^
> Check.  At first glance the comment seems out of date, I think check can
> be removed safely.
>
>   1151                  return;
>   1152          /*

Reported-by: Dan Carpenter <dan.carpenter at oracle.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers at efficios.com>
---
 .../lttng/lib/ringbuffer/ring_buffer_frontend.c    |    6 ------
 1 files changed, 0 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/lttng/lib/ringbuffer/ring_buffer_frontend.c b/drivers/staging/lttng/lib/ringbuffer/ring_buffer_frontend.c
index 802f5cd..957d7f3 100644
--- a/drivers/staging/lttng/lib/ringbuffer/ring_buffer_frontend.c
+++ b/drivers/staging/lttng/lib/ringbuffer/ring_buffer_frontend.c
@@ -1144,12 +1144,6 @@ void lib_ring_buffer_print_buffer_errors(struct lib_ring_buffer *buf,
 	unsigned long write_offset, cons_offset;
 
 	/*
-	 * Can be called in the error path of allocation when
-	 * trans_channel_data is not yet set.
-	 */
-	if (!chan)
-		return;
-	/*
 	 * No need to order commit_count, write_offset and cons_offset reads
 	 * because we execute at teardown when no more writer nor reader
 	 * references are left.
-- 
1.7.5.4




^ permalink raw reply	[flat|nested] 18+ messages in thread

* [lttng-dev] [PATCH 02/15] lttng lib: ring buffer remove duplicate null pointer
  2011-11-30 18:34 [lttng-dev] LTTng wrapper cleanup Mathieu Desnoyers
  2011-11-30 18:34 ` [lttng-dev] [PATCH 01/15] lttng lib: ring buffer: remove stale null-pointer Mathieu Desnoyers
@ 2011-11-30 18:34 ` Mathieu Desnoyers
  2011-11-30 18:34 ` [lttng-dev] [PATCH 03/15] lttng lib: ring buffer move null pointer check to open Mathieu Desnoyers
                   ` (13 subsequent siblings)
  15 siblings, 0 replies; 18+ messages in thread
From: Mathieu Desnoyers @ 2011-11-30 18:34 UTC (permalink / raw)


* Dan Carpenter <dan.carpenter at oracle.com> wrote:
> The patch c844b2f5cfea: "lttng lib: ring buffer" from Nov 28, 2011,
> leads to the following Smatch complaint:
>
> drivers/staging/lttng/lib/ringbuffer/ring_buffer_mmap.c +33
> +lib_ring_buffer_fault()
>          warn: variable dereferenced before check 'buf' (see line 26)
>
> drivers/staging/lttng/lib/ringbuffer/ring_buffer_mmap.c
>     25          struct lib_ring_buffer *buf = vma->vm_private_data;
>     26          struct channel *chan = buf->backend.chan;
>                                        ^^^^^^^^^^^^^^^^^
> Dereference.
>
>     27          const struct lib_ring_buffer_config *config = chan->backend.config;
>     28          pgoff_t pgoff = vmf->pgoff;
>     29          struct page **page;
>     30          void **virt;
>     31          unsigned long offset, sb_bindex;
>     32
>     33          if (!buf)
>                     ^^^^
> Check.
>
>     34                  return VM_FAULT_OOM;
>     35

This check is performed at mapping setup time in
lib_ring_buffer_mmap_buf() already, so we can safely remove this
duplicata.

Reported-by: Dan Carpenter <dan.carpenter at oracle.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers at efficios.com>
---
 .../lttng/lib/ringbuffer/ring_buffer_mmap.c        |    3 ---
 1 files changed, 0 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/lttng/lib/ringbuffer/ring_buffer_mmap.c b/drivers/staging/lttng/lib/ringbuffer/ring_buffer_mmap.c
index 68221ee..cf37434 100644
--- a/drivers/staging/lttng/lib/ringbuffer/ring_buffer_mmap.c
+++ b/drivers/staging/lttng/lib/ringbuffer/ring_buffer_mmap.c
@@ -30,9 +30,6 @@ static int lib_ring_buffer_fault(struct vm_area_struct *vma, struct vm_fault *vm
 	void **virt;
 	unsigned long offset, sb_bindex;
 
-	if (!buf)
-		return VM_FAULT_OOM;
-
 	/*
 	 * Verify that faults are only done on the range of pages owned by the
 	 * reader.
-- 
1.7.5.4




^ permalink raw reply	[flat|nested] 18+ messages in thread

* [lttng-dev] [PATCH 03/15] lttng lib: ring buffer move null pointer check to open
  2011-11-30 18:34 [lttng-dev] LTTng wrapper cleanup Mathieu Desnoyers
  2011-11-30 18:34 ` [lttng-dev] [PATCH 01/15] lttng lib: ring buffer: remove stale null-pointer Mathieu Desnoyers
  2011-11-30 18:34 ` [lttng-dev] [PATCH 02/15] lttng lib: ring buffer remove duplicate null pointer Mathieu Desnoyers
@ 2011-11-30 18:34 ` Mathieu Desnoyers
  2011-11-30 18:34 ` [lttng-dev] [PATCH 04/15] Export vmalloc_sync_all symbol to GPL modules Mathieu Desnoyers
                   ` (12 subsequent siblings)
  15 siblings, 0 replies; 18+ messages in thread
From: Mathieu Desnoyers @ 2011-11-30 18:34 UTC (permalink / raw)


* Dan Carpenter <dan.carpenter at oracle.com> wrote:
> The patch c844b2f5cfea: "lttng lib: ring buffer" from Nov 28, 2011,
> leads to the following Smatch complaint:
>
> drivers/staging/lttng/lib/ringbuffer/ring_buffer_mmap.c +86
> +lib_ring_buffer_mmap_buf()
>          warn: variable dereferenced before check 'buf' (see line 79)
>
> drivers/staging/lttng/lib/ringbuffer/ring_buffer_mmap.c
>     78          unsigned long length = vma->vm_end - vma->vm_start;
>     79          struct channel *chan = buf->backend.chan;
>                                        ^^^^^^^^^^^^^^^^^
> Dereference.
>
>     80          const struct lib_ring_buffer_config *config = chan->backend.config;
>     81          unsigned long mmap_buf_len;
>     82
>     83          if (config->output != RING_BUFFER_MMAP)
>     84                  return -EINVAL;
>     85
>     86          if (!buf)
>                     ^^^^
> Check.
>
>     87                  return -EBADF;
>     88

Let's move the NULL buf check to the file "open", where it belongs. The
"open" file operation is the actual interface between lib ring buffer
and the modules using it.

Reported-by: Dan Carpenter <dan.carpenter at oracle.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers at efficios.com>
---
 .../lttng/lib/ringbuffer/ring_buffer_mmap.c        |    3 ---
 .../staging/lttng/lib/ringbuffer/ring_buffer_vfs.c |    3 +++
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/lttng/lib/ringbuffer/ring_buffer_mmap.c b/drivers/staging/lttng/lib/ringbuffer/ring_buffer_mmap.c
index cf37434..c9d6e89 100644
--- a/drivers/staging/lttng/lib/ringbuffer/ring_buffer_mmap.c
+++ b/drivers/staging/lttng/lib/ringbuffer/ring_buffer_mmap.c
@@ -80,9 +80,6 @@ static int lib_ring_buffer_mmap_buf(struct lib_ring_buffer *buf,
 	if (config->output != RING_BUFFER_MMAP)
 		return -EINVAL;
 
-	if (!buf)
-		return -EBADF;
-
 	mmap_buf_len = chan->backend.buf_size;
 	if (chan->backend.extra_reader_sb)
 		mmap_buf_len += chan->backend.subbuf_size;
diff --git a/drivers/staging/lttng/lib/ringbuffer/ring_buffer_vfs.c b/drivers/staging/lttng/lib/ringbuffer/ring_buffer_vfs.c
index 1708ffd..8b78305 100644
--- a/drivers/staging/lttng/lib/ringbuffer/ring_buffer_vfs.c
+++ b/drivers/staging/lttng/lib/ringbuffer/ring_buffer_vfs.c
@@ -42,6 +42,9 @@ int lib_ring_buffer_open(struct inode *inode, struct file *file)
 	struct lib_ring_buffer *buf = inode->i_private;
 	int ret;
 
+	if (!buf)
+		return -EINVAL;
+
 	ret = lib_ring_buffer_open_read(buf);
 	if (ret)
 		return ret;
-- 
1.7.5.4




^ permalink raw reply	[flat|nested] 18+ messages in thread

* [lttng-dev] [PATCH 04/15] Export vmalloc_sync_all symbol to GPL modules
  2011-11-30 18:34 [lttng-dev] LTTng wrapper cleanup Mathieu Desnoyers
                   ` (2 preceding siblings ...)
  2011-11-30 18:34 ` [lttng-dev] [PATCH 03/15] lttng lib: ring buffer move null pointer check to open Mathieu Desnoyers
@ 2011-11-30 18:34 ` Mathieu Desnoyers
  2011-11-30 18:34 ` [lttng-dev] [PATCH 05/15] lttng wrapper: add missing include to kallsyms wrapper Mathieu Desnoyers
                   ` (11 subsequent siblings)
  15 siblings, 0 replies; 18+ messages in thread
From: Mathieu Desnoyers @ 2011-11-30 18:34 UTC (permalink / raw)


LTTng needs this symbol exported. It calls it to ensure its tracing
buffers and allocated data structures never trigger a page fault. This
is required to handle page fault handler tracing and NMI tracing
gracefully.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers at efficios.com>
---
 mm/nommu.c   |    1 +
 mm/vmalloc.c |    1 +
 2 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/mm/nommu.c b/mm/nommu.c
index b982290..b22a0d9 100644
--- a/mm/nommu.c
+++ b/mm/nommu.c
@@ -441,6 +441,7 @@ EXPORT_SYMBOL_GPL(vm_unmap_aliases);
 void  __attribute__((weak)) vmalloc_sync_all(void)
 {
 }
+EXPORT_SYMBOL_GPL(vmalloc_sync_all);
 
 /**
  *	alloc_vm_area - allocate a range of kernel address space
diff --git a/mm/vmalloc.c b/mm/vmalloc.c
index 3231bf3..37ddce5 100644
--- a/mm/vmalloc.c
+++ b/mm/vmalloc.c
@@ -2137,6 +2137,7 @@ EXPORT_SYMBOL(remap_vmalloc_range);
 void  __attribute__((weak)) vmalloc_sync_all(void)
 {
 }
+EXPORT_SYMBOL_GPL(vmalloc_sync_all);
 
 
 static int f(pte_t *pte, pgtable_t table, unsigned long addr, void *data)
-- 
1.7.5.4




^ permalink raw reply	[flat|nested] 18+ messages in thread

* [lttng-dev] [PATCH 05/15] lttng wrapper: add missing include to kallsyms wrapper
  2011-11-30 18:34 [lttng-dev] LTTng wrapper cleanup Mathieu Desnoyers
                   ` (3 preceding siblings ...)
  2011-11-30 18:34 ` [lttng-dev] [PATCH 04/15] Export vmalloc_sync_all symbol to GPL modules Mathieu Desnoyers
@ 2011-11-30 18:34 ` Mathieu Desnoyers
  2011-11-30 18:34 ` [lttng-dev] [PATCH 06/15] Remove LTTng vmalloc_sync_all wrapper Mathieu Desnoyers
                   ` (10 subsequent siblings)
  15 siblings, 0 replies; 18+ messages in thread
From: Mathieu Desnoyers @ 2011-11-30 18:34 UTC (permalink / raw)


Needed to keep bissectability.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers at efficios.com>
---
 drivers/staging/lttng/wrapper/kallsyms.h |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/drivers/staging/lttng/wrapper/kallsyms.h b/drivers/staging/lttng/wrapper/kallsyms.h
index bb45f38..a7b8ab1 100644
--- a/drivers/staging/lttng/wrapper/kallsyms.h
+++ b/drivers/staging/lttng/wrapper/kallsyms.h
@@ -1,6 +1,8 @@
 #ifndef _LTT_WRAPPER_KALLSYMS_H
 #define _LTT_WRAPPER_KALLSYMS_H
 
+#include <linux/kallsyms.h>
+
 /*
  * Copyright (C) 2011 Avik Sil (avik.sil at linaro.org)
  *
-- 
1.7.5.4




^ permalink raw reply	[flat|nested] 18+ messages in thread

* [lttng-dev] [PATCH 06/15] Remove LTTng vmalloc_sync_all wrapper
  2011-11-30 18:34 [lttng-dev] LTTng wrapper cleanup Mathieu Desnoyers
                   ` (4 preceding siblings ...)
  2011-11-30 18:34 ` [lttng-dev] [PATCH 05/15] lttng wrapper: add missing include to kallsyms wrapper Mathieu Desnoyers
@ 2011-11-30 18:34 ` Mathieu Desnoyers
  2011-11-30 18:34 ` [lttng-dev] [PATCH 07/15] fs/splice: export splice_to_pipe to modules Mathieu Desnoyers
                   ` (9 subsequent siblings)
  15 siblings, 0 replies; 18+ messages in thread
From: Mathieu Desnoyers @ 2011-11-30 18:34 UTC (permalink / raw)


Use the newly exported vmalloc_sync_all symbol.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers at efficios.com>
---
 .../lttng/lib/ringbuffer/ring_buffer_backend.c     |    3 +-
 drivers/staging/lttng/ltt-context.c                |    1 -
 drivers/staging/lttng/ltt-debugfs-abi.c            |    3 +-
 drivers/staging/lttng/ltt-events.c                 |    3 +-
 drivers/staging/lttng/ltt-ring-buffer-client.h     |    3 +-
 .../lttng/ltt-ring-buffer-metadata-client.h        |    3 +-
 drivers/staging/lttng/lttng-context-nice.c         |    3 +-
 .../staging/lttng/lttng-context-perf-counters.c    |    3 +-
 drivers/staging/lttng/lttng-context-pid.c          |    3 +-
 drivers/staging/lttng/lttng-context-ppid.c         |    3 +-
 drivers/staging/lttng/lttng-context-prio.c         |    3 +-
 drivers/staging/lttng/lttng-context-procname.c     |    3 +-
 drivers/staging/lttng/lttng-context-tid.c          |    3 +-
 drivers/staging/lttng/lttng-context-vpid.c         |    3 +-
 drivers/staging/lttng/lttng-context-vppid.c        |    3 +-
 drivers/staging/lttng/lttng-context-vtid.c         |    3 +-
 drivers/staging/lttng/lttng-syscalls.c             |    2 +-
 drivers/staging/lttng/probes/lttng-events.h        |    3 +-
 drivers/staging/lttng/probes/lttng-ftrace.c        |    5 +-
 drivers/staging/lttng/probes/lttng-kprobes.c       |    3 +-
 drivers/staging/lttng/probes/lttng-kretprobes.c    |    3 +-
 drivers/staging/lttng/probes/lttng-types.c         |    3 +-
 drivers/staging/lttng/wrapper/vmalloc.h            |   49 --------------------
 23 files changed, 22 insertions(+), 92 deletions(-)
 delete mode 100644 drivers/staging/lttng/wrapper/vmalloc.h

diff --git a/drivers/staging/lttng/lib/ringbuffer/ring_buffer_backend.c b/drivers/staging/lttng/lib/ringbuffer/ring_buffer_backend.c
index d1b5b8c..a406f12 100644
--- a/drivers/staging/lttng/lib/ringbuffer/ring_buffer_backend.c
+++ b/drivers/staging/lttng/lib/ringbuffer/ring_buffer_backend.c
@@ -16,7 +16,6 @@
 #include <linux/cpu.h>
 #include <linux/mm.h>
 
-#include "../../wrapper/vmalloc.h"	/* for wrapper_vmalloc_sync_all() */
 #include "../../wrapper/ringbuffer/config.h"
 #include "../../wrapper/ringbuffer/backend.h"
 #include "../../wrapper/ringbuffer/frontend.h"
@@ -131,7 +130,7 @@ int lib_ring_buffer_backend_allocate(const struct lib_ring_buffer_config *config
 	 * If kmalloc ever uses vmalloc underneath, make sure the buffer pages
 	 * will not fault.
 	 */
-	wrapper_vmalloc_sync_all();
+	vmalloc_sync_all();
 	kfree(virt);
 	kfree(pages);
 	return 0;
diff --git a/drivers/staging/lttng/ltt-context.c b/drivers/staging/lttng/ltt-context.c
index 60ea525..1773b8c 100644
--- a/drivers/staging/lttng/ltt-context.c
+++ b/drivers/staging/lttng/ltt-context.c
@@ -12,7 +12,6 @@
 #include <linux/list.h>
 #include <linux/mutex.h>
 #include <linux/slab.h>
-#include "wrapper/vmalloc.h"	/* for wrapper_vmalloc_sync_all() */
 #include "ltt-events.h"
 #include "ltt-tracer.h"
 
diff --git a/drivers/staging/lttng/ltt-debugfs-abi.c b/drivers/staging/lttng/ltt-debugfs-abi.c
index 37cccfa..97ef3a6 100644
--- a/drivers/staging/lttng/ltt-debugfs-abi.c
+++ b/drivers/staging/lttng/ltt-debugfs-abi.c
@@ -31,7 +31,6 @@
 #include <linux/file.h>
 #include <linux/uaccess.h>
 #include <linux/slab.h>
-#include "wrapper/vmalloc.h"	/* for wrapper_vmalloc_sync_all() */
 #include "wrapper/ringbuffer/vfs.h"
 #include "wrapper/poll.h"
 #include "ltt-debugfs-abi.h"
@@ -750,7 +749,7 @@ int __init ltt_debugfs_abi_init(void)
 {
 	int ret = 0;
 
-	wrapper_vmalloc_sync_all();
+	vmalloc_sync_all();
 	lttng_dentry = debugfs_create_file("lttng", S_IWUSR, NULL, NULL,
 					&lttng_fops);
 	if (IS_ERR(lttng_dentry))
diff --git a/drivers/staging/lttng/ltt-events.c b/drivers/staging/lttng/ltt-events.c
index 4229914..f7438c5 100644
--- a/drivers/staging/lttng/ltt-events.c
+++ b/drivers/staging/lttng/ltt-events.c
@@ -15,7 +15,6 @@
 #include <linux/slab.h>
 #include <linux/jiffies.h>
 #include "wrapper/uuid.h"
-#include "wrapper/vmalloc.h"	/* for wrapper_vmalloc_sync_all() */
 #include "ltt-events.h"
 #include "ltt-tracer.h"
 
@@ -954,7 +953,7 @@ void ltt_transport_register(struct ltt_transport *transport)
 	 * registered. We deal with this here so we don't have to call
 	 * vmalloc_sync_all() in each module's init.
 	 */
-	wrapper_vmalloc_sync_all();
+	vmalloc_sync_all();
 
 	mutex_lock(&sessions_mutex);
 	list_add_tail(&transport->node, &ltt_transport_list);
diff --git a/drivers/staging/lttng/ltt-ring-buffer-client.h b/drivers/staging/lttng/ltt-ring-buffer-client.h
index 8df3790..a35dfbb 100644
--- a/drivers/staging/lttng/ltt-ring-buffer-client.h
+++ b/drivers/staging/lttng/ltt-ring-buffer-client.h
@@ -11,7 +11,6 @@
 #include <linux/module.h>
 #include <linux/types.h>
 #include "lib/bitfield.h"
-#include "wrapper/vmalloc.h"	/* for wrapper_vmalloc_sync_all() */
 #include "wrapper/trace-clock.h"
 #include "ltt-events.h"
 #include "ltt-tracer.h"
@@ -549,7 +548,7 @@ static int __init ltt_ring_buffer_client_init(void)
 	 * This vmalloc sync all also takes care of the lib ring buffer
 	 * vmalloc'd module pages when it is built as a module into LTTng.
 	 */
-	wrapper_vmalloc_sync_all();
+	vmalloc_sync_all();
 	ltt_transport_register(&ltt_relay_transport);
 	return 0;
 }
diff --git a/drivers/staging/lttng/ltt-ring-buffer-metadata-client.h b/drivers/staging/lttng/ltt-ring-buffer-metadata-client.h
index 529bbb1..b859358 100644
--- a/drivers/staging/lttng/ltt-ring-buffer-metadata-client.h
+++ b/drivers/staging/lttng/ltt-ring-buffer-metadata-client.h
@@ -10,7 +10,6 @@
 
 #include <linux/module.h>
 #include <linux/types.h>
-#include "wrapper/vmalloc.h"	/* for wrapper_vmalloc_sync_all() */
 #include "ltt-events.h"
 #include "ltt-tracer.h"
 
@@ -310,7 +309,7 @@ static int __init ltt_ring_buffer_client_init(void)
 	 * This vmalloc sync all also takes care of the lib ring buffer
 	 * vmalloc'd module pages when it is built as a module into LTTng.
 	 */
-	wrapper_vmalloc_sync_all();
+	vmalloc_sync_all();
 	ltt_transport_register(&ltt_relay_transport);
 	return 0;
 }
diff --git a/drivers/staging/lttng/lttng-context-nice.c b/drivers/staging/lttng/lttng-context-nice.c
index 9b99b54..d238185 100644
--- a/drivers/staging/lttng/lttng-context-nice.c
+++ b/drivers/staging/lttng/lttng-context-nice.c
@@ -12,7 +12,6 @@
 #include <linux/sched.h>
 #include "ltt-events.h"
 #include "wrapper/ringbuffer/frontend_types.h"
-#include "wrapper/vmalloc.h"
 #include "ltt-tracer.h"
 
 static
@@ -58,7 +57,7 @@ int lttng_add_nice_to_ctx(struct lttng_ctx **ctx)
 	field->event_field.type.u.basic.integer.encoding = lttng_encode_none;
 	field->get_size = nice_get_size;
 	field->record = nice_record;
-	wrapper_vmalloc_sync_all();
+	vmalloc_sync_all();
 	return 0;
 }
 EXPORT_SYMBOL_GPL(lttng_add_nice_to_ctx);
diff --git a/drivers/staging/lttng/lttng-context-perf-counters.c b/drivers/staging/lttng/lttng-context-perf-counters.c
index 3ae2266..9910066 100644
--- a/drivers/staging/lttng/lttng-context-perf-counters.c
+++ b/drivers/staging/lttng/lttng-context-perf-counters.c
@@ -14,7 +14,6 @@
 #include <linux/string.h>
 #include "ltt-events.h"
 #include "wrapper/ringbuffer/frontend_types.h"
-#include "wrapper/vmalloc.h"
 #include "wrapper/perf.h"
 #include "ltt-tracer.h"
 
@@ -240,7 +239,7 @@ int lttng_add_perf_counter_to_ctx(uint32_t type,
 	field->u.perf_counter = perf_field;
 	perf_field->hp_enable = 1;
 
-	wrapper_vmalloc_sync_all();
+	vmalloc_sync_all();
 	return 0;
 
 counter_busy:
diff --git a/drivers/staging/lttng/lttng-context-pid.c b/drivers/staging/lttng/lttng-context-pid.c
index 698b242..0cd3900 100644
--- a/drivers/staging/lttng/lttng-context-pid.c
+++ b/drivers/staging/lttng/lttng-context-pid.c
@@ -12,7 +12,6 @@
 #include <linux/sched.h>
 #include "ltt-events.h"
 #include "wrapper/ringbuffer/frontend_types.h"
-#include "wrapper/vmalloc.h"
 #include "ltt-tracer.h"
 
 static
@@ -58,7 +57,7 @@ int lttng_add_pid_to_ctx(struct lttng_ctx **ctx)
 	field->event_field.type.u.basic.integer.encoding = lttng_encode_none;
 	field->get_size = pid_get_size;
 	field->record = pid_record;
-	wrapper_vmalloc_sync_all();
+	vmalloc_sync_all();
 	return 0;
 }
 EXPORT_SYMBOL_GPL(lttng_add_pid_to_ctx);
diff --git a/drivers/staging/lttng/lttng-context-ppid.c b/drivers/staging/lttng/lttng-context-ppid.c
index 738f7e6..673ff26 100644
--- a/drivers/staging/lttng/lttng-context-ppid.c
+++ b/drivers/staging/lttng/lttng-context-ppid.c
@@ -13,7 +13,6 @@
 #include <linux/syscalls.h>
 #include "ltt-events.h"
 #include "wrapper/ringbuffer/frontend_types.h"
-#include "wrapper/vmalloc.h"
 #include "ltt-tracer.h"
 
 static
@@ -61,7 +60,7 @@ int lttng_add_ppid_to_ctx(struct lttng_ctx **ctx)
 	field->event_field.type.u.basic.integer.encoding = lttng_encode_none;
 	field->get_size = ppid_get_size;
 	field->record = ppid_record;
-	wrapper_vmalloc_sync_all();
+	vmalloc_sync_all();
 	return 0;
 }
 EXPORT_SYMBOL_GPL(lttng_add_ppid_to_ctx);
diff --git a/drivers/staging/lttng/lttng-context-prio.c b/drivers/staging/lttng/lttng-context-prio.c
index 1ee3a54..f4f64de 100644
--- a/drivers/staging/lttng/lttng-context-prio.c
+++ b/drivers/staging/lttng/lttng-context-prio.c
@@ -12,7 +12,6 @@
 #include <linux/sched.h>
 #include "ltt-events.h"
 #include "wrapper/ringbuffer/frontend_types.h"
-#include "wrapper/vmalloc.h"
 #include "wrapper/kallsyms.h"
 #include "ltt-tracer.h"
 
@@ -79,7 +78,7 @@ int lttng_add_prio_to_ctx(struct lttng_ctx **ctx)
 	field->event_field.type.u.basic.integer.encoding = lttng_encode_none;
 	field->get_size = prio_get_size;
 	field->record = prio_record;
-	wrapper_vmalloc_sync_all();
+	vmalloc_sync_all();
 	return 0;
 }
 EXPORT_SYMBOL_GPL(lttng_add_prio_to_ctx);
diff --git a/drivers/staging/lttng/lttng-context-procname.c b/drivers/staging/lttng/lttng-context-procname.c
index c6bc646..0993613 100644
--- a/drivers/staging/lttng/lttng-context-procname.c
+++ b/drivers/staging/lttng/lttng-context-procname.c
@@ -12,7 +12,6 @@
 #include <linux/sched.h>
 #include "ltt-events.h"
 #include "wrapper/ringbuffer/frontend_types.h"
-#include "wrapper/vmalloc.h"
 #include "ltt-tracer.h"
 
 static
@@ -62,7 +61,7 @@ int lttng_add_procname_to_ctx(struct lttng_ctx **ctx)
 
 	field->get_size = procname_get_size;
 	field->record = procname_record;
-	wrapper_vmalloc_sync_all();
+	vmalloc_sync_all();
 	return 0;
 }
 EXPORT_SYMBOL_GPL(lttng_add_procname_to_ctx);
diff --git a/drivers/staging/lttng/lttng-context-tid.c b/drivers/staging/lttng/lttng-context-tid.c
index d5ccdb6..3b2b47d 100644
--- a/drivers/staging/lttng/lttng-context-tid.c
+++ b/drivers/staging/lttng/lttng-context-tid.c
@@ -12,7 +12,6 @@
 #include <linux/sched.h>
 #include "ltt-events.h"
 #include "wrapper/ringbuffer/frontend_types.h"
-#include "wrapper/vmalloc.h"
 #include "ltt-tracer.h"
 
 static
@@ -58,7 +57,7 @@ int lttng_add_tid_to_ctx(struct lttng_ctx **ctx)
 	field->event_field.type.u.basic.integer.encoding = lttng_encode_none;
 	field->get_size = tid_get_size;
 	field->record = tid_record;
-	wrapper_vmalloc_sync_all();
+	vmalloc_sync_all();
 	return 0;
 }
 EXPORT_SYMBOL_GPL(lttng_add_tid_to_ctx);
diff --git a/drivers/staging/lttng/lttng-context-vpid.c b/drivers/staging/lttng/lttng-context-vpid.c
index 3f16e03..49947be 100644
--- a/drivers/staging/lttng/lttng-context-vpid.c
+++ b/drivers/staging/lttng/lttng-context-vpid.c
@@ -12,7 +12,6 @@
 #include <linux/sched.h>
 #include "ltt-events.h"
 #include "wrapper/ringbuffer/frontend_types.h"
-#include "wrapper/vmalloc.h"
 #include "ltt-tracer.h"
 
 static
@@ -64,7 +63,7 @@ int lttng_add_vpid_to_ctx(struct lttng_ctx **ctx)
 	field->event_field.type.u.basic.integer.encoding = lttng_encode_none;
 	field->get_size = vpid_get_size;
 	field->record = vpid_record;
-	wrapper_vmalloc_sync_all();
+	vmalloc_sync_all();
 	return 0;
 }
 EXPORT_SYMBOL_GPL(lttng_add_vpid_to_ctx);
diff --git a/drivers/staging/lttng/lttng-context-vppid.c b/drivers/staging/lttng/lttng-context-vppid.c
index f01b020..983537a 100644
--- a/drivers/staging/lttng/lttng-context-vppid.c
+++ b/drivers/staging/lttng/lttng-context-vppid.c
@@ -13,7 +13,6 @@
 #include <linux/syscalls.h>
 #include "ltt-events.h"
 #include "wrapper/ringbuffer/frontend_types.h"
-#include "wrapper/vmalloc.h"
 #include "ltt-tracer.h"
 
 static
@@ -69,7 +68,7 @@ int lttng_add_vppid_to_ctx(struct lttng_ctx **ctx)
 	field->event_field.type.u.basic.integer.encoding = lttng_encode_none;
 	field->get_size = vppid_get_size;
 	field->record = vppid_record;
-	wrapper_vmalloc_sync_all();
+	vmalloc_sync_all();
 	return 0;
 }
 EXPORT_SYMBOL_GPL(lttng_add_vppid_to_ctx);
diff --git a/drivers/staging/lttng/lttng-context-vtid.c b/drivers/staging/lttng/lttng-context-vtid.c
index 264bbb3..45d7d7e 100644
--- a/drivers/staging/lttng/lttng-context-vtid.c
+++ b/drivers/staging/lttng/lttng-context-vtid.c
@@ -12,7 +12,6 @@
 #include <linux/sched.h>
 #include "ltt-events.h"
 #include "wrapper/ringbuffer/frontend_types.h"
-#include "wrapper/vmalloc.h"
 #include "ltt-tracer.h"
 
 static
@@ -64,7 +63,7 @@ int lttng_add_vtid_to_ctx(struct lttng_ctx **ctx)
 	field->event_field.type.u.basic.integer.encoding = lttng_encode_none;
 	field->get_size = vtid_get_size;
 	field->record = vtid_record;
-	wrapper_vmalloc_sync_all();
+	vmalloc_sync_all();
 	return 0;
 }
 EXPORT_SYMBOL_GPL(lttng_add_vtid_to_ctx);
diff --git a/drivers/staging/lttng/lttng-syscalls.c b/drivers/staging/lttng/lttng-syscalls.c
index 16624a7f7..0ceb4e3 100644
--- a/drivers/staging/lttng/lttng-syscalls.c
+++ b/drivers/staging/lttng/lttng-syscalls.c
@@ -319,7 +319,7 @@ int lttng_syscalls_register(struct ltt_channel *chan, void *filter)
 	struct lttng_kernel_event ev;
 	int ret;
 
-	wrapper_vmalloc_sync_all();
+	vmalloc_sync_all();
 
 	if (!chan->sc_table) {
 		/* create syscall table mapping syscall to events */
diff --git a/drivers/staging/lttng/probes/lttng-events.h b/drivers/staging/lttng/probes/lttng-events.h
index ff6273f..16eee9a 100644
--- a/drivers/staging/lttng/probes/lttng-events.h
+++ b/drivers/staging/lttng/probes/lttng-events.h
@@ -10,7 +10,6 @@
 #include <linux/debugfs.h>
 #include "lttng.h"
 #include "lttng-types.h"
-#include "../wrapper/vmalloc.h"	/* for wrapper_vmalloc_sync_all() */
 #include "../wrapper/ringbuffer/frontend_types.h"
 #include "../ltt-events.h"
 #include "../ltt-tracer-core.h"
@@ -679,7 +678,7 @@ static void __event_probe__##_name(void *__data)			      \
 #ifndef TP_MODULE_OVERRIDE
 static int TP_ID(__lttng_events_init__, TRACE_SYSTEM)(void)
 {
-	wrapper_vmalloc_sync_all();
+	vmalloc_sync_all();
 	return ltt_probe_register(&TP_ID(__probe_desc___, TRACE_SYSTEM));
 }
 
diff --git a/drivers/staging/lttng/probes/lttng-ftrace.c b/drivers/staging/lttng/probes/lttng-ftrace.c
index 1aa7183..7aae75b 100644
--- a/drivers/staging/lttng/probes/lttng-ftrace.c
+++ b/drivers/staging/lttng/probes/lttng-ftrace.c
@@ -23,7 +23,6 @@
 #include "../ltt-events.h"
 #include "../wrapper/ringbuffer/frontend_types.h"
 #include "../wrapper/ftrace.h"
-#include "../wrapper/vmalloc.h"
 #include "../ltt-tracer.h"
 
 static
@@ -133,7 +132,7 @@ int lttng_ftrace_register(const char *name,
 		goto name_error;
 
 	/* Ensure the memory we just allocated don't trigger page faults */
-	wrapper_vmalloc_sync_all();
+	vmalloc_sync_all();
 
 	ret = wrapper_register_ftrace_function_probe(event->u.ftrace.symbol_name,
 			&lttng_ftrace_ops, event);
@@ -169,7 +168,7 @@ EXPORT_SYMBOL_GPL(lttng_ftrace_destroy_private);
 
 int lttng_ftrace_init(void)
 {
-	wrapper_vmalloc_sync_all();
+	vmalloc_sync_all();
 	return 0;
 }
 module_init(lttng_ftrace_init)
diff --git a/drivers/staging/lttng/probes/lttng-kprobes.c b/drivers/staging/lttng/probes/lttng-kprobes.c
index 784002a..d3d43cd 100644
--- a/drivers/staging/lttng/probes/lttng-kprobes.c
+++ b/drivers/staging/lttng/probes/lttng-kprobes.c
@@ -12,7 +12,6 @@
 #include <linux/slab.h>
 #include "../ltt-events.h"
 #include "../wrapper/ringbuffer/frontend_types.h"
-#include "../wrapper/vmalloc.h"
 #include "../ltt-tracer.h"
 
 static
@@ -126,7 +125,7 @@ int lttng_kprobes_register(const char *name,
 	 * Well.. kprobes itself puts the page fault handler on the blacklist,
 	 * but we can never be too careful.
 	 */
-	wrapper_vmalloc_sync_all();
+	vmalloc_sync_all();
 
 	ret = register_kprobe(&event->u.kprobe.kp);
 	if (ret)
diff --git a/drivers/staging/lttng/probes/lttng-kretprobes.c b/drivers/staging/lttng/probes/lttng-kretprobes.c
index 6b29101..60aadcd 100644
--- a/drivers/staging/lttng/probes/lttng-kretprobes.c
+++ b/drivers/staging/lttng/probes/lttng-kretprobes.c
@@ -13,7 +13,6 @@
 #include <linux/kref.h>
 #include "../ltt-events.h"
 #include "../wrapper/ringbuffer/frontend_types.h"
-#include "../wrapper/vmalloc.h"
 #include "../ltt-tracer.h"
 
 enum lttng_kretprobe_type {
@@ -215,7 +214,7 @@ int lttng_kretprobes_register(const char *name,
 	 * Well.. kprobes itself puts the page fault handler on the blacklist,
 	 * but we can never be too careful.
 	 */
-	wrapper_vmalloc_sync_all();
+	vmalloc_sync_all();
 
 	ret = register_kretprobe(&lttng_krp->krp);
 	if (ret)
diff --git a/drivers/staging/lttng/probes/lttng-types.c b/drivers/staging/lttng/probes/lttng-types.c
index 93a9ae5..8b4c071 100644
--- a/drivers/staging/lttng/probes/lttng-types.c
+++ b/drivers/staging/lttng/probes/lttng-types.c
@@ -10,7 +10,6 @@
 
 #include <linux/module.h>
 #include <linux/types.h>
-#include "../wrapper/vmalloc.h"	/* for wrapper_vmalloc_sync_all() */
 #include "../ltt-events.h"
 #include "lttng-types.h"
 #include <linux/hrtimer.h>
@@ -31,7 +30,7 @@ static int lttng_types_init(void)
 {
 	int ret = 0;
 
-	wrapper_vmalloc_sync_all();
+	vmalloc_sync_all();
 	/* TODO */
 	return ret;
 }
diff --git a/drivers/staging/lttng/wrapper/vmalloc.h b/drivers/staging/lttng/wrapper/vmalloc.h
deleted file mode 100644
index 765f2ad..0000000
--- a/drivers/staging/lttng/wrapper/vmalloc.h
+++ /dev/null
@@ -1,49 +0,0 @@
-#ifndef _LTT_WRAPPER_VMALLOC_H
-#define _LTT_WRAPPER_VMALLOC_H
-
-/*
- * Copyright (C) 2011 Mathieu Desnoyers (mathieu.desnoyers at efficios.com)
- *
- * wrapper around vmalloc_sync_all. Using KALLSYMS to get its address when
- * available, else we need to have a kernel that exports this function to GPL
- * modules.
- *
- * Dual LGPL v2.1/GPL v2 license.
- */
-
-#ifdef CONFIG_KALLSYMS
-
-#include <linux/kallsyms.h>
-#include "kallsyms.h"
-
-static inline
-void wrapper_vmalloc_sync_all(void)
-{
-	void (*vmalloc_sync_all_sym)(void);
-
-	vmalloc_sync_all_sym = (void *) kallsyms_lookup_funcptr("vmalloc_sync_all");
-	if (vmalloc_sync_all_sym) {
-		vmalloc_sync_all_sym();
-	} else {
-#ifdef CONFIG_X86
-		/*
-		 * Only x86 needs vmalloc_sync_all to make sure LTTng does not
-		 * trigger recursive page faults.
-		 */
-		printk(KERN_WARNING "LTTng: vmalloc_sync_all symbol lookup failed.\n");
-		printk(KERN_WARNING "Page fault handler and NMI tracing might trigger faults.\n");
-#endif
-	}
-}
-#else
-
-#include <linux/vmalloc.h>
-
-static inline
-void wrapper_vmalloc_sync_all(void)
-{
-	return vmalloc_sync_all();
-}
-#endif
-
-#endif /* _LTT_WRAPPER_VMALLOC_H */
-- 
1.7.5.4




^ permalink raw reply	[flat|nested] 18+ messages in thread

* [lttng-dev] [PATCH 07/15] fs/splice: export splice_to_pipe to modules
  2011-11-30 18:34 [lttng-dev] LTTng wrapper cleanup Mathieu Desnoyers
                   ` (5 preceding siblings ...)
  2011-11-30 18:34 ` [lttng-dev] [PATCH 06/15] Remove LTTng vmalloc_sync_all wrapper Mathieu Desnoyers
@ 2011-11-30 18:34 ` Mathieu Desnoyers
  2011-11-30 18:34 ` [lttng-dev] [PATCH 08/15] lttng: remove splice_to_pipe wrapper Mathieu Desnoyers
                   ` (8 subsequent siblings)
  15 siblings, 0 replies; 18+ messages in thread
From: Mathieu Desnoyers @ 2011-11-30 18:34 UTC (permalink / raw)


LTTng needs this symbol exported because it implements its own splice
actor.

Exporting to all modules following the general policy of splice.c (this
is what other EXPORTs do in this file).

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers at efficios.com>
---
 fs/splice.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/fs/splice.c b/fs/splice.c
index fa2defa..492585d 100644
--- a/fs/splice.c
+++ b/fs/splice.c
@@ -263,6 +263,7 @@ ssize_t splice_to_pipe(struct pipe_inode_info *pipe,
 
 	return ret;
 }
+EXPORT_SYMBOL(splice_to_pipe);
 
 void spd_release_page(struct splice_pipe_desc *spd, unsigned int i)
 {
-- 
1.7.5.4




^ permalink raw reply	[flat|nested] 18+ messages in thread

* [lttng-dev] [PATCH 08/15] lttng: remove splice_to_pipe wrapper
  2011-11-30 18:34 [lttng-dev] LTTng wrapper cleanup Mathieu Desnoyers
                   ` (6 preceding siblings ...)
  2011-11-30 18:34 ` [lttng-dev] [PATCH 07/15] fs/splice: export splice_to_pipe to modules Mathieu Desnoyers
@ 2011-11-30 18:34 ` Mathieu Desnoyers
  2011-11-30 18:34 ` [lttng-dev] [PATCH 09/15] lttng: remove perf_event_create_kernel_counter wrapper Mathieu Desnoyers
                   ` (7 subsequent siblings)
  15 siblings, 0 replies; 18+ messages in thread
From: Mathieu Desnoyers @ 2011-11-30 18:34 UTC (permalink / raw)


Use the newly exported splice_to_pipe symbol.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers at efficios.com>
---
 drivers/staging/lttng/lib/Makefile                 |    3 +-
 .../lttng/lib/ringbuffer/ring_buffer_splice.c      |    3 +-
 drivers/staging/lttng/wrapper/splice.c             |   46 --------------------
 drivers/staging/lttng/wrapper/splice.h             |   23 ----------
 4 files changed, 2 insertions(+), 73 deletions(-)
 delete mode 100644 drivers/staging/lttng/wrapper/splice.c
 delete mode 100644 drivers/staging/lttng/wrapper/splice.h

diff --git a/drivers/staging/lttng/lib/Makefile b/drivers/staging/lttng/lib/Makefile
index e5735ec..9fa49ef 100644
--- a/drivers/staging/lttng/lib/Makefile
+++ b/drivers/staging/lttng/lib/Makefile
@@ -7,5 +7,4 @@ lib-ring-buffer-objs := \
 	ringbuffer/ring_buffer_vfs.o \
 	ringbuffer/ring_buffer_splice.o \
 	ringbuffer/ring_buffer_mmap.o \
-	prio_heap/lttng_prio_heap.o \
-	../wrapper/splice.o
+	prio_heap/lttng_prio_heap.o
diff --git a/drivers/staging/lttng/lib/ringbuffer/ring_buffer_splice.c b/drivers/staging/lttng/lib/ringbuffer/ring_buffer_splice.c
index ded18ba..fc89901 100644
--- a/drivers/staging/lttng/lib/ringbuffer/ring_buffer_splice.c
+++ b/drivers/staging/lttng/lib/ringbuffer/ring_buffer_splice.c
@@ -13,7 +13,6 @@
 #include <linux/module.h>
 #include <linux/fs.h>
 
-#include "../../wrapper/splice.h"
 #include "../../wrapper/ringbuffer/backend.h"
 #include "../../wrapper/ringbuffer/frontend.h"
 #include "../../wrapper/ringbuffer/vfs.h"
@@ -142,7 +141,7 @@ static int subbuf_splice_actor(struct file *in,
 	if (!spd.nr_pages)
 		return 0;
 
-	return wrapper_splice_to_pipe(pipe, &spd);
+	return splice_to_pipe(pipe, &spd);
 }
 
 ssize_t lib_ring_buffer_splice_read(struct file *in, loff_t *ppos,
diff --git a/drivers/staging/lttng/wrapper/splice.c b/drivers/staging/lttng/wrapper/splice.c
deleted file mode 100644
index ba224ee..0000000
--- a/drivers/staging/lttng/wrapper/splice.c
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright (C) 2011 Mathieu Desnoyers (mathieu.desnoyers at efficios.com)
- *
- * wrapper around vmalloc_sync_all. Using KALLSYMS to get its address when
- * available, else we need to have a kernel that exports this function to GPL
- * modules.
- *
- * Dual LGPL v2.1/GPL v2 license.
- */
-
-#ifdef CONFIG_KALLSYMS
-
-#include <linux/kallsyms.h>
-#include <linux/fs.h>
-#include <linux/splice.h>
-#include "kallsyms.h"
-
-static
-ssize_t (*splice_to_pipe_sym)(struct pipe_inode_info *pipe,
-			      struct splice_pipe_desc *spd);
-
-ssize_t wrapper_splice_to_pipe(struct pipe_inode_info *pipe,
-			       struct splice_pipe_desc *spd)
-{
-	if (!splice_to_pipe_sym)
-		splice_to_pipe_sym = (void *) kallsyms_lookup_funcptr("splice_to_pipe"); 
-	if (splice_to_pipe_sym) {
-		return splice_to_pipe_sym(pipe, spd);
-	} else {
-		printk(KERN_WARNING "LTTng: splice_to_pipe symbol lookup failed.\n");
-		return -ENOSYS;
-	}
-}
-
-#else
-
-#include <linux/fs.h>
-#include <linux/splice.h>
-
-ssize_t wrapper_splice_to_pipe(struct pipe_inode_info *pipe,
-			       struct splice_pipe_desc *spd)
-{
-	return splice_to_pipe(pipe, spd);
-}
-
-#endif
diff --git a/drivers/staging/lttng/wrapper/splice.h b/drivers/staging/lttng/wrapper/splice.h
deleted file mode 100644
index f75309a..0000000
--- a/drivers/staging/lttng/wrapper/splice.h
+++ /dev/null
@@ -1,23 +0,0 @@
-#ifndef _LTT_WRAPPER_SPLICE_H
-#define _LTT_WRAPPER_SPLICE_H
-
-/*
- * Copyright (C) 2011 Mathieu Desnoyers (mathieu.desnoyers at efficios.com)
- *
- * wrapper around vmalloc_sync_all. Using KALLSYMS to get its address when
- * available, else we need to have a kernel that exports this function to GPL
- * modules.
- *
- * Dual LGPL v2.1/GPL v2 license.
- */
-
-#include <linux/splice.h>
-
-ssize_t wrapper_splice_to_pipe(struct pipe_inode_info *pipe,
-			       struct splice_pipe_desc *spd);
-
-#ifndef PIPE_DEF_BUFFERS
-#define PIPE_DEF_BUFFERS 16
-#endif
-
-#endif /* _LTT_WRAPPER_SPLICE_H */
-- 
1.7.5.4




^ permalink raw reply	[flat|nested] 18+ messages in thread

* [lttng-dev] [PATCH 09/15] lttng: remove perf_event_create_kernel_counter wrapper
  2011-11-30 18:34 [lttng-dev] LTTng wrapper cleanup Mathieu Desnoyers
                   ` (7 preceding siblings ...)
  2011-11-30 18:34 ` [lttng-dev] [PATCH 08/15] lttng: remove splice_to_pipe wrapper Mathieu Desnoyers
@ 2011-11-30 18:34 ` Mathieu Desnoyers
  2011-11-30 18:34 ` [lttng-dev] [PATCH 10/15] lttng: remove ftrace function tracer support (but keep Mathieu Desnoyers
                   ` (6 subsequent siblings)
  15 siblings, 0 replies; 18+ messages in thread
From: Mathieu Desnoyers @ 2011-11-30 18:34 UTC (permalink / raw)


Now that LTTng is in the kernel tree, we don't need to support
deprecated APIs from older kernels.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers at efficios.com>
---
 .../staging/lttng/lttng-context-perf-counters.c    |    9 ++---
 drivers/staging/lttng/wrapper/perf.h               |   32 --------------------
 2 files changed, 4 insertions(+), 37 deletions(-)
 delete mode 100644 drivers/staging/lttng/wrapper/perf.h

diff --git a/drivers/staging/lttng/lttng-context-perf-counters.c b/drivers/staging/lttng/lttng-context-perf-counters.c
index 9910066..713c4df 100644
--- a/drivers/staging/lttng/lttng-context-perf-counters.c
+++ b/drivers/staging/lttng/lttng-context-perf-counters.c
@@ -14,7 +14,6 @@
 #include <linux/string.h>
 #include "ltt-events.h"
 #include "wrapper/ringbuffer/frontend_types.h"
-#include "wrapper/perf.h"
 #include "ltt-tracer.h"
 
 static
@@ -123,8 +122,8 @@ int __cpuinit lttng_perf_counter_cpu_hp_callback(struct notifier_block *nb,
 	switch (action) {
 	case CPU_ONLINE:
 	case CPU_ONLINE_FROZEN:
-		pevent = wrapper_perf_event_create_kernel_counter(attr,
-				cpu, NULL, overflow_callback);
+		pevent = perf_event_create_kernel_counter(attr,
+				cpu, NULL, overflow_callback, NULL);
 		if (!pevent || IS_ERR(pevent))
 			return NOTIFY_BAD;
 		if (pevent->state == PERF_EVENT_STATE_ERROR) {
@@ -211,8 +210,8 @@ int lttng_add_perf_counter_to_ctx(uint32_t type,
 
 	get_online_cpus();
 	for_each_online_cpu(cpu) {
-		events[cpu] = wrapper_perf_event_create_kernel_counter(attr,
-					cpu, NULL, overflow_callback);
+		events[cpu] = perf_event_create_kernel_counter(attr,
+					cpu, NULL, overflow_callback, NULL);
 		if (!events[cpu] || IS_ERR(events[cpu])) {
 			ret = -EINVAL;
 			goto counter_error;
diff --git a/drivers/staging/lttng/wrapper/perf.h b/drivers/staging/lttng/wrapper/perf.h
deleted file mode 100644
index 9a6dbfc..0000000
--- a/drivers/staging/lttng/wrapper/perf.h
+++ /dev/null
@@ -1,32 +0,0 @@
-#ifndef _LTT_WRAPPER_PERF_H
-#define _LTT_WRAPPER_PERF_H
-
-/*
- * Copyright (C) 2011 Mathieu Desnoyers (mathieu.desnoyers at efficios.com)
- *
- * Dual LGPL v2.1/GPL v2 license.
- */
-
-#include <linux/perf_event.h>
-
-#if defined(CONFIG_PERF_EVENTS) && (LINUX_VERSION_CODE >= KERNEL_VERSION(3,0,99))
-static inline struct perf_event *
-wrapper_perf_event_create_kernel_counter(struct perf_event_attr *attr,
-				int cpu,
-				struct task_struct *task,
-				perf_overflow_handler_t callback)
-{
-	return perf_event_create_kernel_counter(attr, cpu, task, callback, NULL);
-}
-#else
-static inline struct perf_event *
-wrapper_perf_event_create_kernel_counter(struct perf_event_attr *attr,
-				int cpu,
-				struct task_struct *task,
-				perf_overflow_handler_t callback)
-{
-	return perf_event_create_kernel_counter(attr, cpu, task, callback);
-}
-#endif
-
-#endif /* _LTT_WRAPPER_PERF_H */
-- 
1.7.5.4




^ permalink raw reply	[flat|nested] 18+ messages in thread

* [lttng-dev] [PATCH 10/15] lttng: remove ftrace function tracer support (but keep
  2011-11-30 18:34 [lttng-dev] LTTng wrapper cleanup Mathieu Desnoyers
                   ` (8 preceding siblings ...)
  2011-11-30 18:34 ` [lttng-dev] [PATCH 09/15] lttng: remove perf_event_create_kernel_counter wrapper Mathieu Desnoyers
@ 2011-11-30 18:34 ` Mathieu Desnoyers
  2011-11-30 18:34 ` [lttng-dev] [PATCH 11/15] lttng: remove raw spinlock wrapper Mathieu Desnoyers
                   ` (5 subsequent siblings)
  15 siblings, 0 replies; 18+ messages in thread
From: Mathieu Desnoyers @ 2011-11-30 18:34 UTC (permalink / raw)


LTTng was using a non-exported ftrace symbol,
register_ftrace_function_probe(), for function-by-function selection for
function tracing.

We prefer to use kretprobes to do this, which gives us function entry
and exit.

Ftrace function tracer approach makes sense when selecting _all_
functions for tracing and calling one single callback (with same data)
to receive all the callback calls without polluting the cache too much.
This is now available to modules with register_ftrace_function(), but
does not allow private data pointer -- which goes against the LTTng
"session-based" tracing semantic.

We'll probably add back ftrace function tracing support for tracing "all
functions" at some point when the ftrace API supports private data.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers at efficios.com>
---
 drivers/staging/lttng/README                |    4 +-
 drivers/staging/lttng/ltt-events.c          |    9 +-
 drivers/staging/lttng/probes/Makefile       |    4 -
 drivers/staging/lttng/probes/lttng-ftrace.c |  187 ---------------------------
 drivers/staging/lttng/wrapper/ftrace.h      |   70 ----------
 5 files changed, 3 insertions(+), 271 deletions(-)
 delete mode 100644 drivers/staging/lttng/probes/lttng-ftrace.c
 delete mode 100644 drivers/staging/lttng/wrapper/ftrace.h

diff --git a/drivers/staging/lttng/README b/drivers/staging/lttng/README
index a154d6e..a808ee9 100644
--- a/drivers/staging/lttng/README
+++ b/drivers/staging/lttng/README
@@ -8,8 +8,8 @@ tree. It features (new features since LTTng 0.x):
 
 - Produces CTF (Common Trace Format) natively,
   (http://www.efficios.com/ctf)
-- Tracepoints, Function tracer, CPU Performance Monitoring Unit (PMU)
-  counters, kprobes, and kretprobes support,
+- Tracepoints, CPU Performance Monitoring Unit (PMU) counters, kprobes, and
+  kretprobes (function entry/exit) support,
 - Integrated interface for both kernel and userspace tracing,
 - Have the ability to attach "context" information to events in the
   trace (e.g. any PMU counter, pid, ppid, tid, comm name, etc).
diff --git a/drivers/staging/lttng/ltt-events.c b/drivers/staging/lttng/ltt-events.c
index f7438c5..de1372c 100644
--- a/drivers/staging/lttng/ltt-events.c
+++ b/drivers/staging/lttng/ltt-events.c
@@ -357,14 +357,7 @@ struct ltt_event *ltt_event_create(struct ltt_channel *chan,
 		break;
 	}
 	case LTTNG_KERNEL_FUNCTION:
-		ret = lttng_ftrace_register(event_param->name,
-				event_param->u.ftrace.symbol_name,
-				event);
-		if (ret)
-			goto register_error;
-		ret = try_module_get(event->desc->owner);
-		WARN_ON_ONCE(!ret);
-		break;
+		goto register_error;
 	case LTTNG_KERNEL_NOOP:
 		event->desc = internal_desc;
 		if (!event->desc)
diff --git a/drivers/staging/lttng/probes/Makefile b/drivers/staging/lttng/probes/Makefile
index bdc1179..78ab9f7 100644
--- a/drivers/staging/lttng/probes/Makefile
+++ b/drivers/staging/lttng/probes/Makefile
@@ -31,7 +31,3 @@ endif
 ifneq ($(CONFIG_KRETPROBES),)
 obj-m += lttng-kretprobes.o
 endif
-
-ifneq ($(CONFIG_DYNAMIC_FTRACE),)
-obj-m += lttng-ftrace.o
-endif
diff --git a/drivers/staging/lttng/probes/lttng-ftrace.c b/drivers/staging/lttng/probes/lttng-ftrace.c
deleted file mode 100644
index 7aae75b..0000000
--- a/drivers/staging/lttng/probes/lttng-ftrace.c
+++ /dev/null
@@ -1,187 +0,0 @@
-/*
- * (C) Copyright	2009-2011 -
- * 		Mathieu Desnoyers <mathieu.desnoyers at efficios.com>
- *
- * LTTng function tracer integration module.
- *
- * Dual LGPL v2.1/GPL v2 license.
- */
-
-/*
- * Ftrace function tracer does not seem to provide synchronization between probe
- * teardown and callback execution. Therefore, we make this module permanently
- * loaded (unloadable).
- *
- * TODO: Move to register_ftrace_function() (which is exported for
- * modules) for Linux >= 3.0. It is faster (only enables the selected
- * functions), and will stay there.
- */
-
-#include <linux/module.h>
-#include <linux/ftrace.h>
-#include <linux/slab.h>
-#include "../ltt-events.h"
-#include "../wrapper/ringbuffer/frontend_types.h"
-#include "../wrapper/ftrace.h"
-#include "../ltt-tracer.h"
-
-static
-void lttng_ftrace_handler(unsigned long ip, unsigned long parent_ip, void **data)
-{
-	struct ltt_event *event = *data;
-	struct ltt_channel *chan = event->chan;
-	struct lib_ring_buffer_ctx ctx;
-	struct {
-		unsigned long ip;
-		unsigned long parent_ip;
-	} payload;
-	int ret;
-
-	if (unlikely(!ACCESS_ONCE(chan->session->active)))
-		return;
-	if (unlikely(!ACCESS_ONCE(chan->enabled)))
-		return;
-	if (unlikely(!ACCESS_ONCE(event->enabled)))
-		return;
-
-	lib_ring_buffer_ctx_init(&ctx, chan->chan, event,
-				 sizeof(payload), ltt_alignof(payload), -1);
-	ret = chan->ops->event_reserve(&ctx, event->id);
-	if (ret < 0)
-		return;
-	payload.ip = ip;
-	payload.parent_ip = parent_ip;
-	lib_ring_buffer_align_ctx(&ctx, ltt_alignof(payload));
-	chan->ops->event_write(&ctx, &payload, sizeof(payload));
-	chan->ops->event_commit(&ctx);
-	return;
-}
-
-/*
- * Create event description
- */
-static
-int lttng_create_ftrace_event(const char *name, struct ltt_event *event)
-{
-	struct lttng_event_field *fields;
-	struct lttng_event_desc *desc;
-	int ret;
-
-	desc = kzalloc(sizeof(*event->desc), GFP_KERNEL);
-	if (!desc)
-		return -ENOMEM;
-	desc->name = kstrdup(name, GFP_KERNEL);
-	if (!desc->name) {
-		ret = -ENOMEM;
-		goto error_str;
-	}
-	desc->nr_fields = 2;
-	desc->fields = fields =
-		kzalloc(2 * sizeof(struct lttng_event_field), GFP_KERNEL);
-	if (!desc->fields) {
-		ret = -ENOMEM;
-		goto error_fields;
-	}
-	fields[0].name = "ip";
-	fields[0].type.atype = atype_integer;
-	fields[0].type.u.basic.integer.size = sizeof(unsigned long) * CHAR_BIT;
-	fields[0].type.u.basic.integer.alignment = ltt_alignof(unsigned long) * CHAR_BIT;
-	fields[0].type.u.basic.integer.signedness = is_signed_type(unsigned long);
-	fields[0].type.u.basic.integer.reverse_byte_order = 0;
-	fields[0].type.u.basic.integer.base = 16;
-	fields[0].type.u.basic.integer.encoding = lttng_encode_none;
-
-	fields[1].name = "parent_ip";
-	fields[1].type.atype = atype_integer;
-	fields[1].type.u.basic.integer.size = sizeof(unsigned long) * CHAR_BIT;
-	fields[1].type.u.basic.integer.alignment = ltt_alignof(unsigned long) * CHAR_BIT;
-	fields[1].type.u.basic.integer.signedness = is_signed_type(unsigned long);
-	fields[1].type.u.basic.integer.reverse_byte_order = 0;
-	fields[1].type.u.basic.integer.base = 16;
-	fields[1].type.u.basic.integer.encoding = lttng_encode_none;
-
-	desc->owner = THIS_MODULE;
-	event->desc = desc;
-
-	return 0;
-
-error_fields:
-	kfree(desc->name);
-error_str:
-	kfree(desc);
-	return ret;
-}
-
-static
-struct ftrace_probe_ops lttng_ftrace_ops = {
-	.func = lttng_ftrace_handler,
-};
-
-int lttng_ftrace_register(const char *name,
-			  const char *symbol_name,
-			  struct ltt_event *event)
-{
-	int ret;
-
-	ret = lttng_create_ftrace_event(name, event);
-	if (ret)
-		goto error;
-
-	event->u.ftrace.symbol_name = kstrdup(symbol_name, GFP_KERNEL);
-	if (!event->u.ftrace.symbol_name)
-		goto name_error;
-
-	/* Ensure the memory we just allocated don't trigger page faults */
-	vmalloc_sync_all();
-
-	ret = wrapper_register_ftrace_function_probe(event->u.ftrace.symbol_name,
-			&lttng_ftrace_ops, event);
-	if (ret < 0)
-		goto register_error;
-	return 0;
-
-register_error:
-	kfree(event->u.ftrace.symbol_name);
-name_error:
-	kfree(event->desc->name);
-	kfree(event->desc);
-error:
-	return ret;
-}
-EXPORT_SYMBOL_GPL(lttng_ftrace_register);
-
-void lttng_ftrace_unregister(struct ltt_event *event)
-{
-	wrapper_unregister_ftrace_function_probe(event->u.ftrace.symbol_name,
-			&lttng_ftrace_ops, event);
-}
-EXPORT_SYMBOL_GPL(lttng_ftrace_unregister);
-
-void lttng_ftrace_destroy_private(struct ltt_event *event)
-{
-	kfree(event->u.ftrace.symbol_name);
-	kfree(event->desc->fields);
-	kfree(event->desc->name);
-	kfree(event->desc);
-}
-EXPORT_SYMBOL_GPL(lttng_ftrace_destroy_private);
-
-int lttng_ftrace_init(void)
-{
-	vmalloc_sync_all();
-	return 0;
-}
-module_init(lttng_ftrace_init)
-
-/*
- * Ftrace takes care of waiting for a grace period (RCU sched) at probe
- * unregistration, and disables preemption around probe call.
- */
-void lttng_ftrace_exit(void)
-{
-}
-module_exit(lttng_ftrace_exit)
-
-MODULE_LICENSE("GPL and additional rights");
-MODULE_AUTHOR("Mathieu Desnoyers");
-MODULE_DESCRIPTION("Linux Trace Toolkit Ftrace Support");
diff --git a/drivers/staging/lttng/wrapper/ftrace.h b/drivers/staging/lttng/wrapper/ftrace.h
deleted file mode 100644
index ace33c5..0000000
--- a/drivers/staging/lttng/wrapper/ftrace.h
+++ /dev/null
@@ -1,70 +0,0 @@
-#ifndef _LTT_WRAPPER_FTRACE_H
-#define _LTT_WRAPPER_FTRACE_H
-
-/*
- * Copyright (C) 2011 Mathieu Desnoyers (mathieu.desnoyers at efficios.com)
- *
- * wrapper around vmalloc_sync_all. Using KALLSYMS to get its address when
- * available, else we need to have a kernel that exports this function to GPL
- * modules.
- *
- * Dual LGPL v2.1/GPL v2 license.
- */
-
-#include <linux/ftrace.h>
-
-#ifdef CONFIG_KALLSYMS
-
-#include <linux/kallsyms.h>
-#include "kallsyms.h"
-
-static inline
-int wrapper_register_ftrace_function_probe(char *glob,
-		struct ftrace_probe_ops *ops, void *data)
-{
-	int (*register_ftrace_function_probe_sym)(char *glob,
-			struct ftrace_probe_ops *ops, void *data);
-
-	register_ftrace_function_probe_sym = (void *) kallsyms_lookup_funcptr("register_ftrace_function_probe");
-	if (register_ftrace_function_probe_sym) {
-		return register_ftrace_function_probe_sym(glob, ops, data);
-	} else {
-		printk(KERN_WARNING "LTTng: register_ftrace_function_probe symbol lookup failed.\n");
-		return -EINVAL;
-	}
-}
-
-static inline
-void wrapper_unregister_ftrace_function_probe(char *glob,
-		struct ftrace_probe_ops *ops, void *data)
-{
-	void (*unregister_ftrace_function_probe_sym)(char *glob,
-			struct ftrace_probe_ops *ops, void *data);
-
-	unregister_ftrace_function_probe_sym = (void *) kallsyms_lookup_funcptr("unregister_ftrace_function_probe");
-	if (unregister_ftrace_function_probe_sym) {
-		unregister_ftrace_function_probe_sym(glob, ops, data);
-	} else {
-		printk(KERN_WARNING "LTTng: unregister_ftrace_function_probe symbol lookup failed.\n");
-		WARN_ON(1);
-	}
-}
-
-#else
-
-static inline
-int wrapper_register_ftrace_function_probe(char *glob,
-		struct ftrace_probe_ops *ops, void *data)
-{
-	return register_ftrace_function_probe(glob, ops, data);
-}
-
-static inline
-void wrapper_unregister_ftrace_function_probe(char *glob,
-		struct ftrace_probe_ops *ops, void *data)
-{
-	return unregister_ftrace_function_probe(glob, ops, data);
-}
-#endif
-
-#endif /* _LTT_WRAPPER_FTRACE_H */
-- 
1.7.5.4




^ permalink raw reply	[flat|nested] 18+ messages in thread

* [lttng-dev] [PATCH 11/15] lttng: remove raw spinlock wrapper
  2011-11-30 18:34 [lttng-dev] LTTng wrapper cleanup Mathieu Desnoyers
                   ` (9 preceding siblings ...)
  2011-11-30 18:34 ` [lttng-dev] [PATCH 10/15] lttng: remove ftrace function tracer support (but keep Mathieu Desnoyers
@ 2011-11-30 18:34 ` Mathieu Desnoyers
  2011-11-30 18:34 ` [lttng-dev] [PATCH 12/15] lttng: remove uuid wrapper Mathieu Desnoyers
                   ` (4 subsequent siblings)
  15 siblings, 0 replies; 18+ messages in thread
From: Mathieu Desnoyers @ 2011-11-30 18:34 UTC (permalink / raw)


Now that LTTng is in the kernel tree, we don't need to support
deprecated APIs from older kernels.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers at efficios.com>
---
 .../staging/lttng/lib/ringbuffer/frontend_types.h  |    1 -
 drivers/staging/lttng/wrapper/spinlock.h           |   26 --------------------
 2 files changed, 0 insertions(+), 27 deletions(-)
 delete mode 100644 drivers/staging/lttng/wrapper/spinlock.h

diff --git a/drivers/staging/lttng/lib/ringbuffer/frontend_types.h b/drivers/staging/lttng/lib/ringbuffer/frontend_types.h
index 5c7437f..00b4552 100644
--- a/drivers/staging/lttng/lib/ringbuffer/frontend_types.h
+++ b/drivers/staging/lttng/lib/ringbuffer/frontend_types.h
@@ -19,7 +19,6 @@
 #include <linux/kref.h>
 #include "../../wrapper/ringbuffer/config.h"
 #include "../../wrapper/ringbuffer/backend_types.h"
-#include "../../wrapper/spinlock.h"
 #include "../../lib/prio_heap/lttng_prio_heap.h"	/* For per-CPU read-side iterator */
 
 /*
diff --git a/drivers/staging/lttng/wrapper/spinlock.h b/drivers/staging/lttng/wrapper/spinlock.h
deleted file mode 100644
index 8b1ad99..0000000
--- a/drivers/staging/lttng/wrapper/spinlock.h
+++ /dev/null
@@ -1,26 +0,0 @@
-#ifndef _LTT_WRAPPER_SPINLOCK_H
-#define _LTT_WRAPPER_SPINLOCK_H
-
-/*
- * Copyright (C) 2011 Mathieu Desnoyers (mathieu.desnoyers at efficios.com)
- *
- * Dual LGPL v2.1/GPL v2 license.
- */
-
-#include <linux/version.h>
-
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,33))
-
-#include <linux/string.h>
-
-#define raw_spin_lock_init(lock)					\
-	do {								\
-		raw_spinlock_t __lock = __RAW_SPIN_LOCK_UNLOCKED;	\
-		memcpy(lock, &__lock, sizeof(lock));			\
-	} while (0)
-
-#define raw_spin_is_locked(lock)	__raw_spin_is_locked(lock)
-
-
-#endif
-#endif /* _LTT_WRAPPER_SPINLOCK_H */
-- 
1.7.5.4




^ permalink raw reply	[flat|nested] 18+ messages in thread

* [lttng-dev] [PATCH 12/15] lttng: remove uuid wrapper
  2011-11-30 18:34 [lttng-dev] LTTng wrapper cleanup Mathieu Desnoyers
                   ` (10 preceding siblings ...)
  2011-11-30 18:34 ` [lttng-dev] [PATCH 11/15] lttng: remove raw spinlock wrapper Mathieu Desnoyers
@ 2011-11-30 18:34 ` Mathieu Desnoyers
  2011-11-30 18:34 ` [lttng-dev] [PATCH 13/15] Export task_prio to modules Mathieu Desnoyers
                   ` (3 subsequent siblings)
  15 siblings, 0 replies; 18+ messages in thread
From: Mathieu Desnoyers @ 2011-11-30 18:34 UTC (permalink / raw)


Now that LTTng is in the kernel tree, we don't need to provide support
for older kernel versions.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers at efficios.com>
---
 drivers/staging/lttng/ltt-events.c   |    2 +-
 drivers/staging/lttng/ltt-events.h   |    3 ++-
 drivers/staging/lttng/wrapper/uuid.h |   29 -----------------------------
 3 files changed, 3 insertions(+), 31 deletions(-)
 delete mode 100644 drivers/staging/lttng/wrapper/uuid.h

diff --git a/drivers/staging/lttng/ltt-events.c b/drivers/staging/lttng/ltt-events.c
index de1372c..60ff250 100644
--- a/drivers/staging/lttng/ltt-events.c
+++ b/drivers/staging/lttng/ltt-events.c
@@ -14,7 +14,7 @@
 #include <linux/sched.h>
 #include <linux/slab.h>
 #include <linux/jiffies.h>
-#include "wrapper/uuid.h"
+#include <linux/uuid.h>
 #include "ltt-events.h"
 #include "ltt-tracer.h"
 
diff --git a/drivers/staging/lttng/ltt-events.h b/drivers/staging/lttng/ltt-events.h
index 36b281a..bf3255c 100644
--- a/drivers/staging/lttng/ltt-events.h
+++ b/drivers/staging/lttng/ltt-events.h
@@ -13,7 +13,8 @@
 
 #include <linux/list.h>
 #include <linux/kprobes.h>
-#include "wrapper/uuid.h"
+#include <linux/uuid.h>
+#include <linux/version.h>
 #include "ltt-debugfs-abi.h"
 
 #undef is_signed_type
diff --git a/drivers/staging/lttng/wrapper/uuid.h b/drivers/staging/lttng/wrapper/uuid.h
deleted file mode 100644
index bfa67ff..0000000
--- a/drivers/staging/lttng/wrapper/uuid.h
+++ /dev/null
@@ -1,29 +0,0 @@
-#ifndef _LTT_WRAPPER_UUID_H
-#define _LTT_WRAPPER_UUID_H
-
-/*
- * Copyright (C) 2011 Mathieu Desnoyers (mathieu.desnoyers at efficios.com)
- *
- * Dual LGPL v2.1/GPL v2 license.
- */
-
-#include <linux/version.h>
-
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35))
-#include <linux/uuid.h>
-#else
-
-#include <linux/random.h>
-
-typedef struct {
-	__u8 b[16];
-} uuid_le;
-
-static inline
-void uuid_le_gen(uuid_le *u)
-{
-	generate_random_uuid(u->b);
-}
-
-#endif
-#endif /* _LTT_WRAPPER_UUID_H */
-- 
1.7.5.4




^ permalink raw reply	[flat|nested] 18+ messages in thread

* [lttng-dev] [PATCH 13/15] Export task_prio to modules
  2011-11-30 18:34 [lttng-dev] LTTng wrapper cleanup Mathieu Desnoyers
                   ` (11 preceding siblings ...)
  2011-11-30 18:34 ` [lttng-dev] [PATCH 12/15] lttng: remove uuid wrapper Mathieu Desnoyers
@ 2011-11-30 18:34 ` Mathieu Desnoyers
  2011-11-30 18:34 ` [lttng-dev] [PATCH 14/15] lttng: remove task_prio wrapper Mathieu Desnoyers
                   ` (2 subsequent siblings)
  15 siblings, 0 replies; 18+ messages in thread
From: Mathieu Desnoyers @ 2011-11-30 18:34 UTC (permalink / raw)


LTTng needs this symbol to prepend the current task dynamic priority
value to events (optional context information).

Exporting to all modules following the similar task_nice().

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers at efficios.com>
---
 kernel/sched.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/kernel/sched.c b/kernel/sched.c
index 0e9344a..ac88d6c 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -5142,6 +5142,7 @@ int task_prio(const struct task_struct *p)
 {
 	return p->prio - MAX_RT_PRIO;
 }
+EXPORT_SYMBOL(task_prio);
 
 /**
  * task_nice - return the nice value of a given task.
-- 
1.7.5.4




^ permalink raw reply	[flat|nested] 18+ messages in thread

* [lttng-dev] [PATCH 14/15] lttng: remove task_prio wrapper
  2011-11-30 18:34 [lttng-dev] LTTng wrapper cleanup Mathieu Desnoyers
                   ` (12 preceding siblings ...)
  2011-11-30 18:34 ` [lttng-dev] [PATCH 13/15] Export task_prio to modules Mathieu Desnoyers
@ 2011-11-30 18:34 ` Mathieu Desnoyers
  2011-11-30 18:34 ` [lttng-dev] [PATCH 15/15] lttng: remove kallsyms wrapper Mathieu Desnoyers
  2011-11-30 18:47 ` [lttng-dev] LTTng wrapper cleanup Greg KH
  15 siblings, 0 replies; 18+ messages in thread
From: Mathieu Desnoyers @ 2011-11-30 18:34 UTC (permalink / raw)


Use the newly exported task_prio symbol.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers at efficios.com>
---
 drivers/staging/lttng/lttng-context-prio.c |   23 +----------------------
 1 files changed, 1 insertions(+), 22 deletions(-)

diff --git a/drivers/staging/lttng/lttng-context-prio.c b/drivers/staging/lttng/lttng-context-prio.c
index f4f64de..9d46ba0 100644
--- a/drivers/staging/lttng/lttng-context-prio.c
+++ b/drivers/staging/lttng/lttng-context-prio.c
@@ -12,23 +12,9 @@
 #include <linux/sched.h>
 #include "ltt-events.h"
 #include "wrapper/ringbuffer/frontend_types.h"
-#include "wrapper/kallsyms.h"
 #include "ltt-tracer.h"
 
 static
-int (*wrapper_task_prio_sym)(struct task_struct *t);
-
-int wrapper_task_prio_init(void)
-{
-	wrapper_task_prio_sym = (void *) kallsyms_lookup_funcptr("task_prio");
-	if (!wrapper_task_prio_sym) {
-		printk(KERN_WARNING "LTTng: task_prio symbol lookup failed.\n");
-		return -EINVAL;
-	}
-	return 0;
-}
-
-static
 size_t prio_get_size(size_t offset)
 {
 	size_t size = 0;
@@ -45,7 +31,7 @@ void prio_record(struct lttng_ctx_field *field,
 {
 	int prio;
 
-	prio = wrapper_task_prio_sym(current);
+	prio = task_prio(current);
 	lib_ring_buffer_align_ctx(ctx, ltt_alignof(prio));
 	chan->ops->event_write(ctx, &prio, sizeof(prio));
 }
@@ -53,13 +39,6 @@ void prio_record(struct lttng_ctx_field *field,
 int lttng_add_prio_to_ctx(struct lttng_ctx **ctx)
 {
 	struct lttng_ctx_field *field;
-	int ret;
-
-	if (!wrapper_task_prio_sym) {
-		ret = wrapper_task_prio_init();
-		if (ret)
-			return ret;
-	}
 
 	field = lttng_append_context(ctx);
 	if (!field)
-- 
1.7.5.4




^ permalink raw reply	[flat|nested] 18+ messages in thread

* [lttng-dev] [PATCH 15/15] lttng: remove kallsyms wrapper
  2011-11-30 18:34 [lttng-dev] LTTng wrapper cleanup Mathieu Desnoyers
                   ` (13 preceding siblings ...)
  2011-11-30 18:34 ` [lttng-dev] [PATCH 14/15] lttng: remove task_prio wrapper Mathieu Desnoyers
@ 2011-11-30 18:34 ` Mathieu Desnoyers
  2011-11-30 18:47 ` [lttng-dev] LTTng wrapper cleanup Greg KH
  15 siblings, 0 replies; 18+ messages in thread
From: Mathieu Desnoyers @ 2011-11-30 18:34 UTC (permalink / raw)


LTTng does not need this wrapper anymore, given that all the lookups
that were done with kallsyms are replaced by exported symbols.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers at efficios.com>
---
 drivers/staging/lttng/wrapper/kallsyms.h |   30 ------------------------------
 1 files changed, 0 insertions(+), 30 deletions(-)
 delete mode 100644 drivers/staging/lttng/wrapper/kallsyms.h

diff --git a/drivers/staging/lttng/wrapper/kallsyms.h b/drivers/staging/lttng/wrapper/kallsyms.h
deleted file mode 100644
index a7b8ab1..0000000
--- a/drivers/staging/lttng/wrapper/kallsyms.h
+++ /dev/null
@@ -1,30 +0,0 @@
-#ifndef _LTT_WRAPPER_KALLSYMS_H
-#define _LTT_WRAPPER_KALLSYMS_H
-
-#include <linux/kallsyms.h>
-
-/*
- * Copyright (C) 2011 Avik Sil (avik.sil at linaro.org)
- *
- * wrapper around kallsyms_lookup_name. Implements arch-dependent code for
- * arches where the address of the start of the function body is different
- * from the pointer which can be used to call the function, e.g. ARM THUMB2.
- *
- * Dual LGPL v2.1/GPL v2 license.
- */
-
-static inline
-unsigned long kallsyms_lookup_funcptr(const char *name)
-{
-	unsigned long addr;
-
-	addr = kallsyms_lookup_name(name);
-#ifdef CONFIG_ARM
-#ifdef CONFIG_THUMB2_KERNEL
-	if (addr)
-		addr |= 1; /* set bit 0 in address for thumb mode */
-#endif
-#endif
-	return addr;
-}
-#endif /* _LTT_WRAPPER_KALLSYMS_H */
-- 
1.7.5.4




^ permalink raw reply	[flat|nested] 18+ messages in thread

* [lttng-dev] LTTng wrapper cleanup
  2011-11-30 18:34 [lttng-dev] LTTng wrapper cleanup Mathieu Desnoyers
                   ` (14 preceding siblings ...)
  2011-11-30 18:34 ` [lttng-dev] [PATCH 15/15] lttng: remove kallsyms wrapper Mathieu Desnoyers
@ 2011-11-30 18:47 ` Greg KH
  2011-11-30 19:13   ` Mathieu Desnoyers
  15 siblings, 1 reply; 18+ messages in thread
From: Greg KH @ 2011-11-30 18:47 UTC (permalink / raw)


On Wed, Nov 30, 2011 at 01:34:13PM -0500, Mathieu Desnoyers wrote:
> 
> Hi Greg,
> 
> Here is the cleanup of the LTTng wrappers that used kallsyms to lookup
> some kernel symbols. I introduce the missing symbols in the mainline
> kernel, trying to follow the local exports already in place when it
> comes to choosing between EXPORT_SYMBOL and EXPORT_SYMBOL_GPL. I also
> removed wrappers that deal with API changes across kernel versions (for
> older kernels). Only few wrapper files are left at this point (TODO),
> but those are less repulsive than those that used kallsyms:
> 
> - inline_memcpy.h: ensures that inline_memcpy is declared on all
>   architectures.
> - poll.h: see TODO file, "Features" section.
> - trace-clock.h: see TODO file, "Features" section.
> - ringbuffer: those are internal to the driver. They were there to make
>   it easier to switch between the ringbuffer deployed in my own kernel
>   tree and the module-specific ringbuffer.
> 
> The 3 first patches are small cleanups recommended to me by a static
> checker.
> 
> Diffstat:
> 
>  b/drivers/staging/lttng/lib/ringbuffer/ring_buffer_frontend.c |    6 
>  b/drivers/staging/lttng/lib/ringbuffer/ring_buffer_mmap.c     |    3 
>  drivers/staging/lttng/lib/ringbuffer/ring_buffer_mmap.c       |    3 

Hm, try 'diffstat -p1' next time please, for a cleaner "real" version of
what is going on here.

greg k-h



^ permalink raw reply	[flat|nested] 18+ messages in thread

* [lttng-dev] LTTng wrapper cleanup
  2011-11-30 18:47 ` [lttng-dev] LTTng wrapper cleanup Greg KH
@ 2011-11-30 19:13   ` Mathieu Desnoyers
  0 siblings, 0 replies; 18+ messages in thread
From: Mathieu Desnoyers @ 2011-11-30 19:13 UTC (permalink / raw)


* Greg KH (greg at kroah.com) wrote:
> On Wed, Nov 30, 2011 at 01:34:13PM -0500, Mathieu Desnoyers wrote:
> > 
> > Hi Greg,
> > 
> > Here is the cleanup of the LTTng wrappers that used kallsyms to lookup
> > some kernel symbols. I introduce the missing symbols in the mainline
> > kernel, trying to follow the local exports already in place when it
> > comes to choosing between EXPORT_SYMBOL and EXPORT_SYMBOL_GPL. I also
> > removed wrappers that deal with API changes across kernel versions (for
> > older kernels). Only few wrapper files are left at this point (TODO),
> > but those are less repulsive than those that used kallsyms:
> > 
> > - inline_memcpy.h: ensures that inline_memcpy is declared on all
> >   architectures.
> > - poll.h: see TODO file, "Features" section.
> > - trace-clock.h: see TODO file, "Features" section.
> > - ringbuffer: those are internal to the driver. They were there to make
> >   it easier to switch between the ringbuffer deployed in my own kernel
> >   tree and the module-specific ringbuffer.
> > 
> > The 3 first patches are small cleanups recommended to me by a static
> > checker.
> > 
> > Diffstat:
> > 
> >  b/drivers/staging/lttng/lib/ringbuffer/ring_buffer_frontend.c |    6 
> >  b/drivers/staging/lttng/lib/ringbuffer/ring_buffer_mmap.c     |    3 
> >  drivers/staging/lttng/lib/ringbuffer/ring_buffer_mmap.c       |    3 
> 
> Hm, try 'diffstat -p1' next time please, for a cleaner "real" version of
> what is going on here.

I knew there was something funny with this diff, but you pointed out the
solution. Thanks! Here is the update:

 drivers/staging/lttng/lib/ringbuffer/ring_buffer_frontend.c |    6 
 drivers/staging/lttng/lib/ringbuffer/ring_buffer_mmap.c     |    6 
 drivers/staging/lttng/lib/ringbuffer/ring_buffer_vfs.c      |    3 
 mm/nommu.c                                                  |    1 
 mm/vmalloc.c                                                |    1 
 drivers/staging/lttng/wrapper/kallsyms.h                    |   32 --
 drivers/staging/lttng/lib/ringbuffer/ring_buffer_backend.c  |    3 
 drivers/staging/lttng/ltt-context.c                         |    1 
 drivers/staging/lttng/ltt-debugfs-abi.c                     |    3 
 drivers/staging/lttng/ltt-events.c                          |   14 
 drivers/staging/lttng/ltt-ring-buffer-client.h              |    3 
 drivers/staging/lttng/ltt-ring-buffer-metadata-client.h     |    3 
 drivers/staging/lttng/lttng-context-nice.c                  |    3 
 drivers/staging/lttng/lttng-context-perf-counters.c         |   12 
 drivers/staging/lttng/lttng-context-pid.c                   |    3 
 drivers/staging/lttng/lttng-context-ppid.c                  |    3 
 drivers/staging/lttng/lttng-context-prio.c                  |   26 -
 drivers/staging/lttng/lttng-context-procname.c              |    3 
 drivers/staging/lttng/lttng-context-tid.c                   |    3 
 drivers/staging/lttng/lttng-context-vpid.c                  |    3 
 drivers/staging/lttng/lttng-context-vppid.c                 |    3 
 drivers/staging/lttng/lttng-context-vtid.c                  |    3 
 drivers/staging/lttng/lttng-syscalls.c                      |    2 
 drivers/staging/lttng/probes/lttng-events.h                 |    3 
 drivers/staging/lttng/probes/lttng-ftrace.c                 |  192 ------------
 drivers/staging/lttng/probes/lttng-kprobes.c                |    3 
 drivers/staging/lttng/probes/lttng-kretprobes.c             |    3 
 drivers/staging/lttng/probes/lttng-types.c                  |    3 
 drivers/staging/lttng/wrapper/vmalloc.h                     |   49 ---
 fs/splice.c                                                 |    1 
 drivers/staging/lttng/lib/Makefile                          |    3 
 drivers/staging/lttng/lib/ringbuffer/ring_buffer_splice.c   |    3 
 drivers/staging/lttng/wrapper/splice.c                      |   46 --
 drivers/staging/lttng/wrapper/splice.h                      |   23 -
 drivers/staging/lttng/wrapper/perf.h                        |   32 --
 drivers/staging/lttng/README                                |    4 
 drivers/staging/lttng/probes/Makefile                       |    4 
 drivers/staging/lttng/wrapper/ftrace.h                      |   70 ----
 drivers/staging/lttng/lib/ringbuffer/frontend_types.h       |    1 
 drivers/staging/lttng/wrapper/spinlock.h                    |   26 -
 drivers/staging/lttng/ltt-events.h                          |    3 
 drivers/staging/lttng/wrapper/uuid.h                        |   29 -
 kernel/sched.c                                              |    1 
 43 files changed, 44 insertions(+), 595 deletions(-)


-- 
Mathieu Desnoyers
Operating System Efficiency R&D Consultant
EfficiOS Inc.
http://www.efficios.com



^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2011-11-30 19:13 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-11-30 18:34 [lttng-dev] LTTng wrapper cleanup Mathieu Desnoyers
2011-11-30 18:34 ` [lttng-dev] [PATCH 01/15] lttng lib: ring buffer: remove stale null-pointer Mathieu Desnoyers
2011-11-30 18:34 ` [lttng-dev] [PATCH 02/15] lttng lib: ring buffer remove duplicate null pointer Mathieu Desnoyers
2011-11-30 18:34 ` [lttng-dev] [PATCH 03/15] lttng lib: ring buffer move null pointer check to open Mathieu Desnoyers
2011-11-30 18:34 ` [lttng-dev] [PATCH 04/15] Export vmalloc_sync_all symbol to GPL modules Mathieu Desnoyers
2011-11-30 18:34 ` [lttng-dev] [PATCH 05/15] lttng wrapper: add missing include to kallsyms wrapper Mathieu Desnoyers
2011-11-30 18:34 ` [lttng-dev] [PATCH 06/15] Remove LTTng vmalloc_sync_all wrapper Mathieu Desnoyers
2011-11-30 18:34 ` [lttng-dev] [PATCH 07/15] fs/splice: export splice_to_pipe to modules Mathieu Desnoyers
2011-11-30 18:34 ` [lttng-dev] [PATCH 08/15] lttng: remove splice_to_pipe wrapper Mathieu Desnoyers
2011-11-30 18:34 ` [lttng-dev] [PATCH 09/15] lttng: remove perf_event_create_kernel_counter wrapper Mathieu Desnoyers
2011-11-30 18:34 ` [lttng-dev] [PATCH 10/15] lttng: remove ftrace function tracer support (but keep Mathieu Desnoyers
2011-11-30 18:34 ` [lttng-dev] [PATCH 11/15] lttng: remove raw spinlock wrapper Mathieu Desnoyers
2011-11-30 18:34 ` [lttng-dev] [PATCH 12/15] lttng: remove uuid wrapper Mathieu Desnoyers
2011-11-30 18:34 ` [lttng-dev] [PATCH 13/15] Export task_prio to modules Mathieu Desnoyers
2011-11-30 18:34 ` [lttng-dev] [PATCH 14/15] lttng: remove task_prio wrapper Mathieu Desnoyers
2011-11-30 18:34 ` [lttng-dev] [PATCH 15/15] lttng: remove kallsyms wrapper Mathieu Desnoyers
2011-11-30 18:47 ` [lttng-dev] LTTng wrapper cleanup Greg KH
2011-11-30 19:13   ` Mathieu Desnoyers

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox