diff options
author | Ard Biesheuvel <ard.biesheuvel@linaro.org> | 2018-08-22 00:56:22 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2018-08-22 13:52:47 -0400 |
commit | 46e0c9be206fa7b11aca75da2d6b8535d0139752 (patch) | |
tree | deafa098d7949523aa07a71ff1149062fe09eace /include/linux/tracepoint.h | |
parent | c9d8b55fa0191623fccb9ed67d2ff8f9159e9a89 (diff) |
kernel: tracepoints: add support for relative references
To avoid the need for relocating absolute references to tracepoint
structures at boot time when running relocatable kernels (which may
take a disproportionate amount of space), add the option to emit
these tables as relative references instead.
Link: http://lkml.kernel.org/r/20180704083651.24360-7-ard.biesheuvel@linaro.org
Acked-by: Michael Ellerman <mpe@ellerman.id.au>
Acked-by: Ingo Molnar <mingo@kernel.org>
Acked-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Bjorn Helgaas <bhelgaas@google.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: James Morris <james.morris@microsoft.com>
Cc: James Morris <jmorris@namei.org>
Cc: Jessica Yu <jeyu@kernel.org>
Cc: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: Kees Cook <keescook@chromium.org>
Cc: Nicolas Pitre <nico@linaro.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Petr Mladek <pmladek@suse.com>
Cc: Russell King <linux@armlinux.org.uk>
Cc: "Serge E. Hallyn" <serge@hallyn.com>
Cc: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Cc: Thomas Garnier <thgarnie@google.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Will Deacon <will.deacon@arm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include/linux/tracepoint.h')
-rw-r--r-- | include/linux/tracepoint.h | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/include/linux/tracepoint.h b/include/linux/tracepoint.h index d9a084c72541..7f2e16e76ac4 100644 --- a/include/linux/tracepoint.h +++ b/include/linux/tracepoint.h | |||
@@ -249,6 +249,19 @@ extern void syscall_unregfunc(void); | |||
249 | return static_key_false(&__tracepoint_##name.key); \ | 249 | return static_key_false(&__tracepoint_##name.key); \ |
250 | } | 250 | } |
251 | 251 | ||
252 | #ifdef CONFIG_HAVE_ARCH_PREL32_RELOCATIONS | ||
253 | #define __TRACEPOINT_ENTRY(name) \ | ||
254 | asm(" .section \"__tracepoints_ptrs\", \"a\" \n" \ | ||
255 | " .balign 4 \n" \ | ||
256 | " .long __tracepoint_" #name " - . \n" \ | ||
257 | " .previous \n") | ||
258 | #else | ||
259 | #define __TRACEPOINT_ENTRY(name) \ | ||
260 | static struct tracepoint * const __tracepoint_ptr_##name __used \ | ||
261 | __attribute__((section("__tracepoints_ptrs"))) = \ | ||
262 | &__tracepoint_##name | ||
263 | #endif | ||
264 | |||
252 | /* | 265 | /* |
253 | * We have no guarantee that gcc and the linker won't up-align the tracepoint | 266 | * We have no guarantee that gcc and the linker won't up-align the tracepoint |
254 | * structures, so we create an array of pointers that will be used for iteration | 267 | * structures, so we create an array of pointers that will be used for iteration |
@@ -258,11 +271,9 @@ extern void syscall_unregfunc(void); | |||
258 | static const char __tpstrtab_##name[] \ | 271 | static const char __tpstrtab_##name[] \ |
259 | __attribute__((section("__tracepoints_strings"))) = #name; \ | 272 | __attribute__((section("__tracepoints_strings"))) = #name; \ |
260 | struct tracepoint __tracepoint_##name \ | 273 | struct tracepoint __tracepoint_##name \ |
261 | __attribute__((section("__tracepoints"))) = \ | 274 | __attribute__((section("__tracepoints"), used)) = \ |
262 | { __tpstrtab_##name, STATIC_KEY_INIT_FALSE, reg, unreg, NULL };\ | 275 | { __tpstrtab_##name, STATIC_KEY_INIT_FALSE, reg, unreg, NULL };\ |
263 | static struct tracepoint * const __tracepoint_ptr_##name __used \ | 276 | __TRACEPOINT_ENTRY(name); |
264 | __attribute__((section("__tracepoints_ptrs"))) = \ | ||
265 | &__tracepoint_##name; | ||
266 | 277 | ||
267 | #define DEFINE_TRACE(name) \ | 278 | #define DEFINE_TRACE(name) \ |
268 | DEFINE_TRACE_FN(name, NULL, NULL); | 279 | DEFINE_TRACE_FN(name, NULL, NULL); |