Commit | Line | Data |
---|---|---|
a90917c3 MD |
1 | #ifndef _LTTNG_WRAPPER_VMALLOC_H |
2 | #define _LTTNG_WRAPPER_VMALLOC_H | |
b13f3ebe | 3 | |
6d2a620c MD |
4 | /* |
5 | * Copyright (C) 2011 Mathieu Desnoyers (mathieu.desnoyers@efficios.com) | |
6 | * | |
7 | * wrapper around vmalloc_sync_all. Using KALLSYMS to get its address when | |
8 | * available, else we need to have a kernel that exports this function to GPL | |
9 | * modules. | |
10 | * | |
11 | * Dual LGPL v2.1/GPL v2 license. | |
12 | */ | |
13 | ||
14 | #ifdef CONFIG_KALLSYMS | |
15 | ||
16 | #include <linux/kallsyms.h> | |
c539a324 | 17 | #include "kallsyms.h" |
6d2a620c MD |
18 | |
19 | static inline | |
20 | void wrapper_vmalloc_sync_all(void) | |
21 | { | |
22 | void (*vmalloc_sync_all_sym)(void); | |
23 | ||
c539a324 | 24 | vmalloc_sync_all_sym = (void *) kallsyms_lookup_funcptr("vmalloc_sync_all"); |
6d2a620c MD |
25 | if (vmalloc_sync_all_sym) { |
26 | vmalloc_sync_all_sym(); | |
27 | } else { | |
28 | #ifdef CONFIG_X86 | |
29 | /* | |
30 | * Only x86 needs vmalloc_sync_all to make sure LTTng does not | |
31 | * trigger recursive page faults. | |
32 | */ | |
33 | printk(KERN_WARNING "LTTng: vmalloc_sync_all symbol lookup failed.\n"); | |
34 | printk(KERN_WARNING "Page fault handler and NMI tracing might trigger faults.\n"); | |
35 | #endif | |
36 | } | |
37 | } | |
38 | #else | |
39 | ||
40 | #include <linux/vmalloc.h> | |
41 | ||
42 | static inline | |
43 | void wrapper_vmalloc_sync_all(void) | |
44 | { | |
45 | return vmalloc_sync_all(); | |
46 | } | |
47 | #endif | |
b13f3ebe | 48 | |
a90917c3 | 49 | #endif /* _LTTNG_WRAPPER_VMALLOC_H */ |