xen/trace: add segment desc tracing
[zen-stable.git] / include / trace / events / xen.h
blob1dda50834f9c5f2be3a5ed1a980bf20861845b32
1 #undef TRACE_SYSTEM
2 #define TRACE_SYSTEM xen
4 #if !defined(_TRACE_XEN_H) || defined(TRACE_HEADER_MULTI_READ)
5 #define _TRACE_XEN_H
7 #include <linux/tracepoint.h>
8 #include <asm/paravirt_types.h>
9 #include <asm/xen/trace_types.h>
11 /* Multicalls */
13 TRACE_EVENT(xen_mc_batch,
14 TP_PROTO(enum paravirt_lazy_mode mode),
15 TP_ARGS(mode),
16 TP_STRUCT__entry(
17 __field(enum paravirt_lazy_mode, mode)
19 TP_fast_assign(__entry->mode = mode),
20 TP_printk("start batch LAZY_%s",
21 (__entry->mode == PARAVIRT_LAZY_MMU) ? "MMU" :
22 (__entry->mode == PARAVIRT_LAZY_CPU) ? "CPU" : "NONE")
25 TRACE_EVENT(xen_mc_issue,
26 TP_PROTO(enum paravirt_lazy_mode mode),
27 TP_ARGS(mode),
28 TP_STRUCT__entry(
29 __field(enum paravirt_lazy_mode, mode)
31 TP_fast_assign(__entry->mode = mode),
32 TP_printk("issue mode LAZY_%s",
33 (__entry->mode == PARAVIRT_LAZY_MMU) ? "MMU" :
34 (__entry->mode == PARAVIRT_LAZY_CPU) ? "CPU" : "NONE")
37 TRACE_EVENT(xen_mc_entry,
38 TP_PROTO(struct multicall_entry *mc, unsigned nargs),
39 TP_ARGS(mc, nargs),
40 TP_STRUCT__entry(
41 __field(unsigned int, op)
42 __field(unsigned int, nargs)
43 __array(unsigned long, args, 6)
45 TP_fast_assign(__entry->op = mc->op;
46 __entry->nargs = nargs;
47 memcpy(__entry->args, mc->args, sizeof(unsigned long) * nargs);
48 memset(__entry->args + nargs, 0, sizeof(unsigned long) * (6 - nargs));
50 TP_printk("op %u%s args [%lx, %lx, %lx, %lx, %lx, %lx]",
51 __entry->op, xen_hypercall_name(__entry->op),
52 __entry->args[0], __entry->args[1], __entry->args[2],
53 __entry->args[3], __entry->args[4], __entry->args[5])
56 TRACE_EVENT(xen_mc_entry_alloc,
57 TP_PROTO(size_t args),
58 TP_ARGS(args),
59 TP_STRUCT__entry(
60 __field(size_t, args)
62 TP_fast_assign(__entry->args = args),
63 TP_printk("alloc entry %zu arg bytes", __entry->args)
66 TRACE_EVENT(xen_mc_callback,
67 TP_PROTO(xen_mc_callback_fn_t fn, void *data),
68 TP_ARGS(fn, data),
69 TP_STRUCT__entry(
70 __field(xen_mc_callback_fn_t, fn)
71 __field(void *, data)
73 TP_fast_assign(
74 __entry->fn = fn;
75 __entry->data = data;
77 TP_printk("callback %pf, data %p",
78 __entry->fn, __entry->data)
81 TRACE_EVENT(xen_mc_flush_reason,
82 TP_PROTO(enum xen_mc_flush_reason reason),
83 TP_ARGS(reason),
84 TP_STRUCT__entry(
85 __field(enum xen_mc_flush_reason, reason)
87 TP_fast_assign(__entry->reason = reason),
88 TP_printk("flush reason %s",
89 (__entry->reason == XEN_MC_FL_NONE) ? "NONE" :
90 (__entry->reason == XEN_MC_FL_BATCH) ? "BATCH" :
91 (__entry->reason == XEN_MC_FL_ARGS) ? "ARGS" :
92 (__entry->reason == XEN_MC_FL_CALLBACK) ? "CALLBACK" : "??")
95 TRACE_EVENT(xen_mc_flush,
96 TP_PROTO(unsigned mcidx, unsigned argidx, unsigned cbidx),
97 TP_ARGS(mcidx, argidx, cbidx),
98 TP_STRUCT__entry(
99 __field(unsigned, mcidx)
100 __field(unsigned, argidx)
101 __field(unsigned, cbidx)
103 TP_fast_assign(__entry->mcidx = mcidx;
104 __entry->argidx = argidx;
105 __entry->cbidx = cbidx),
106 TP_printk("flushing %u hypercalls, %u arg bytes, %u callbacks",
107 __entry->mcidx, __entry->argidx, __entry->cbidx)
110 TRACE_EVENT(xen_mc_extend_args,
111 TP_PROTO(unsigned long op, size_t args, enum xen_mc_extend_args res),
112 TP_ARGS(op, args, res),
113 TP_STRUCT__entry(
114 __field(unsigned int, op)
115 __field(size_t, args)
116 __field(enum xen_mc_extend_args, res)
118 TP_fast_assign(__entry->op = op;
119 __entry->args = args;
120 __entry->res = res),
121 TP_printk("extending op %u%s by %zu bytes res %s",
122 __entry->op, xen_hypercall_name(__entry->op),
123 __entry->args,
124 __entry->res == XEN_MC_XE_OK ? "OK" :
125 __entry->res == XEN_MC_XE_BAD_OP ? "BAD_OP" :
126 __entry->res == XEN_MC_XE_NO_SPACE ? "NO_SPACE" : "???")
129 /* mmu */
130 TRACE_EVENT(xen_mmu_set_pte,
131 TP_PROTO(pte_t *ptep, pte_t pteval),
132 TP_ARGS(ptep, pteval),
133 TP_STRUCT__entry(
134 __field(pte_t *, ptep)
135 __field(pteval_t, pteval)
137 TP_fast_assign(__entry->ptep = ptep;
138 __entry->pteval = pteval.pte),
139 TP_printk("ptep %p pteval %0*llx (raw %0*llx)",
140 __entry->ptep,
141 (int)sizeof(pteval_t) * 2, (unsigned long long)pte_val(native_make_pte(__entry->pteval)),
142 (int)sizeof(pteval_t) * 2, (unsigned long long)__entry->pteval)
145 TRACE_EVENT(xen_mmu_set_pte_atomic,
146 TP_PROTO(pte_t *ptep, pte_t pteval),
147 TP_ARGS(ptep, pteval),
148 TP_STRUCT__entry(
149 __field(pte_t *, ptep)
150 __field(pteval_t, pteval)
152 TP_fast_assign(__entry->ptep = ptep;
153 __entry->pteval = pteval.pte),
154 TP_printk("ptep %p pteval %0*llx (raw %0*llx)",
155 __entry->ptep,
156 (int)sizeof(pteval_t) * 2, (unsigned long long)pte_val(native_make_pte(__entry->pteval)),
157 (int)sizeof(pteval_t) * 2, (unsigned long long)__entry->pteval)
160 TRACE_EVENT(xen_mmu_set_domain_pte,
161 TP_PROTO(pte_t *ptep, pte_t pteval, unsigned domid),
162 TP_ARGS(ptep, pteval, domid),
163 TP_STRUCT__entry(
164 __field(pte_t *, ptep)
165 __field(pteval_t, pteval)
166 __field(unsigned, domid)
168 TP_fast_assign(__entry->ptep = ptep;
169 __entry->pteval = pteval.pte;
170 __entry->domid = domid),
171 TP_printk("ptep %p pteval %0*llx (raw %0*llx) domid %u",
172 __entry->ptep,
173 (int)sizeof(pteval_t) * 2, (unsigned long long)pte_val(native_make_pte(__entry->pteval)),
174 (int)sizeof(pteval_t) * 2, (unsigned long long)__entry->pteval,
175 __entry->domid)
178 TRACE_EVENT(xen_mmu_set_pte_at,
179 TP_PROTO(struct mm_struct *mm, unsigned long addr,
180 pte_t *ptep, pte_t pteval),
181 TP_ARGS(mm, addr, ptep, pteval),
182 TP_STRUCT__entry(
183 __field(struct mm_struct *, mm)
184 __field(unsigned long, addr)
185 __field(pte_t *, ptep)
186 __field(pteval_t, pteval)
188 TP_fast_assign(__entry->mm = mm;
189 __entry->addr = addr;
190 __entry->ptep = ptep;
191 __entry->pteval = pteval.pte),
192 TP_printk("mm %p addr %lx ptep %p pteval %0*llx (raw %0*llx)",
193 __entry->mm, __entry->addr, __entry->ptep,
194 (int)sizeof(pteval_t) * 2, (unsigned long long)pte_val(native_make_pte(__entry->pteval)),
195 (int)sizeof(pteval_t) * 2, (unsigned long long)__entry->pteval)
198 TRACE_EVENT(xen_mmu_pte_clear,
199 TP_PROTO(struct mm_struct *mm, unsigned long addr, pte_t *ptep),
200 TP_ARGS(mm, addr, ptep),
201 TP_STRUCT__entry(
202 __field(struct mm_struct *, mm)
203 __field(unsigned long, addr)
204 __field(pte_t *, ptep)
206 TP_fast_assign(__entry->mm = mm;
207 __entry->addr = addr;
208 __entry->ptep = ptep),
209 TP_printk("mm %p addr %lx ptep %p",
210 __entry->mm, __entry->addr, __entry->ptep)
213 TRACE_EVENT(xen_mmu_set_pmd,
214 TP_PROTO(pmd_t *pmdp, pmd_t pmdval),
215 TP_ARGS(pmdp, pmdval),
216 TP_STRUCT__entry(
217 __field(pmd_t *, pmdp)
218 __field(pmdval_t, pmdval)
220 TP_fast_assign(__entry->pmdp = pmdp;
221 __entry->pmdval = pmdval.pmd),
222 TP_printk("pmdp %p pmdval %0*llx (raw %0*llx)",
223 __entry->pmdp,
224 (int)sizeof(pmdval_t) * 2, (unsigned long long)pmd_val(native_make_pmd(__entry->pmdval)),
225 (int)sizeof(pmdval_t) * 2, (unsigned long long)__entry->pmdval)
228 TRACE_EVENT(xen_mmu_pmd_clear,
229 TP_PROTO(pmd_t *pmdp),
230 TP_ARGS(pmdp),
231 TP_STRUCT__entry(
232 __field(pmd_t *, pmdp)
234 TP_fast_assign(__entry->pmdp = pmdp),
235 TP_printk("pmdp %p", __entry->pmdp)
238 #if PAGETABLE_LEVELS >= 4
240 TRACE_EVENT(xen_mmu_set_pud,
241 TP_PROTO(pud_t *pudp, pud_t pudval),
242 TP_ARGS(pudp, pudval),
243 TP_STRUCT__entry(
244 __field(pud_t *, pudp)
245 __field(pudval_t, pudval)
247 TP_fast_assign(__entry->pudp = pudp;
248 __entry->pudval = native_pud_val(pudval)),
249 TP_printk("pudp %p pudval %0*llx (raw %0*llx)",
250 __entry->pudp,
251 (int)sizeof(pudval_t) * 2, (unsigned long long)pud_val(native_make_pud(__entry->pudval)),
252 (int)sizeof(pudval_t) * 2, (unsigned long long)__entry->pudval)
255 TRACE_EVENT(xen_mmu_set_pgd,
256 TP_PROTO(pgd_t *pgdp, pgd_t *user_pgdp, pgd_t pgdval),
257 TP_ARGS(pgdp, user_pgdp, pgdval),
258 TP_STRUCT__entry(
259 __field(pgd_t *, pgdp)
260 __field(pgd_t *, user_pgdp)
261 __field(pgdval_t, pgdval)
263 TP_fast_assign(__entry->pgdp = pgdp;
264 __entry->user_pgdp = user_pgdp;
265 __entry->pgdval = pgdval.pgd),
266 TP_printk("pgdp %p user_pgdp %p pgdval %0*llx (raw %0*llx)",
267 __entry->pgdp, __entry->user_pgdp,
268 (int)sizeof(pgdval_t) * 2, (unsigned long long)pgd_val(native_make_pgd(__entry->pgdval)),
269 (int)sizeof(pgdval_t) * 2, (unsigned long long)__entry->pgdval)
272 TRACE_EVENT(xen_mmu_pud_clear,
273 TP_PROTO(pud_t *pudp),
274 TP_ARGS(pudp),
275 TP_STRUCT__entry(
276 __field(pud_t *, pudp)
278 TP_fast_assign(__entry->pudp = pudp),
279 TP_printk("pudp %p", __entry->pudp)
281 #else
283 TRACE_EVENT(xen_mmu_set_pud,
284 TP_PROTO(pud_t *pudp, pud_t pudval),
285 TP_ARGS(pudp, pudval),
286 TP_STRUCT__entry(
287 __field(pud_t *, pudp)
288 __field(pudval_t, pudval)
290 TP_fast_assign(__entry->pudp = pudp;
291 __entry->pudval = native_pud_val(pudval)),
292 TP_printk("pudp %p pudval %0*llx (raw %0*llx)",
293 __entry->pudp,
294 (int)sizeof(pudval_t) * 2, (unsigned long long)pgd_val(native_make_pgd(__entry->pudval)),
295 (int)sizeof(pudval_t) * 2, (unsigned long long)__entry->pudval)
298 #endif
300 TRACE_EVENT(xen_mmu_pgd_clear,
301 TP_PROTO(pgd_t *pgdp),
302 TP_ARGS(pgdp),
303 TP_STRUCT__entry(
304 __field(pgd_t *, pgdp)
306 TP_fast_assign(__entry->pgdp = pgdp),
307 TP_printk("pgdp %p", __entry->pgdp)
310 TRACE_EVENT(xen_mmu_ptep_modify_prot_start,
311 TP_PROTO(struct mm_struct *mm, unsigned long addr,
312 pte_t *ptep, pte_t pteval),
313 TP_ARGS(mm, addr, ptep, pteval),
314 TP_STRUCT__entry(
315 __field(struct mm_struct *, mm)
316 __field(unsigned long, addr)
317 __field(pte_t *, ptep)
318 __field(pteval_t, pteval)
320 TP_fast_assign(__entry->mm = mm;
321 __entry->addr = addr;
322 __entry->ptep = ptep;
323 __entry->pteval = pteval.pte),
324 TP_printk("mm %p addr %lx ptep %p pteval %0*llx (raw %0*llx)",
325 __entry->mm, __entry->addr, __entry->ptep,
326 (int)sizeof(pteval_t) * 2, (unsigned long long)pte_val(native_make_pte(__entry->pteval)),
327 (int)sizeof(pteval_t) * 2, (unsigned long long)__entry->pteval)
330 TRACE_EVENT(xen_mmu_ptep_modify_prot_commit,
331 TP_PROTO(struct mm_struct *mm, unsigned long addr,
332 pte_t *ptep, pte_t pteval),
333 TP_ARGS(mm, addr, ptep, pteval),
334 TP_STRUCT__entry(
335 __field(struct mm_struct *, mm)
336 __field(unsigned long, addr)
337 __field(pte_t *, ptep)
338 __field(pteval_t, pteval)
340 TP_fast_assign(__entry->mm = mm;
341 __entry->addr = addr;
342 __entry->ptep = ptep;
343 __entry->pteval = pteval.pte),
344 TP_printk("mm %p addr %lx ptep %p pteval %0*llx (raw %0*llx)",
345 __entry->mm, __entry->addr, __entry->ptep,
346 (int)sizeof(pteval_t) * 2, (unsigned long long)pte_val(native_make_pte(__entry->pteval)),
347 (int)sizeof(pteval_t) * 2, (unsigned long long)__entry->pteval)
350 TRACE_EVENT(xen_mmu_alloc_ptpage,
351 TP_PROTO(struct mm_struct *mm, unsigned long pfn, unsigned level, bool pinned),
352 TP_ARGS(mm, pfn, level, pinned),
353 TP_STRUCT__entry(
354 __field(struct mm_struct *, mm)
355 __field(unsigned long, pfn)
356 __field(unsigned, level)
357 __field(bool, pinned)
359 TP_fast_assign(__entry->mm = mm;
360 __entry->pfn = pfn;
361 __entry->level = level;
362 __entry->pinned = pinned),
363 TP_printk("mm %p pfn %lx level %d %spinned",
364 __entry->mm, __entry->pfn, __entry->level,
365 __entry->pinned ? "" : "un")
368 TRACE_EVENT(xen_mmu_release_ptpage,
369 TP_PROTO(unsigned long pfn, unsigned level, bool pinned),
370 TP_ARGS(pfn, level, pinned),
371 TP_STRUCT__entry(
372 __field(unsigned long, pfn)
373 __field(unsigned, level)
374 __field(bool, pinned)
376 TP_fast_assign(__entry->pfn = pfn;
377 __entry->level = level;
378 __entry->pinned = pinned),
379 TP_printk("pfn %lx level %d %spinned",
380 __entry->pfn, __entry->level,
381 __entry->pinned ? "" : "un")
384 TRACE_EVENT(xen_mmu_pgd_pin,
385 TP_PROTO(struct mm_struct *mm, pgd_t *pgd),
386 TP_ARGS(mm, pgd),
387 TP_STRUCT__entry(
388 __field(struct mm_struct *, mm)
389 __field(pgd_t *, pgd)
391 TP_fast_assign(__entry->mm = mm;
392 __entry->pgd = pgd),
393 TP_printk("mm %p pgd %p", __entry->mm, __entry->pgd)
396 TRACE_EVENT(xen_mmu_pgd_unpin,
397 TP_PROTO(struct mm_struct *mm, pgd_t *pgd),
398 TP_ARGS(mm, pgd),
399 TP_STRUCT__entry(
400 __field(struct mm_struct *, mm)
401 __field(pgd_t *, pgd)
403 TP_fast_assign(__entry->mm = mm;
404 __entry->pgd = pgd),
405 TP_printk("mm %p pgd %p", __entry->mm, __entry->pgd)
408 /* CPU */
409 TRACE_EVENT(xen_cpu_write_ldt_entry,
410 TP_PROTO(struct desc_struct *dt, int entrynum, u64 desc),
411 TP_ARGS(dt, entrynum, desc),
412 TP_STRUCT__entry(
413 __field(struct desc_struct *, dt)
414 __field(int, entrynum)
415 __field(u64, desc)
417 TP_fast_assign(__entry->dt = dt;
418 __entry->entrynum = entrynum;
419 __entry->desc = desc;
421 TP_printk("dt %p entrynum %d entry %016llx",
422 __entry->dt, __entry->entrynum,
423 (unsigned long long)__entry->desc)
426 TRACE_EVENT(xen_cpu_write_idt_entry,
427 TP_PROTO(gate_desc *dt, int entrynum, const gate_desc *ent),
428 TP_ARGS(dt, entrynum, ent),
429 TP_STRUCT__entry(
430 __field(gate_desc *, dt)
431 __field(int, entrynum)
433 TP_fast_assign(__entry->dt = dt;
434 __entry->entrynum = entrynum;
436 TP_printk("dt %p entrynum %d",
437 __entry->dt, __entry->entrynum)
440 TRACE_EVENT(xen_cpu_load_idt,
441 TP_PROTO(const struct desc_ptr *desc),
442 TP_ARGS(desc),
443 TP_STRUCT__entry(
444 __field(unsigned long, addr)
446 TP_fast_assign(__entry->addr = desc->address),
447 TP_printk("addr %lx", __entry->addr)
450 TRACE_EVENT(xen_cpu_write_gdt_entry,
451 TP_PROTO(struct desc_struct *dt, int entrynum, const void *desc, int type),
452 TP_ARGS(dt, entrynum, desc, type),
453 TP_STRUCT__entry(
454 __field(u64, desc)
455 __field(struct desc_struct *, dt)
456 __field(int, entrynum)
457 __field(int, type)
459 TP_fast_assign(__entry->dt = dt;
460 __entry->entrynum = entrynum;
461 __entry->desc = *(u64 *)desc;
462 __entry->type = type;
464 TP_printk("dt %p entrynum %d type %d desc %016llx",
465 __entry->dt, __entry->entrynum, __entry->type,
466 (unsigned long long)__entry->desc)
469 TRACE_EVENT(xen_cpu_set_ldt,
470 TP_PROTO(const void *addr, unsigned entries),
471 TP_ARGS(addr, entries),
472 TP_STRUCT__entry(
473 __field(const void *, addr)
474 __field(unsigned, entries)
476 TP_fast_assign(__entry->addr = addr;
477 __entry->entries = entries),
478 TP_printk("addr %p entries %u",
479 __entry->addr, __entry->entries)
483 #endif /* _TRACE_XEN_H */
485 /* This part must be outside protection */
486 #include <trace/define_trace.h>