2 #define TRACE_SYSTEM xen
4 #if !defined(_TRACE_XEN_H) || defined(TRACE_HEADER_MULTI_READ)
7 #include <linux/tracepoint.h>
8 #include <asm/paravirt_types.h>
9 #include <asm/xen/trace_types.h>
11 struct multicall_entry
;
14 DECLARE_EVENT_CLASS(xen_mc__batch
,
15 TP_PROTO(enum paravirt_lazy_mode mode
),
18 __field(enum paravirt_lazy_mode
, mode
)
20 TP_fast_assign(__entry
->mode
= mode
),
21 TP_printk("start batch LAZY_%s",
22 (__entry
->mode
== PARAVIRT_LAZY_MMU
) ? "MMU" :
23 (__entry
->mode
== PARAVIRT_LAZY_CPU
) ? "CPU" : "NONE")
25 #define DEFINE_XEN_MC_BATCH(name) \
26 DEFINE_EVENT(xen_mc__batch, name, \
27 TP_PROTO(enum paravirt_lazy_mode mode), \
30 DEFINE_XEN_MC_BATCH(xen_mc_batch
);
31 DEFINE_XEN_MC_BATCH(xen_mc_issue
);
33 TRACE_EVENT(xen_mc_entry
,
34 TP_PROTO(struct multicall_entry
*mc
, unsigned nargs
),
37 __field(unsigned int, op
)
38 __field(unsigned int, nargs
)
39 __array(unsigned long, args
, 6)
41 TP_fast_assign(__entry
->op
= mc
->op
;
42 __entry
->nargs
= nargs
;
43 memcpy(__entry
->args
, mc
->args
, sizeof(unsigned long) * nargs
);
44 memset(__entry
->args
+ nargs
, 0, sizeof(unsigned long) * (6 - nargs
));
46 TP_printk("op %u%s args [%lx, %lx, %lx, %lx, %lx, %lx]",
47 __entry
->op
, xen_hypercall_name(__entry
->op
),
48 __entry
->args
[0], __entry
->args
[1], __entry
->args
[2],
49 __entry
->args
[3], __entry
->args
[4], __entry
->args
[5])
52 TRACE_EVENT(xen_mc_entry_alloc
,
53 TP_PROTO(size_t args
),
58 TP_fast_assign(__entry
->args
= args
),
59 TP_printk("alloc entry %zu arg bytes", __entry
->args
)
62 TRACE_EVENT(xen_mc_callback
,
63 TP_PROTO(xen_mc_callback_fn_t fn
, void *data
),
66 __field(xen_mc_callback_fn_t
, fn
)
73 TP_printk("callback %pf, data %p",
74 __entry
->fn
, __entry
->data
)
77 TRACE_EVENT(xen_mc_flush_reason
,
78 TP_PROTO(enum xen_mc_flush_reason reason
),
81 __field(enum xen_mc_flush_reason
, reason
)
83 TP_fast_assign(__entry
->reason
= reason
),
84 TP_printk("flush reason %s",
85 (__entry
->reason
== XEN_MC_FL_NONE
) ? "NONE" :
86 (__entry
->reason
== XEN_MC_FL_BATCH
) ? "BATCH" :
87 (__entry
->reason
== XEN_MC_FL_ARGS
) ? "ARGS" :
88 (__entry
->reason
== XEN_MC_FL_CALLBACK
) ? "CALLBACK" : "??")
91 TRACE_EVENT(xen_mc_flush
,
92 TP_PROTO(unsigned mcidx
, unsigned argidx
, unsigned cbidx
),
93 TP_ARGS(mcidx
, argidx
, cbidx
),
95 __field(unsigned, mcidx
)
96 __field(unsigned, argidx
)
97 __field(unsigned, cbidx
)
99 TP_fast_assign(__entry
->mcidx
= mcidx
;
100 __entry
->argidx
= argidx
;
101 __entry
->cbidx
= cbidx
),
102 TP_printk("flushing %u hypercalls, %u arg bytes, %u callbacks",
103 __entry
->mcidx
, __entry
->argidx
, __entry
->cbidx
)
106 TRACE_EVENT(xen_mc_extend_args
,
107 TP_PROTO(unsigned long op
, size_t args
, enum xen_mc_extend_args res
),
108 TP_ARGS(op
, args
, res
),
110 __field(unsigned int, op
)
111 __field(size_t, args
)
112 __field(enum xen_mc_extend_args
, res
)
114 TP_fast_assign(__entry
->op
= op
;
115 __entry
->args
= args
;
117 TP_printk("extending op %u%s by %zu bytes res %s",
118 __entry
->op
, xen_hypercall_name(__entry
->op
),
120 __entry
->res
== XEN_MC_XE_OK
? "OK" :
121 __entry
->res
== XEN_MC_XE_BAD_OP
? "BAD_OP" :
122 __entry
->res
== XEN_MC_XE_NO_SPACE
? "NO_SPACE" : "???")
126 DECLARE_EVENT_CLASS(xen_mmu__set_pte
,
127 TP_PROTO(pte_t
*ptep
, pte_t pteval
),
128 TP_ARGS(ptep
, pteval
),
130 __field(pte_t
*, ptep
)
131 __field(pteval_t
, pteval
)
133 TP_fast_assign(__entry
->ptep
= ptep
;
134 __entry
->pteval
= pteval
.pte
),
135 TP_printk("ptep %p pteval %0*llx (raw %0*llx)",
137 (int)sizeof(pteval_t
) * 2, (unsigned long long)pte_val(native_make_pte(__entry
->pteval
)),
138 (int)sizeof(pteval_t
) * 2, (unsigned long long)__entry
->pteval
)
141 #define DEFINE_XEN_MMU_SET_PTE(name) \
142 DEFINE_EVENT(xen_mmu__set_pte, name, \
143 TP_PROTO(pte_t *ptep, pte_t pteval), \
144 TP_ARGS(ptep, pteval))
146 DEFINE_XEN_MMU_SET_PTE(xen_mmu_set_pte
);
147 DEFINE_XEN_MMU_SET_PTE(xen_mmu_set_pte_atomic
);
149 TRACE_EVENT(xen_mmu_set_domain_pte
,
150 TP_PROTO(pte_t
*ptep
, pte_t pteval
, unsigned domid
),
151 TP_ARGS(ptep
, pteval
, domid
),
153 __field(pte_t
*, ptep
)
154 __field(pteval_t
, pteval
)
155 __field(unsigned, domid
)
157 TP_fast_assign(__entry
->ptep
= ptep
;
158 __entry
->pteval
= pteval
.pte
;
159 __entry
->domid
= domid
),
160 TP_printk("ptep %p pteval %0*llx (raw %0*llx) domid %u",
162 (int)sizeof(pteval_t
) * 2, (unsigned long long)pte_val(native_make_pte(__entry
->pteval
)),
163 (int)sizeof(pteval_t
) * 2, (unsigned long long)__entry
->pteval
,
167 TRACE_EVENT(xen_mmu_set_pte_at
,
168 TP_PROTO(struct mm_struct
*mm
, unsigned long addr
,
169 pte_t
*ptep
, pte_t pteval
),
170 TP_ARGS(mm
, addr
, ptep
, pteval
),
172 __field(struct mm_struct
*, mm
)
173 __field(unsigned long, addr
)
174 __field(pte_t
*, ptep
)
175 __field(pteval_t
, pteval
)
177 TP_fast_assign(__entry
->mm
= mm
;
178 __entry
->addr
= addr
;
179 __entry
->ptep
= ptep
;
180 __entry
->pteval
= pteval
.pte
),
181 TP_printk("mm %p addr %lx ptep %p pteval %0*llx (raw %0*llx)",
182 __entry
->mm
, __entry
->addr
, __entry
->ptep
,
183 (int)sizeof(pteval_t
) * 2, (unsigned long long)pte_val(native_make_pte(__entry
->pteval
)),
184 (int)sizeof(pteval_t
) * 2, (unsigned long long)__entry
->pteval
)
187 TRACE_EVENT(xen_mmu_pte_clear
,
188 TP_PROTO(struct mm_struct
*mm
, unsigned long addr
, pte_t
*ptep
),
189 TP_ARGS(mm
, addr
, ptep
),
191 __field(struct mm_struct
*, mm
)
192 __field(unsigned long, addr
)
193 __field(pte_t
*, ptep
)
195 TP_fast_assign(__entry
->mm
= mm
;
196 __entry
->addr
= addr
;
197 __entry
->ptep
= ptep
),
198 TP_printk("mm %p addr %lx ptep %p",
199 __entry
->mm
, __entry
->addr
, __entry
->ptep
)
202 TRACE_EVENT(xen_mmu_set_pmd
,
203 TP_PROTO(pmd_t
*pmdp
, pmd_t pmdval
),
204 TP_ARGS(pmdp
, pmdval
),
206 __field(pmd_t
*, pmdp
)
207 __field(pmdval_t
, pmdval
)
209 TP_fast_assign(__entry
->pmdp
= pmdp
;
210 __entry
->pmdval
= pmdval
.pmd
),
211 TP_printk("pmdp %p pmdval %0*llx (raw %0*llx)",
213 (int)sizeof(pmdval_t
) * 2, (unsigned long long)pmd_val(native_make_pmd(__entry
->pmdval
)),
214 (int)sizeof(pmdval_t
) * 2, (unsigned long long)__entry
->pmdval
)
217 TRACE_EVENT(xen_mmu_pmd_clear
,
218 TP_PROTO(pmd_t
*pmdp
),
221 __field(pmd_t
*, pmdp
)
223 TP_fast_assign(__entry
->pmdp
= pmdp
),
224 TP_printk("pmdp %p", __entry
->pmdp
)
227 #if CONFIG_PGTABLE_LEVELS >= 4
229 TRACE_EVENT(xen_mmu_set_pud
,
230 TP_PROTO(pud_t
*pudp
, pud_t pudval
),
231 TP_ARGS(pudp
, pudval
),
233 __field(pud_t
*, pudp
)
234 __field(pudval_t
, pudval
)
236 TP_fast_assign(__entry
->pudp
= pudp
;
237 __entry
->pudval
= native_pud_val(pudval
)),
238 TP_printk("pudp %p pudval %0*llx (raw %0*llx)",
240 (int)sizeof(pudval_t
) * 2, (unsigned long long)pud_val(native_make_pud(__entry
->pudval
)),
241 (int)sizeof(pudval_t
) * 2, (unsigned long long)__entry
->pudval
)
244 TRACE_EVENT(xen_mmu_set_pgd
,
245 TP_PROTO(pgd_t
*pgdp
, pgd_t
*user_pgdp
, pgd_t pgdval
),
246 TP_ARGS(pgdp
, user_pgdp
, pgdval
),
248 __field(pgd_t
*, pgdp
)
249 __field(pgd_t
*, user_pgdp
)
250 __field(pgdval_t
, pgdval
)
252 TP_fast_assign(__entry
->pgdp
= pgdp
;
253 __entry
->user_pgdp
= user_pgdp
;
254 __entry
->pgdval
= pgdval
.pgd
),
255 TP_printk("pgdp %p user_pgdp %p pgdval %0*llx (raw %0*llx)",
256 __entry
->pgdp
, __entry
->user_pgdp
,
257 (int)sizeof(pgdval_t
) * 2, (unsigned long long)pgd_val(native_make_pgd(__entry
->pgdval
)),
258 (int)sizeof(pgdval_t
) * 2, (unsigned long long)__entry
->pgdval
)
261 TRACE_EVENT(xen_mmu_pud_clear
,
262 TP_PROTO(pud_t
*pudp
),
265 __field(pud_t
*, pudp
)
267 TP_fast_assign(__entry
->pudp
= pudp
),
268 TP_printk("pudp %p", __entry
->pudp
)
272 TRACE_EVENT(xen_mmu_set_pud
,
273 TP_PROTO(pud_t
*pudp
, pud_t pudval
),
274 TP_ARGS(pudp
, pudval
),
276 __field(pud_t
*, pudp
)
277 __field(pudval_t
, pudval
)
279 TP_fast_assign(__entry
->pudp
= pudp
;
280 __entry
->pudval
= native_pud_val(pudval
)),
281 TP_printk("pudp %p pudval %0*llx (raw %0*llx)",
283 (int)sizeof(pudval_t
) * 2, (unsigned long long)pgd_val(native_make_pgd(__entry
->pudval
)),
284 (int)sizeof(pudval_t
) * 2, (unsigned long long)__entry
->pudval
)
289 TRACE_EVENT(xen_mmu_pgd_clear
,
290 TP_PROTO(pgd_t
*pgdp
),
293 __field(pgd_t
*, pgdp
)
295 TP_fast_assign(__entry
->pgdp
= pgdp
),
296 TP_printk("pgdp %p", __entry
->pgdp
)
299 DECLARE_EVENT_CLASS(xen_mmu_ptep_modify_prot
,
300 TP_PROTO(struct mm_struct
*mm
, unsigned long addr
,
301 pte_t
*ptep
, pte_t pteval
),
302 TP_ARGS(mm
, addr
, ptep
, pteval
),
304 __field(struct mm_struct
*, mm
)
305 __field(unsigned long, addr
)
306 __field(pte_t
*, ptep
)
307 __field(pteval_t
, pteval
)
309 TP_fast_assign(__entry
->mm
= mm
;
310 __entry
->addr
= addr
;
311 __entry
->ptep
= ptep
;
312 __entry
->pteval
= pteval
.pte
),
313 TP_printk("mm %p addr %lx ptep %p pteval %0*llx (raw %0*llx)",
314 __entry
->mm
, __entry
->addr
, __entry
->ptep
,
315 (int)sizeof(pteval_t
) * 2, (unsigned long long)pte_val(native_make_pte(__entry
->pteval
)),
316 (int)sizeof(pteval_t
) * 2, (unsigned long long)__entry
->pteval
)
318 #define DEFINE_XEN_MMU_PTEP_MODIFY_PROT(name) \
319 DEFINE_EVENT(xen_mmu_ptep_modify_prot, name, \
320 TP_PROTO(struct mm_struct *mm, unsigned long addr, \
321 pte_t *ptep, pte_t pteval), \
322 TP_ARGS(mm, addr, ptep, pteval))
324 DEFINE_XEN_MMU_PTEP_MODIFY_PROT(xen_mmu_ptep_modify_prot_start
);
325 DEFINE_XEN_MMU_PTEP_MODIFY_PROT(xen_mmu_ptep_modify_prot_commit
);
327 TRACE_EVENT(xen_mmu_alloc_ptpage
,
328 TP_PROTO(struct mm_struct
*mm
, unsigned long pfn
, unsigned level
, bool pinned
),
329 TP_ARGS(mm
, pfn
, level
, pinned
),
331 __field(struct mm_struct
*, mm
)
332 __field(unsigned long, pfn
)
333 __field(unsigned, level
)
334 __field(bool, pinned
)
336 TP_fast_assign(__entry
->mm
= mm
;
338 __entry
->level
= level
;
339 __entry
->pinned
= pinned
),
340 TP_printk("mm %p pfn %lx level %d %spinned",
341 __entry
->mm
, __entry
->pfn
, __entry
->level
,
342 __entry
->pinned
? "" : "un")
345 TRACE_EVENT(xen_mmu_release_ptpage
,
346 TP_PROTO(unsigned long pfn
, unsigned level
, bool pinned
),
347 TP_ARGS(pfn
, level
, pinned
),
349 __field(unsigned long, pfn
)
350 __field(unsigned, level
)
351 __field(bool, pinned
)
353 TP_fast_assign(__entry
->pfn
= pfn
;
354 __entry
->level
= level
;
355 __entry
->pinned
= pinned
),
356 TP_printk("pfn %lx level %d %spinned",
357 __entry
->pfn
, __entry
->level
,
358 __entry
->pinned
? "" : "un")
361 DECLARE_EVENT_CLASS(xen_mmu_pgd
,
362 TP_PROTO(struct mm_struct
*mm
, pgd_t
*pgd
),
365 __field(struct mm_struct
*, mm
)
366 __field(pgd_t
*, pgd
)
368 TP_fast_assign(__entry
->mm
= mm
;
370 TP_printk("mm %p pgd %p", __entry
->mm
, __entry
->pgd
)
372 #define DEFINE_XEN_MMU_PGD_EVENT(name) \
373 DEFINE_EVENT(xen_mmu_pgd, name, \
374 TP_PROTO(struct mm_struct *mm, pgd_t *pgd), \
377 DEFINE_XEN_MMU_PGD_EVENT(xen_mmu_pgd_pin
);
378 DEFINE_XEN_MMU_PGD_EVENT(xen_mmu_pgd_unpin
);
380 TRACE_EVENT(xen_mmu_flush_tlb_all
,
383 TP_STRUCT__entry(__array(char, x
, 0)),
384 TP_fast_assign((void)x
),
388 TRACE_EVENT(xen_mmu_flush_tlb
,
391 TP_STRUCT__entry(__array(char, x
, 0)),
392 TP_fast_assign((void)x
),
396 TRACE_EVENT(xen_mmu_flush_tlb_single
,
397 TP_PROTO(unsigned long addr
),
400 __field(unsigned long, addr
)
402 TP_fast_assign(__entry
->addr
= addr
),
403 TP_printk("addr %lx", __entry
->addr
)
406 TRACE_EVENT(xen_mmu_flush_tlb_others
,
407 TP_PROTO(const struct cpumask
*cpus
, struct mm_struct
*mm
,
408 unsigned long addr
, unsigned long end
),
409 TP_ARGS(cpus
, mm
, addr
, end
),
411 __field(unsigned, ncpus
)
412 __field(struct mm_struct
*, mm
)
413 __field(unsigned long, addr
)
414 __field(unsigned long, end
)
416 TP_fast_assign(__entry
->ncpus
= cpumask_weight(cpus
);
418 __entry
->addr
= addr
,
420 TP_printk("ncpus %d mm %p addr %lx, end %lx",
421 __entry
->ncpus
, __entry
->mm
, __entry
->addr
, __entry
->end
)
424 TRACE_EVENT(xen_mmu_write_cr3
,
425 TP_PROTO(bool kernel
, unsigned long cr3
),
426 TP_ARGS(kernel
, cr3
),
428 __field(bool, kernel
)
429 __field(unsigned long, cr3
)
431 TP_fast_assign(__entry
->kernel
= kernel
;
433 TP_printk("%s cr3 %lx",
434 __entry
->kernel
? "kernel" : "user", __entry
->cr3
)
439 TRACE_EVENT(xen_cpu_write_ldt_entry
,
440 TP_PROTO(struct desc_struct
*dt
, int entrynum
, u64 desc
),
441 TP_ARGS(dt
, entrynum
, desc
),
443 __field(struct desc_struct
*, dt
)
444 __field(int, entrynum
)
447 TP_fast_assign(__entry
->dt
= dt
;
448 __entry
->entrynum
= entrynum
;
449 __entry
->desc
= desc
;
451 TP_printk("dt %p entrynum %d entry %016llx",
452 __entry
->dt
, __entry
->entrynum
,
453 (unsigned long long)__entry
->desc
)
456 TRACE_EVENT(xen_cpu_write_idt_entry
,
457 TP_PROTO(gate_desc
*dt
, int entrynum
, const gate_desc
*ent
),
458 TP_ARGS(dt
, entrynum
, ent
),
460 __field(gate_desc
*, dt
)
461 __field(int, entrynum
)
463 TP_fast_assign(__entry
->dt
= dt
;
464 __entry
->entrynum
= entrynum
;
466 TP_printk("dt %p entrynum %d",
467 __entry
->dt
, __entry
->entrynum
)
470 TRACE_EVENT(xen_cpu_load_idt
,
471 TP_PROTO(const struct desc_ptr
*desc
),
474 __field(unsigned long, addr
)
476 TP_fast_assign(__entry
->addr
= desc
->address
),
477 TP_printk("addr %lx", __entry
->addr
)
480 TRACE_EVENT(xen_cpu_write_gdt_entry
,
481 TP_PROTO(struct desc_struct
*dt
, int entrynum
, const void *desc
, int type
),
482 TP_ARGS(dt
, entrynum
, desc
, type
),
485 __field(struct desc_struct
*, dt
)
486 __field(int, entrynum
)
489 TP_fast_assign(__entry
->dt
= dt
;
490 __entry
->entrynum
= entrynum
;
491 __entry
->desc
= *(u64
*)desc
;
492 __entry
->type
= type
;
494 TP_printk("dt %p entrynum %d type %d desc %016llx",
495 __entry
->dt
, __entry
->entrynum
, __entry
->type
,
496 (unsigned long long)__entry
->desc
)
499 TRACE_EVENT(xen_cpu_set_ldt
,
500 TP_PROTO(const void *addr
, unsigned entries
),
501 TP_ARGS(addr
, entries
),
503 __field(const void *, addr
)
504 __field(unsigned, entries
)
506 TP_fast_assign(__entry
->addr
= addr
;
507 __entry
->entries
= entries
),
508 TP_printk("addr %p entries %u",
509 __entry
->addr
, __entry
->entries
)
513 #endif /* _TRACE_XEN_H */
515 /* This part must be outside protection */
516 #include <trace/define_trace.h>