Linux 3.16-rc2
[linux/fpc-iii.git] / arch / s390 / kvm / trace.h
blob916834d7a73a760da5b7fd9beba5c267ad437240
1 #if !defined(_TRACE_KVM_H) || defined(TRACE_HEADER_MULTI_READ)
2 #define _TRACE_KVM_H
4 #include <linux/tracepoint.h>
5 #include <asm/sie.h>
6 #include <asm/debug.h>
7 #include <asm/dis.h>
9 #undef TRACE_SYSTEM
10 #define TRACE_SYSTEM kvm
11 #define TRACE_INCLUDE_PATH .
12 #undef TRACE_INCLUDE_FILE
13 #define TRACE_INCLUDE_FILE trace
16 * Helpers for vcpu-specific tracepoints containing the same information
17 * as s390dbf VCPU_EVENTs.
19 #define VCPU_PROTO_COMMON struct kvm_vcpu *vcpu
20 #define VCPU_ARGS_COMMON vcpu
21 #define VCPU_FIELD_COMMON __field(int, id) \
22 __field(unsigned long, pswmask) \
23 __field(unsigned long, pswaddr)
24 #define VCPU_ASSIGN_COMMON do { \
25 __entry->id = vcpu->vcpu_id; \
26 __entry->pswmask = vcpu->arch.sie_block->gpsw.mask; \
27 __entry->pswaddr = vcpu->arch.sie_block->gpsw.addr; \
28 } while (0);
29 #define VCPU_TP_PRINTK(p_str, p_args...) \
30 TP_printk("%02d[%016lx-%016lx]: " p_str, __entry->id, \
31 __entry->pswmask, __entry->pswaddr, p_args)
33 TRACE_EVENT(kvm_s390_skey_related_inst,
34 TP_PROTO(VCPU_PROTO_COMMON),
35 TP_ARGS(VCPU_ARGS_COMMON),
37 TP_STRUCT__entry(
38 VCPU_FIELD_COMMON
41 TP_fast_assign(
42 VCPU_ASSIGN_COMMON
44 VCPU_TP_PRINTK("%s", "first instruction related to skeys on vcpu")
47 TRACE_EVENT(kvm_s390_major_guest_pfault,
48 TP_PROTO(VCPU_PROTO_COMMON),
49 TP_ARGS(VCPU_ARGS_COMMON),
51 TP_STRUCT__entry(
52 VCPU_FIELD_COMMON
55 TP_fast_assign(
56 VCPU_ASSIGN_COMMON
58 VCPU_TP_PRINTK("%s", "major fault, maybe applicable for pfault")
61 TRACE_EVENT(kvm_s390_pfault_init,
62 TP_PROTO(VCPU_PROTO_COMMON, long pfault_token),
63 TP_ARGS(VCPU_ARGS_COMMON, pfault_token),
65 TP_STRUCT__entry(
66 VCPU_FIELD_COMMON
67 __field(long, pfault_token)
70 TP_fast_assign(
71 VCPU_ASSIGN_COMMON
72 __entry->pfault_token = pfault_token;
74 VCPU_TP_PRINTK("init pfault token %ld", __entry->pfault_token)
77 TRACE_EVENT(kvm_s390_pfault_done,
78 TP_PROTO(VCPU_PROTO_COMMON, long pfault_token),
79 TP_ARGS(VCPU_ARGS_COMMON, pfault_token),
81 TP_STRUCT__entry(
82 VCPU_FIELD_COMMON
83 __field(long, pfault_token)
86 TP_fast_assign(
87 VCPU_ASSIGN_COMMON
88 __entry->pfault_token = pfault_token;
90 VCPU_TP_PRINTK("done pfault token %ld", __entry->pfault_token)
94 * Tracepoints for SIE entry and exit.
96 TRACE_EVENT(kvm_s390_sie_enter,
97 TP_PROTO(VCPU_PROTO_COMMON, int cpuflags),
98 TP_ARGS(VCPU_ARGS_COMMON, cpuflags),
100 TP_STRUCT__entry(
101 VCPU_FIELD_COMMON
102 __field(int, cpuflags)
105 TP_fast_assign(
106 VCPU_ASSIGN_COMMON
107 __entry->cpuflags = cpuflags;
110 VCPU_TP_PRINTK("entering sie flags %x", __entry->cpuflags)
113 TRACE_EVENT(kvm_s390_sie_fault,
114 TP_PROTO(VCPU_PROTO_COMMON),
115 TP_ARGS(VCPU_ARGS_COMMON),
117 TP_STRUCT__entry(
118 VCPU_FIELD_COMMON
121 TP_fast_assign(
122 VCPU_ASSIGN_COMMON
125 VCPU_TP_PRINTK("%s", "fault in sie instruction")
128 TRACE_EVENT(kvm_s390_sie_exit,
129 TP_PROTO(VCPU_PROTO_COMMON, u8 icptcode),
130 TP_ARGS(VCPU_ARGS_COMMON, icptcode),
132 TP_STRUCT__entry(
133 VCPU_FIELD_COMMON
134 __field(u8, icptcode)
137 TP_fast_assign(
138 VCPU_ASSIGN_COMMON
139 __entry->icptcode = icptcode;
142 VCPU_TP_PRINTK("exit sie icptcode %d (%s)", __entry->icptcode,
143 __print_symbolic(__entry->icptcode,
144 sie_intercept_code))
148 * Trace point for intercepted instructions.
150 TRACE_EVENT(kvm_s390_intercept_instruction,
151 TP_PROTO(VCPU_PROTO_COMMON, __u16 ipa, __u32 ipb),
152 TP_ARGS(VCPU_ARGS_COMMON, ipa, ipb),
154 TP_STRUCT__entry(
155 VCPU_FIELD_COMMON
156 __field(__u64, instruction)
159 TP_fast_assign(
160 VCPU_ASSIGN_COMMON
161 __entry->instruction = ((__u64)ipa << 48) |
162 ((__u64)ipb << 16);
165 VCPU_TP_PRINTK("intercepted instruction %016llx (%s)",
166 __entry->instruction,
167 __print_symbolic(icpt_insn_decoder(__entry->instruction),
168 icpt_insn_codes))
172 * Trace point for intercepted program interruptions.
174 TRACE_EVENT(kvm_s390_intercept_prog,
175 TP_PROTO(VCPU_PROTO_COMMON, __u16 code),
176 TP_ARGS(VCPU_ARGS_COMMON, code),
178 TP_STRUCT__entry(
179 VCPU_FIELD_COMMON
180 __field(__u16, code)
183 TP_fast_assign(
184 VCPU_ASSIGN_COMMON
185 __entry->code = code;
188 VCPU_TP_PRINTK("intercepted program interruption %04x",
189 __entry->code)
193 * Trace point for validity intercepts.
195 TRACE_EVENT(kvm_s390_intercept_validity,
196 TP_PROTO(VCPU_PROTO_COMMON, __u16 viwhy),
197 TP_ARGS(VCPU_ARGS_COMMON, viwhy),
199 TP_STRUCT__entry(
200 VCPU_FIELD_COMMON
201 __field(__u16, viwhy)
204 TP_fast_assign(
205 VCPU_ASSIGN_COMMON
206 __entry->viwhy = viwhy;
209 VCPU_TP_PRINTK("got validity intercept %04x", __entry->viwhy)
213 * Trace points for instructions that are of special interest.
216 TRACE_EVENT(kvm_s390_handle_sigp,
217 TP_PROTO(VCPU_PROTO_COMMON, __u8 order_code, __u16 cpu_addr, \
218 __u32 parameter),
219 TP_ARGS(VCPU_ARGS_COMMON, order_code, cpu_addr, parameter),
221 TP_STRUCT__entry(
222 VCPU_FIELD_COMMON
223 __field(__u8, order_code)
224 __field(__u16, cpu_addr)
225 __field(__u32, parameter)
228 TP_fast_assign(
229 VCPU_ASSIGN_COMMON
230 __entry->order_code = order_code;
231 __entry->cpu_addr = cpu_addr;
232 __entry->parameter = parameter;
235 VCPU_TP_PRINTK("handle sigp order %02x (%s), cpu address %04x, " \
236 "parameter %08x", __entry->order_code,
237 __print_symbolic(__entry->order_code,
238 sigp_order_codes),
239 __entry->cpu_addr, __entry->parameter)
242 TRACE_EVENT(kvm_s390_handle_sigp_pei,
243 TP_PROTO(VCPU_PROTO_COMMON, __u8 order_code, __u16 cpu_addr),
244 TP_ARGS(VCPU_ARGS_COMMON, order_code, cpu_addr),
246 TP_STRUCT__entry(
247 VCPU_FIELD_COMMON
248 __field(__u8, order_code)
249 __field(__u16, cpu_addr)
252 TP_fast_assign(
253 VCPU_ASSIGN_COMMON
254 __entry->order_code = order_code;
255 __entry->cpu_addr = cpu_addr;
258 VCPU_TP_PRINTK("handle sigp pei order %02x (%s), cpu address %04x",
259 __entry->order_code,
260 __print_symbolic(__entry->order_code,
261 sigp_order_codes),
262 __entry->cpu_addr)
265 TRACE_EVENT(kvm_s390_handle_diag,
266 TP_PROTO(VCPU_PROTO_COMMON, __u16 code),
267 TP_ARGS(VCPU_ARGS_COMMON, code),
269 TP_STRUCT__entry(
270 VCPU_FIELD_COMMON
271 __field(__u16, code)
274 TP_fast_assign(
275 VCPU_ASSIGN_COMMON
276 __entry->code = code;
279 VCPU_TP_PRINTK("handle diagnose call %04x (%s)", __entry->code,
280 __print_symbolic(__entry->code, diagnose_codes))
283 TRACE_EVENT(kvm_s390_handle_lctl,
284 TP_PROTO(VCPU_PROTO_COMMON, int g, int reg1, int reg3, u64 addr),
285 TP_ARGS(VCPU_ARGS_COMMON, g, reg1, reg3, addr),
287 TP_STRUCT__entry(
288 VCPU_FIELD_COMMON
289 __field(int, g)
290 __field(int, reg1)
291 __field(int, reg3)
292 __field(u64, addr)
295 TP_fast_assign(
296 VCPU_ASSIGN_COMMON
297 __entry->g = g;
298 __entry->reg1 = reg1;
299 __entry->reg3 = reg3;
300 __entry->addr = addr;
303 VCPU_TP_PRINTK("%s: loading cr %x-%x from %016llx",
304 __entry->g ? "lctlg" : "lctl",
305 __entry->reg1, __entry->reg3, __entry->addr)
308 TRACE_EVENT(kvm_s390_handle_stctl,
309 TP_PROTO(VCPU_PROTO_COMMON, int g, int reg1, int reg3, u64 addr),
310 TP_ARGS(VCPU_ARGS_COMMON, g, reg1, reg3, addr),
312 TP_STRUCT__entry(
313 VCPU_FIELD_COMMON
314 __field(int, g)
315 __field(int, reg1)
316 __field(int, reg3)
317 __field(u64, addr)
320 TP_fast_assign(
321 VCPU_ASSIGN_COMMON
322 __entry->g = g;
323 __entry->reg1 = reg1;
324 __entry->reg3 = reg3;
325 __entry->addr = addr;
328 VCPU_TP_PRINTK("%s: storing cr %x-%x to %016llx",
329 __entry->g ? "stctg" : "stctl",
330 __entry->reg1, __entry->reg3, __entry->addr)
333 TRACE_EVENT(kvm_s390_handle_prefix,
334 TP_PROTO(VCPU_PROTO_COMMON, int set, u32 address),
335 TP_ARGS(VCPU_ARGS_COMMON, set, address),
337 TP_STRUCT__entry(
338 VCPU_FIELD_COMMON
339 __field(int, set)
340 __field(u32, address)
343 TP_fast_assign(
344 VCPU_ASSIGN_COMMON
345 __entry->set = set;
346 __entry->address = address;
349 VCPU_TP_PRINTK("%s prefix to %08x",
350 __entry->set ? "setting" : "storing",
351 __entry->address)
354 TRACE_EVENT(kvm_s390_handle_stap,
355 TP_PROTO(VCPU_PROTO_COMMON, u64 address),
356 TP_ARGS(VCPU_ARGS_COMMON, address),
358 TP_STRUCT__entry(
359 VCPU_FIELD_COMMON
360 __field(u64, address)
363 TP_fast_assign(
364 VCPU_ASSIGN_COMMON
365 __entry->address = address;
368 VCPU_TP_PRINTK("storing cpu address to %016llx",
369 __entry->address)
372 TRACE_EVENT(kvm_s390_handle_stfl,
373 TP_PROTO(VCPU_PROTO_COMMON, unsigned int facility_list),
374 TP_ARGS(VCPU_ARGS_COMMON, facility_list),
376 TP_STRUCT__entry(
377 VCPU_FIELD_COMMON
378 __field(unsigned int, facility_list)
381 TP_fast_assign(
382 VCPU_ASSIGN_COMMON
383 __entry->facility_list = facility_list;
386 VCPU_TP_PRINTK("store facility list value %08x",
387 __entry->facility_list)
390 TRACE_EVENT(kvm_s390_handle_stsi,
391 TP_PROTO(VCPU_PROTO_COMMON, int fc, int sel1, int sel2, u64 addr),
392 TP_ARGS(VCPU_ARGS_COMMON, fc, sel1, sel2, addr),
394 TP_STRUCT__entry(
395 VCPU_FIELD_COMMON
396 __field(int, fc)
397 __field(int, sel1)
398 __field(int, sel2)
399 __field(u64, addr)
402 TP_fast_assign(
403 VCPU_ASSIGN_COMMON
404 __entry->fc = fc;
405 __entry->sel1 = sel1;
406 __entry->sel2 = sel2;
407 __entry->addr = addr;
410 VCPU_TP_PRINTK("STSI %d.%d.%d information stored to %016llx",
411 __entry->fc, __entry->sel1, __entry->sel2,
412 __entry->addr)
415 #endif /* _TRACE_KVM_H */
417 /* This part must be outside protection */
418 #include <trace/define_trace.h>