Update kvm instrumentation: compile on 3.17-rc1
[lttng-modules.git] / wrapper / vmalloc.h
CommitLineData
a90917c3
MD
1#ifndef _LTTNG_WRAPPER_VMALLOC_H
2#define _LTTNG_WRAPPER_VMALLOC_H
b13f3ebe 3
6d2a620c 4/*
886d51a3 5 * wrapper/vmalloc.h
6d2a620c
MD
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 *
886d51a3
MD
11 * Copyright (C) 2011-2012 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
12 *
13 * This library is free software; you can redistribute it and/or
14 * modify it under the terms of the GNU Lesser General Public
15 * License as published by the Free Software Foundation; only
16 * version 2.1 of the License.
17 *
18 * This library is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21 * Lesser General Public License for more details.
22 *
23 * You should have received a copy of the GNU Lesser General Public
24 * License along with this library; if not, write to the Free Software
25 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
6d2a620c
MD
26 */
27
28#ifdef CONFIG_KALLSYMS
29
30#include <linux/kallsyms.h>
c539a324 31#include "kallsyms.h"
6d2a620c
MD
32
33static inline
34void wrapper_vmalloc_sync_all(void)
35{
36 void (*vmalloc_sync_all_sym)(void);
37
c539a324 38 vmalloc_sync_all_sym = (void *) kallsyms_lookup_funcptr("vmalloc_sync_all");
6d2a620c
MD
39 if (vmalloc_sync_all_sym) {
40 vmalloc_sync_all_sym();
41 } else {
42#ifdef CONFIG_X86
43 /*
44 * Only x86 needs vmalloc_sync_all to make sure LTTng does not
45 * trigger recursive page faults.
46 */
47 printk(KERN_WARNING "LTTng: vmalloc_sync_all symbol lookup failed.\n");
48 printk(KERN_WARNING "Page fault handler and NMI tracing might trigger faults.\n");
49#endif
50 }
51}
52#else
53
54#include <linux/vmalloc.h>
55
56static inline
57void wrapper_vmalloc_sync_all(void)
58{
59 return vmalloc_sync_all();
60}
61#endif
b13f3ebe 62
a90917c3 63#endif /* _LTTNG_WRAPPER_VMALLOC_H */
This page took 0.03019 seconds and 4 git commands to generate.