From: Mathieu Desnoyers Date: Mon, 13 Apr 2020 16:39:24 +0000 (-0400) Subject: wrapper: remove tracepoint wrapper X-Git-Tag: for-upstreaming-review-1~97 X-Git-Url: http://git.liburcu.org/?p=lttng-modules.git;a=commitdiff_plain;h=0d260d3d3e28849772a060a9b1374712c0959fca wrapper: remove tracepoint wrapper --- diff --git a/lttng-events.c b/lttng-events.c index 61439ec7..c16cff80 100644 --- a/lttng-events.c +++ b/lttng-events.c @@ -31,7 +31,6 @@ #include #include -#include #include #include #include @@ -40,6 +39,7 @@ #include #include #include +#include #include #include @@ -822,9 +822,9 @@ void register_event(struct lttng_event *event) desc = event->desc; switch (event->instrumentation) { case LTTNG_KERNEL_TRACEPOINT: - ret = lttng_wrapper_tracepoint_probe_register(desc->kname, - desc->probe_callback, - event); + ret = lttng_tracepoint_probe_register(desc->kname, + desc->probe_callback, + event); break; case LTTNG_KERNEL_SYSCALL: ret = lttng_syscall_filter_enable(event->chan, @@ -858,7 +858,7 @@ int _lttng_event_unregister(struct lttng_event *event) desc = event->desc; switch (event->instrumentation) { case LTTNG_KERNEL_TRACEPOINT: - ret = lttng_wrapper_tracepoint_probe_unregister(event->desc->kname, + ret = lttng_tracepoint_probe_unregister(event->desc->kname, event->desc->probe_callback, event); break; @@ -2937,9 +2937,6 @@ static int __init lttng_events_init(void) { int ret; - ret = wrapper_lttng_fixup_sig(THIS_MODULE); - if (ret) - return ret; ret = wrapper_get_pfnblock_flags_mask_init(); if (ret) return ret; diff --git a/lttng-statedump-impl.c b/lttng-statedump-impl.c index ebe76556..eefc0b8f 100644 --- a/lttng-statedump-impl.c +++ b/lttng-statedump-impl.c @@ -38,7 +38,6 @@ #include #include #include -#include #include #include @@ -615,13 +614,6 @@ EXPORT_SYMBOL_GPL(lttng_statedump_start); static int __init lttng_statedump_init(void) { - /* - * Allow module to load even if the fixup cannot be done. This - * will allow seemless transition when the underlying issue fix - * is merged into the Linux kernel, and when tracepoint.c - * "tracepoint_module_notify" is turned into a static function. - */ - (void) wrapper_lttng_fixup_sig(THIS_MODULE); return 0; } diff --git a/lttng-syscalls.c b/lttng-syscalls.c index 3d2025eb..e1f18098 100644 --- a/lttng-syscalls.c +++ b/lttng-syscalls.c @@ -23,11 +23,11 @@ #include #include -#include #include #include #include #include +#include "lttng-tracepoint.h" #ifndef CONFIG_COMPAT # ifndef is_compat_task @@ -883,7 +883,7 @@ int lttng_syscalls_register(struct lttng_channel *chan, void *filter) return ret; #endif if (!chan->sys_enter_registered) { - ret = lttng_wrapper_tracepoint_probe_register("sys_enter", + ret = lttng_tracepoint_probe_register("sys_enter", (void *) syscall_entry_probe, chan); if (ret) return ret; @@ -894,10 +894,10 @@ int lttng_syscalls_register(struct lttng_channel *chan, void *filter) * conflict with sys_exit syscall entry. */ if (!chan->sys_exit_registered) { - ret = lttng_wrapper_tracepoint_probe_register("sys_exit", + ret = lttng_tracepoint_probe_register("sys_exit", (void *) syscall_exit_probe, chan); if (ret) { - WARN_ON_ONCE(lttng_wrapper_tracepoint_probe_unregister("sys_enter", + WARN_ON_ONCE(lttng_tracepoint_probe_unregister("sys_enter", (void *) syscall_entry_probe, chan)); return ret; } @@ -916,14 +916,14 @@ int lttng_syscalls_unregister(struct lttng_channel *chan) if (!chan->sc_table) return 0; if (chan->sys_enter_registered) { - ret = lttng_wrapper_tracepoint_probe_unregister("sys_enter", + ret = lttng_tracepoint_probe_unregister("sys_enter", (void *) syscall_entry_probe, chan); if (ret) return ret; chan->sys_enter_registered = 0; } if (chan->sys_exit_registered) { - ret = lttng_wrapper_tracepoint_probe_unregister("sys_exit", + ret = lttng_tracepoint_probe_unregister("sys_exit", (void *) syscall_exit_probe, chan); if (ret) return ret; diff --git a/lttng-tracepoint.c b/lttng-tracepoint.c index 42bae9ae..a01cbc40 100644 --- a/lttng-tracepoint.c +++ b/lttng-tracepoint.c @@ -17,7 +17,6 @@ #include #include -#include /* * Protect the tracepoint table. lttng_tracepoint_mutex nests within @@ -229,7 +228,7 @@ int lttng_tracepoint_coming(struct tp_module *tp_mod) struct tracepoint_entry *e; struct lttng_tp_probe *p; - tp = lttng_tracepoint_ptr_deref(&tp_mod->mod->tracepoints_ptrs[i]); + tp = tracepoint_ptr_deref(&tp_mod->mod->tracepoints_ptrs[i]); e = get_tracepoint(tp->name); if (!e) { e = add_tracepoint(tp->name); @@ -270,7 +269,7 @@ int lttng_tracepoint_going(struct tp_module *tp_mod) struct tracepoint_entry *e; struct lttng_tp_probe *p; - tp = lttng_tracepoint_ptr_deref(&tp_mod->mod->tracepoints_ptrs[i]); + tp = tracepoint_ptr_deref(&tp_mod->mod->tracepoints_ptrs[i]); e = get_tracepoint(tp->name); if (!e || !e->tp) continue; diff --git a/lttng-tracker-id.c b/lttng-tracker-id.c index 2248acd6..55d8cef1 100644 --- a/lttng-tracker-id.c +++ b/lttng-tracker-id.c @@ -15,7 +15,6 @@ #include #include -#include #include #include #include diff --git a/probes/lttng-probe-block.c b/probes/lttng-probe-block.c index 1838491b..f6e9aa94 100644 --- a/probes/lttng-probe-block.c +++ b/probes/lttng-probe-block.c @@ -18,7 +18,7 @@ */ #include -#include +#include "lttng-tracepoint.h" /* * Create LTTng tracepoint probes. diff --git a/probes/lttng-probe-ext4.c b/probes/lttng-probe-ext4.c index 7b6f02e4..a8f1795b 100644 --- a/probes/lttng-probe-ext4.c +++ b/probes/lttng-probe-ext4.c @@ -23,7 +23,7 @@ #include #include -#include +#include "lttng-tracepoint.h" /* * Create LTTng tracepoint probes. diff --git a/probes/lttng-probe-irq.c b/probes/lttng-probe-irq.c index 7f95fd61..15b029dd 100644 --- a/probes/lttng-probe-irq.c +++ b/probes/lttng-probe-irq.c @@ -17,7 +17,7 @@ */ #include -#include +#include "lttng-tracepoint.h" /* * Create LTTng tracepoint probes. diff --git a/probes/lttng-probe-jbd2.c b/probes/lttng-probe-jbd2.c index 4688279a..095043c4 100644 --- a/probes/lttng-probe-jbd2.c +++ b/probes/lttng-probe-jbd2.c @@ -17,7 +17,7 @@ */ #include -#include +#include "lttng-tracepoint.h" /* * Create LTTng tracepoint probes. diff --git a/probes/lttng-probe-kmem.c b/probes/lttng-probe-kmem.c index 9573018f..afd418d9 100644 --- a/probes/lttng-probe-kmem.c +++ b/probes/lttng-probe-kmem.c @@ -23,7 +23,7 @@ */ #include -#include +#include "lttng-tracepoint.h" /* * Create LTTng tracepoint probes. diff --git a/probes/lttng-probe-kvm-x86-mmu.c b/probes/lttng-probe-kvm-x86-mmu.c index 03e9929f..d8cc5e5e 100644 --- a/probes/lttng-probe-kvm-x86-mmu.c +++ b/probes/lttng-probe-kvm-x86-mmu.c @@ -22,7 +22,7 @@ * Create the tracepoint static inlines from the kernel to validate that our * trace event macros match the kernel we run on. */ -#include +#include "lttng-tracepoint.h" #include <../../arch/x86/kvm/mmutrace.h> diff --git a/probes/lttng-probe-kvm-x86.c b/probes/lttng-probe-kvm-x86.c index a2f3ec69..b7704076 100644 --- a/probes/lttng-probe-kvm-x86.c +++ b/probes/lttng-probe-kvm-x86.c @@ -29,7 +29,7 @@ */ #include -#include +#include "lttng-tracepoint.h" /* * Create LTTng tracepoint probes. diff --git a/probes/lttng-probe-kvm.c b/probes/lttng-probe-kvm.c index 38603d80..4c6d04c1 100644 --- a/probes/lttng-probe-kvm.c +++ b/probes/lttng-probe-kvm.c @@ -17,7 +17,7 @@ */ #include -#include +#include "lttng-tracepoint.h" /* * Create LTTng tracepoint probes. diff --git a/probes/lttng-probe-lock.c b/probes/lttng-probe-lock.c index 12e0194b..3d0a68d6 100644 --- a/probes/lttng-probe-lock.c +++ b/probes/lttng-probe-lock.c @@ -17,7 +17,7 @@ * trace event macros match the kernel we run on. */ #include -#include +#include "lttng-tracepoint.h" /* * Create LTTng tracepoint probes. diff --git a/probes/lttng-probe-module.c b/probes/lttng-probe-module.c index b422e0e8..e99ee482 100644 --- a/probes/lttng-probe-module.c +++ b/probes/lttng-probe-module.c @@ -17,7 +17,7 @@ */ #include -#include +#include "lttng-tracepoint.h" /* * Create LTTng tracepoint probes. diff --git a/probes/lttng-probe-napi.c b/probes/lttng-probe-napi.c index c0c20852..c53003bd 100644 --- a/probes/lttng-probe-napi.c +++ b/probes/lttng-probe-napi.c @@ -17,7 +17,7 @@ */ #include -#include +#include "lttng-tracepoint.h" /* * Create LTTng tracepoint probes. diff --git a/probes/lttng-probe-power.c b/probes/lttng-probe-power.c index 8d806b81..6133e52f 100644 --- a/probes/lttng-probe-power.c +++ b/probes/lttng-probe-power.c @@ -17,7 +17,7 @@ */ #include -#include +#include "lttng-tracepoint.h" /* * Create LTTng tracepoint probes. diff --git a/probes/lttng-probe-sched.c b/probes/lttng-probe-sched.c index 577cb408..495374d8 100644 --- a/probes/lttng-probe-sched.c +++ b/probes/lttng-probe-sched.c @@ -16,7 +16,7 @@ */ #include -#include +#include "lttng-tracepoint.h" /* * Create LTTng tracepoint probes. diff --git a/probes/lttng-probe-skb.c b/probes/lttng-probe-skb.c index d8d88f26..ec0469ab 100644 --- a/probes/lttng-probe-skb.c +++ b/probes/lttng-probe-skb.c @@ -17,7 +17,7 @@ */ #include -#include +#include "lttng-tracepoint.h" /* * Create LTTng tracepoint probes. diff --git a/probes/lttng-probe-timer.c b/probes/lttng-probe-timer.c index 60e5a0f2..ef036a64 100644 --- a/probes/lttng-probe-timer.c +++ b/probes/lttng-probe-timer.c @@ -18,7 +18,7 @@ #include #include -#include +#include "lttng-tracepoint.h" /* * Create LTTng tracepoint probes. diff --git a/probes/lttng-probe-workqueue.c b/probes/lttng-probe-workqueue.c index 6a365300..66b19f74 100644 --- a/probes/lttng-probe-workqueue.c +++ b/probes/lttng-probe-workqueue.c @@ -21,7 +21,7 @@ struct pool_workqueue; */ #include -#include +#include "lttng-tracepoint.h" /* * Create LTTng tracepoint probes. diff --git a/probes/lttng-probe-x86-exceptions.c b/probes/lttng-probe-x86-exceptions.c index 5428798f..92603b95 100644 --- a/probes/lttng-probe-x86-exceptions.c +++ b/probes/lttng-probe-x86-exceptions.c @@ -16,7 +16,7 @@ */ #include -#include +#include "lttng-tracepoint.h" #undef TRACE_INCLUDE_PATH #undef TRACE_INCLUDE_FILE diff --git a/probes/lttng-probe-x86-irq-vectors.c b/probes/lttng-probe-x86-irq-vectors.c index 3c760c1c..a7c8c2a0 100644 --- a/probes/lttng-probe-x86-irq-vectors.c +++ b/probes/lttng-probe-x86-irq-vectors.c @@ -16,7 +16,7 @@ */ #include -#include +#include "lttng-tracepoint.h" #undef TRACE_INCLUDE_PATH #undef TRACE_INCLUDE_FILE diff --git a/tests/probes/lttng-test.c b/tests/probes/lttng-test.c index 2219f86d..97677714 100644 --- a/tests/probes/lttng-test.c +++ b/tests/probes/lttng-test.c @@ -15,7 +15,6 @@ #include #include -#include #define TP_MODULE_NOAUTOLOAD #define LTTNG_PACKAGE_BUILD @@ -96,7 +95,6 @@ int __init lttng_test_init(void) { int ret = 0; - (void) wrapper_lttng_fixup_sig(THIS_MODULE); lttng_test_filter_event_dentry = proc_create_data(LTTNG_TEST_FILTER_EVENT_FILE, S_IRUGO | S_IWUGO, NULL, diff --git a/wrapper/tracepoint.h b/wrapper/tracepoint.h deleted file mode 100644 index 7b319060..00000000 --- a/wrapper/tracepoint.h +++ /dev/null @@ -1,116 +0,0 @@ -/* SPDX-License-Identifier: (GPL-2.0-only or LGPL-2.1-only) - * - * wrapper/tracepoint.h - * - * wrapper around DECLARE_EVENT_CLASS. - * - * Copyright (C) 2011-2012 Mathieu Desnoyers - */ - -#ifndef _LTTNG_WRAPPER_TRACEPOINT_H -#define _LTTNG_WRAPPER_TRACEPOINT_H - -#include -#include -#include - -#ifndef HAVE_KABI_2635_TRACEPOINT - -#define kabi_2635_tracepoint_probe_register tracepoint_probe_register -#define kabi_2635_tracepoint_probe_unregister tracepoint_probe_unregister - -#endif /* HAVE_KABI_2635_TRACEPOINT */ - -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,15,0)) - -#include - -#define lttng_wrapper_tracepoint_probe_register lttng_tracepoint_probe_register -#define lttng_wrapper_tracepoint_probe_unregister lttng_tracepoint_probe_unregister - -#else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,15,0)) */ - -#define lttng_wrapper_tracepoint_probe_register kabi_2635_tracepoint_probe_register -#define lttng_wrapper_tracepoint_probe_unregister kabi_2635_tracepoint_probe_unregister - -static inline -int lttng_tracepoint_init(void) -{ - return 0; -} - -static inline -void lttng_tracepoint_exit(void) -{ -} - -#endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,15,0)) */ - -#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,15,0) && defined(CONFIG_MODULE_SIG)) - -#include -#include - -static inline -int wrapper_tracepoint_module_notify(struct notifier_block *nb, - unsigned long val, struct module *mod) -{ - int (*tracepoint_module_notify_sym)(struct notifier_block *nb, - unsigned long val, struct module *mod); - - tracepoint_module_notify_sym = - (void *) kallsyms_lookup_funcptr("tracepoint_module_notify"); - if (tracepoint_module_notify_sym) { - return tracepoint_module_notify_sym(nb, val, mod); - } else { - printk_once(KERN_WARNING "LTTng: tracepoint_module_notify symbol lookup failed. It probably means you kernel don't need this work-around. Please consider upgrading LTTng modules to make this warning go away.\n"); - return -ENOSYS; - } -} - -#endif /* #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,15,0) && defined(CONFIG_MODULE_SIG)) */ - -#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,15,0) && defined(CONFIG_MODULE_SIG) && defined(MODULE)) - -static inline -int wrapper_lttng_fixup_sig(struct module *mod) -{ - int ret = 0; - - /* - * This is for module.c confusing force loaded modules with - * unsigned modules. - */ - if (!THIS_MODULE->sig_ok && - THIS_MODULE->taints & (1U << TAINT_FORCED_MODULE)) { - THIS_MODULE->taints &= ~(1U << TAINT_FORCED_MODULE); - ret = wrapper_tracepoint_module_notify(NULL, - MODULE_STATE_COMING, mod); - THIS_MODULE->taints |= (1U << TAINT_FORCED_MODULE); - } - return ret; -} - -#else /* #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,15,0) && defined(CONFIG_MODULE_SIG) && defined(MODULE)) */ - -static inline -int wrapper_lttng_fixup_sig(struct module *mod) -{ - return 0; -} - -#endif /* #else #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,15,0) && defined(CONFIG_MODULE_SIG) && defined(MODULE)) */ - -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,19,0)) -static inline struct tracepoint *lttng_tracepoint_ptr_deref(tracepoint_ptr_t *p) -{ - return tracepoint_ptr_deref(p); -} -#else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,19,0)) */ -static inline struct tracepoint *lttng_tracepoint_ptr_deref(struct tracepoint * const *p) -{ - return *p; -} -#endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,19,0)) */ - -#endif /* _LTTNG_WRAPPER_TRACEPOINT_H */