Add support for kvm x86 specific tracepoints
[lttng-modules.git] / lttng-abi.h
1 #ifndef _LTTNG_ABI_H
2 #define _LTTNG_ABI_H
3
4 /*
5 * lttng-abi.h
6 *
7 * LTTng ABI header
8 *
9 * Copyright (C) 2010-2012 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 *
11 * This library is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU Lesser General Public
13 * License as published by the Free Software Foundation; only
14 * version 2.1 of the License.
15 *
16 * This library is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 * Lesser General Public License for more details.
20 *
21 * You should have received a copy of the GNU Lesser General Public
22 * License along with this library; if not, write to the Free Software
23 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
24 */
25
26 #include <linux/fs.h>
27
28 #define LTTNG_KERNEL_SYM_NAME_LEN 256
29
30 enum lttng_kernel_instrumentation {
31 LTTNG_KERNEL_TRACEPOINT = 0,
32 LTTNG_KERNEL_KPROBE = 1,
33 LTTNG_KERNEL_FUNCTION = 2,
34 LTTNG_KERNEL_KRETPROBE = 3,
35 LTTNG_KERNEL_NOOP = 4, /* not hooked */
36 LTTNG_KERNEL_SYSCALL = 5,
37 };
38
39 /*
40 * LTTng consumer mode
41 */
42 enum lttng_kernel_output {
43 LTTNG_KERNEL_SPLICE = 0,
44 LTTNG_KERNEL_MMAP = 1,
45 };
46
47 /*
48 * LTTng DebugFS ABI structures.
49 */
50 #define LTTNG_KERNEL_CHANNEL_PADDING LTTNG_KERNEL_SYM_NAME_LEN + 32
51 struct lttng_kernel_channel {
52 uint64_t subbuf_size; /* in bytes */
53 uint64_t num_subbuf;
54 unsigned int switch_timer_interval; /* usecs */
55 unsigned int read_timer_interval; /* usecs */
56 enum lttng_kernel_output output; /* splice, mmap */
57 int overwrite; /* 1: overwrite, 0: discard */
58 char padding[LTTNG_KERNEL_CHANNEL_PADDING];
59 }__attribute__((packed));
60
61 struct lttng_kernel_kretprobe {
62 uint64_t addr;
63
64 uint64_t offset;
65 char symbol_name[LTTNG_KERNEL_SYM_NAME_LEN];
66 }__attribute__((packed));
67
68 /*
69 * Either addr is used, or symbol_name and offset.
70 */
71 struct lttng_kernel_kprobe {
72 uint64_t addr;
73
74 uint64_t offset;
75 char symbol_name[LTTNG_KERNEL_SYM_NAME_LEN];
76 }__attribute__((packed));
77
78 struct lttng_kernel_function_tracer {
79 char symbol_name[LTTNG_KERNEL_SYM_NAME_LEN];
80 }__attribute__((packed));
81
82 /*
83 * For syscall tracing, name = '\0' means "enable all".
84 */
85 #define LTTNG_KERNEL_EVENT_PADDING1 16
86 #define LTTNG_KERNEL_EVENT_PADDING2 LTTNG_KERNEL_SYM_NAME_LEN + 32
87 struct lttng_kernel_event {
88 char name[LTTNG_KERNEL_SYM_NAME_LEN]; /* event name */
89 enum lttng_kernel_instrumentation instrumentation;
90 char padding[LTTNG_KERNEL_EVENT_PADDING1];
91
92 /* Per instrumentation type configuration */
93 union {
94 struct lttng_kernel_kretprobe kretprobe;
95 struct lttng_kernel_kprobe kprobe;
96 struct lttng_kernel_function_tracer ftrace;
97 char padding[LTTNG_KERNEL_EVENT_PADDING2];
98 } u;
99 }__attribute__((packed));
100
101 struct lttng_kernel_tracer_version {
102 uint32_t major;
103 uint32_t minor;
104 uint32_t patchlevel;
105 }__attribute__((packed));
106
107 enum lttng_kernel_calibrate_type {
108 LTTNG_KERNEL_CALIBRATE_KRETPROBE,
109 };
110
111 struct lttng_kernel_calibrate {
112 enum lttng_kernel_calibrate_type type; /* type (input) */
113 }__attribute__((packed));
114
115 enum lttng_kernel_context_type {
116 LTTNG_KERNEL_CONTEXT_PID = 0,
117 LTTNG_KERNEL_CONTEXT_PERF_COUNTER = 1,
118 LTTNG_KERNEL_CONTEXT_PROCNAME = 2,
119 LTTNG_KERNEL_CONTEXT_PRIO = 3,
120 LTTNG_KERNEL_CONTEXT_NICE = 4,
121 LTTNG_KERNEL_CONTEXT_VPID = 5,
122 LTTNG_KERNEL_CONTEXT_TID = 6,
123 LTTNG_KERNEL_CONTEXT_VTID = 7,
124 LTTNG_KERNEL_CONTEXT_PPID = 8,
125 LTTNG_KERNEL_CONTEXT_VPPID = 9,
126 LTTNG_KERNEL_CONTEXT_HOSTNAME = 10,
127 };
128
129 struct lttng_kernel_perf_counter_ctx {
130 uint32_t type;
131 uint64_t config;
132 char name[LTTNG_KERNEL_SYM_NAME_LEN];
133 }__attribute__((packed));
134
135 #define LTTNG_KERNEL_CONTEXT_PADDING1 16
136 #define LTTNG_KERNEL_CONTEXT_PADDING2 LTTNG_KERNEL_SYM_NAME_LEN + 32
137 struct lttng_kernel_context {
138 enum lttng_kernel_context_type ctx;
139 char padding[LTTNG_KERNEL_CONTEXT_PADDING1];
140
141 union {
142 struct lttng_kernel_perf_counter_ctx perf_counter;
143 char padding[LTTNG_KERNEL_CONTEXT_PADDING2];
144 } u;
145 }__attribute__((packed));
146
147 /* LTTng file descriptor ioctl */
148 #define LTTNG_KERNEL_SESSION _IO(0xF6, 0x45)
149 #define LTTNG_KERNEL_TRACER_VERSION \
150 _IOR(0xF6, 0x46, struct lttng_kernel_tracer_version)
151 #define LTTNG_KERNEL_TRACEPOINT_LIST _IO(0xF6, 0x47)
152 #define LTTNG_KERNEL_WAIT_QUIESCENT _IO(0xF6, 0x48)
153 #define LTTNG_KERNEL_CALIBRATE \
154 _IOWR(0xF6, 0x49, struct lttng_kernel_calibrate)
155
156 /* Session FD ioctl */
157 #define LTTNG_KERNEL_METADATA \
158 _IOW(0xF6, 0x54, struct lttng_kernel_channel)
159 #define LTTNG_KERNEL_CHANNEL \
160 _IOW(0xF6, 0x55, struct lttng_kernel_channel)
161 #define LTTNG_KERNEL_SESSION_START _IO(0xF6, 0x56)
162 #define LTTNG_KERNEL_SESSION_STOP _IO(0xF6, 0x57)
163
164 /* Channel FD ioctl */
165 #define LTTNG_KERNEL_STREAM _IO(0xF6, 0x62)
166 #define LTTNG_KERNEL_EVENT \
167 _IOW(0xF6, 0x63, struct lttng_kernel_event)
168
169 /* Event and Channel FD ioctl */
170 #define LTTNG_KERNEL_CONTEXT \
171 _IOW(0xF6, 0x71, struct lttng_kernel_context)
172
173 /* Event, Channel and Session ioctl */
174 #define LTTNG_KERNEL_ENABLE _IO(0xF6, 0x82)
175 #define LTTNG_KERNEL_DISABLE _IO(0xF6, 0x83)
176
177 #endif /* _LTTNG_ABI_H */
This page took 0.031631 seconds and 4 git commands to generate.