[PATCH] tracing: Export key trace event symbols

From: Ron Rechenmacher
Date: Mon Apr 20 2015 - 17:43:57 EST


If symbols are not exported, modules can no longer register additional
(module specified) tracepoints like they use to be able to (i.e linux-3.15.x).
Somewhere on or about commit de7b2973903c6cc50b31ee5682a69b2219b9919d
(Author: Mathieu Desnoyers <mathieu.desnoyers@xxxxxxxxxxxx>
Date: Tue Apr 8 17:26:21 2014 -0400
tracepoint: Use struct pointer instead of name hash for reg/unreg tracepoints)
modules which attempted to register additional tracing functions would
get "Unknown symbol" errors. For example: "... Unknown symbol
__tracepoint_sched_switch (err 0)"
Symbols can be exported using the kernel's EXPORT_TRACEPOINT_SYMBOL_GPL macro
to allow modules to once again register their own tracing functions (for at
least some key points in the kernel as provided by this patch).

Signed-off-by: Ron Rechenmacher <ron@xxxxxxxx>
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=96051
---
kernel/irq/handle.c | 6 ++++++
kernel/softirq.c | 6 ++++++
kernel/trace/trace_sched_switch.c | 5 +++++
kernel/trace/trace_syscalls.c | 6 ++++++
4 files changed, 23 insertions(+), 0 deletions(-)

diff --git a/kernel/irq/handle.c b/kernel/irq/handle.c
index 470d08c..a98d763 100644
--- a/kernel/irq/handle.c
+++ b/kernel/irq/handle.c
@@ -20,6 +20,12 @@

#include "internals.h"

+/*
+ * Allow modules to register additional trace routines
+ */
+EXPORT_TRACEPOINT_SYMBOL_GPL(irq_handler_entry);
+EXPORT_TRACEPOINT_SYMBOL_GPL(irq_handler_exit);
+
/**
* handle_bad_irq - handle spurious and unhandled irqs
* @irq: the interrupt number
diff --git a/kernel/softirq.c b/kernel/softirq.c
index fca82c3..af6fa2e 100644
--- a/kernel/softirq.c
+++ b/kernel/softirq.c
@@ -52,6 +52,12 @@ irq_cpustat_t irq_stat[NR_CPUS] ____cacheline_aligned;
EXPORT_SYMBOL(irq_stat);
#endif

+/*
+ * Allow modules to register additional trace routines
+ */
+EXPORT_TRACEPOINT_SYMBOL_GPL(softirq_entry);
+EXPORT_TRACEPOINT_SYMBOL_GPL(softirq_exit);
+
static struct softirq_action softirq_vec[NR_SOFTIRQS] __cacheline_aligned_in_smp;

DEFINE_PER_CPU(struct task_struct *, ksoftirqd);
diff --git a/kernel/trace/trace_sched_switch.c b/kernel/trace/trace_sched_switch.c
index 7e62c0a..2ea1a6a 100644
--- a/kernel/trace/trace_sched_switch.c
+++ b/kernel/trace/trace_sched_switch.c
@@ -14,6 +14,11 @@

#include "trace.h"

+/*
+ * Allow modules to register additional trace routines
+ */
+EXPORT_TRACEPOINT_SYMBOL_GPL(sched_switch);
+
static struct trace_array *ctx_trace;
static int __read_mostly tracer_enabled;
static int sched_ref;
diff --git a/kernel/trace/trace_syscalls.c b/kernel/trace/trace_syscalls.c
index ee7b5a0..6c3bbd0 100644
--- a/kernel/trace/trace_syscalls.c
+++ b/kernel/trace/trace_syscalls.c
@@ -9,6 +9,12 @@
#include "trace_output.h"
#include "trace.h"

+/*
+ * Allow modules to register additional trace routines
+ */
+EXPORT_TRACEPOINT_SYMBOL_GPL(sys_enter);
+EXPORT_TRACEPOINT_SYMBOL_GPL(sys_exit);
+
static DEFINE_MUTEX(syscall_trace_lock);
static int sys_refcount_enter;
static int sys_refcount_exit;
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/