Remove dependency on vmalloc_sync_all symbol
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Wed, 11 May 2011 13:24:54 +0000 (09:24 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Wed, 11 May 2011 13:24:54 +0000 (09:24 -0400)
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
lib/ringbuffer/ring_buffer_backend.c
ltt-debugfs-abi.c
ltt-events.c
ltt-ring-buffer-client.h
probes/lttng-events.h
probes/lttng-types.c
wrapper/symbols.h [new file with mode: 0644]

index f9ec3d1e2327b3f16e79f1c8e0c47e576b495e38..2d272c773ef57e670d105268b715f59b953fa8bf 100644 (file)
@@ -6,7 +6,6 @@
  * Dual LGPL v2.1/GPL v2 license.
  */
 
-#include <linux/vmalloc.h>
 #include <linux/stddef.h>
 #include <linux/module.h>
 #include <linux/string.h>
@@ -17,6 +16,7 @@
 #include <linux/cpu.h>
 #include <linux/mm.h>
 
+#include "../../wrapper/symbols.h"     /* for wrapper_vmalloc_sync_all() */
 #include "../../wrapper/ringbuffer/config.h"
 #include "../../wrapper/ringbuffer/backend.h"
 #include "../../wrapper/ringbuffer/frontend.h"
@@ -131,7 +131,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.
         */
-       vmalloc_sync_all();
+       wrapper_vmalloc_sync_all();
        kfree(virt);
        kfree(pages);
        return 0;
index 2f200ed143e73ae2bad5e364d5c98023f8f72a25..4319ef3fbac635f38279f8b21d86ce2c167b1680 100644 (file)
@@ -28,7 +28,7 @@
 #include <linux/file.h>
 #include <linux/uaccess.h>
 #include <linux/slab.h>
-#include <linux/vmalloc.h>     /* For vmalloc_sync_all */
+#include "wrapper/symbols.h"   /* for wrapper_vmalloc_sync_all() */
 #include "wrapper/ringbuffer/vfs.h"
 #include "ltt-debugfs-abi.h"
 #include "ltt-events.h"
@@ -538,7 +538,7 @@ int __init ltt_debugfs_abi_init(void)
 {
        int ret = 0;
 
-       vmalloc_sync_all();
+       wrapper_vmalloc_sync_all();
        lttng_dentry = debugfs_create_file("lttng", S_IWUSR, NULL, NULL,
                                           &lttng_fops);
        if (IS_ERR(lttng_dentry) || !lttng_dentry) {
index 93638cd8caa99c5fa08b4ab7c070b57de08cce5a..9eb2c2f2ef838998e7eedb3fee14f0dddc7b9aa2 100644 (file)
@@ -11,7 +11,7 @@
 #include <linux/mutex.h>
 #include <linux/sched.h>
 #include <linux/slab.h>
-#include <linux/vmalloc.h>     /* For vmalloc_sync_all */
+#include "wrapper/symbols.h"   /* for wrapper_vmalloc_sync_all() */
 #include "ltt-events.h"
 
 static LIST_HEAD(sessions);
@@ -269,7 +269,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.
         */
-       vmalloc_sync_all();
+       wrapper_vmalloc_sync_all();
 
        mutex_lock(&sessions_mutex);
        list_add_tail(&transport->node, &ltt_transport_list);
index e889c571a5e81f4faba1490c92950fd05074b55b..00cac1608a341c980a89939e230d88d5f6461a89 100644 (file)
@@ -10,7 +10,7 @@
 
 #include <linux/module.h>
 #include <linux/types.h>
-#include <linux/vmalloc.h>     /* for vmalloc_sync_all */
+#include "wrapper/symbols.h"   /* for wrapper_vmalloc_sync_all() */
 #include "wrapper/trace-clock.h"
 #include "ltt-events.h"
 #include "ltt-tracer.h"
@@ -203,7 +203,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.
         */
-       vmalloc_sync_all();
+       wrapper_vmalloc_sync_all();
        printk(KERN_INFO "LTT : ltt ring buffer client init\n");
        ltt_transport_register(&ltt_relay_transport);
        return 0;
index 38c61cd85dfb8ffd2057c756f8d9597be7658ac2..f697eadc1897d025a16e60b232b317a0f5bc778b 100644 (file)
@@ -1,7 +1,7 @@
 #include <lttng.h>
 #include <lttng-types.h>
 #include <linux/debugfs.h>
-#include <linux/vmalloc.h>     /* for vmalloc_sync_all() */
+#include "../wrapper/symbols.h"        /* for wrapper_vmalloc_sync_all() */
 #include "../wrapper/ringbuffer/frontend_types.h"
 #include "../ltt-events.h"
 #include "../ltt-tracer-core.h"
@@ -573,7 +573,7 @@ static int TP_ID(__lttng_events_init__, TRACE_SYSTEM)(void)
        int ret;
        int i;
 
-       vmalloc_sync_all();
+       wrapper_vmalloc_sync_all();
        ret = TP_ID(__lttng_types_init__, TRACE_SYSTEM)();
        if (ret)
                return ret;
index a4b40cf720b604466b03794dbc5c93f0ddc90dbe..7f9d20e5fd64cad8c04f2206c688996a32c1daa4 100644 (file)
@@ -11,7 +11,7 @@
 #include <linux/seq_file.h>
 #include <linux/jbd.h> /* tid_t */
 #include <linux/debugfs.h>
-#include <linux/vmalloc.h>     /* for vmalloc_sync_all */
+#include "../wrapper/symbols.h"        /* for wrapper_vmalloc_sync_all() */
 #include "lttng-types.h"
 
 struct dentry *lttng_types_dentry;
@@ -186,7 +186,7 @@ static int lttng_types_init(void)
 {
        int ret = 0;
 
-       vmalloc_sync_all();
+       wrapper_vmalloc_sync_all();
        lttng_types_dentry = debugfs_create_file("lttng-types", S_IWUSR,
                                        NULL, NULL, &lttng_types_fops);
        if (IS_ERR(lttng_types_dentry) || !lttng_types_dentry) {
diff --git a/wrapper/symbols.h b/wrapper/symbols.h
new file mode 100644 (file)
index 0000000..523f553
--- /dev/null
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2011 Mathieu Desnoyers (mathieu.desnoyers@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>
+
+static inline
+void wrapper_vmalloc_sync_all(void)
+{
+       void (*vmalloc_sync_all_sym)(void);
+
+       vmalloc_sync_all_sym = (void *) kallsyms_lookup_name("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
This page took 0.036263 seconds and 4 git commands to generate.