765f2ad9e22564b18e6d11b1e4dcc824dcf01cdf
[lttng-modules.git] / wrapper / vmalloc.h
1 #ifndef _LTT_WRAPPER_VMALLOC_H
2 #define _LTT_WRAPPER_VMALLOC_H
3
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>
17 #include "kallsyms.h"
18
19 static inline
20 void wrapper_vmalloc_sync_all(void)
21 {
22 void (*vmalloc_sync_all_sym)(void);
23
24 vmalloc_sync_all_sym = (void *) kallsyms_lookup_funcptr("vmalloc_sync_all");
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
48
49 #endif /* _LTT_WRAPPER_VMALLOC_H */
This page took 0.029298 seconds and 3 git commands to generate.