1#undef TRACE_SYSTEM 2#define TRACE_SYSTEM xen 3 4#if !defined(_TRACE_XEN_H) || defined(TRACE_HEADER_MULTI_READ) 5#define _TRACE_XEN_H 6 7#include <linux/tracepoint.h> 8#include <asm/paravirt_types.h> 9#include <asm/xen/trace_types.h> 10 11struct multicall_entry; 12 13/* Multicalls */ 14DECLARE_EVENT_CLASS(xen_mc__batch, 15 TP_PROTO(enum paravirt_lazy_mode mode), 16 TP_ARGS(mode), 17 TP_STRUCT__entry( 18 __field(enum paravirt_lazy_mode, mode) 19 ), 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") 24 ); 25#define DEFINE_XEN_MC_BATCH(name) \ 26 DEFINE_EVENT(xen_mc__batch, name, \ 27 TP_PROTO(enum paravirt_lazy_mode mode), \ 28 TP_ARGS(mode)) 29 30DEFINE_XEN_MC_BATCH(xen_mc_batch); 31DEFINE_XEN_MC_BATCH(xen_mc_issue); 32 33TRACE_EVENT(xen_mc_entry, 34 TP_PROTO(struct multicall_entry *mc, unsigned nargs), 35 TP_ARGS(mc, nargs), 36 TP_STRUCT__entry( 37 __field(unsigned int, op) 38 __field(unsigned int, nargs) 39 __array(unsigned long, args, 6) 40 ), 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)); 45 ), 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]) 50 ); 51 52TRACE_EVENT(xen_mc_entry_alloc, 53 TP_PROTO(size_t args), 54 TP_ARGS(args), 55 TP_STRUCT__entry( 56 __field(size_t, args) 57 ), 58 TP_fast_assign(__entry->args = args), 59 TP_printk("alloc entry %zu arg bytes", __entry->args) 60 ); 61 62TRACE_EVENT(xen_mc_callback, 63 TP_PROTO(xen_mc_callback_fn_t fn, void *data), 64 TP_ARGS(fn, data), 65 TP_STRUCT__entry( 66 __field(xen_mc_callback_fn_t, fn) 67 __field(void *, data) 68 ), 69 TP_fast_assign( 70 __entry->fn = fn; 71 __entry->data = data; 72 ), 73 TP_printk("callback %pf, data %p", 74 __entry->fn, __entry->data) 75 ); 76 77TRACE_EVENT(xen_mc_flush_reason, 78 TP_PROTO(enum xen_mc_flush_reason reason), 79 TP_ARGS(reason), 80 TP_STRUCT__entry( 81 __field(enum xen_mc_flush_reason, reason) 82 ), 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" : "??") 89 ); 90 91TRACE_EVENT(xen_mc_flush, 92 TP_PROTO(unsigned mcidx, unsigned argidx, unsigned cbidx), 93 TP_ARGS(mcidx, argidx, cbidx), 94 TP_STRUCT__entry( 95 __field(unsigned, mcidx) 96 __field(unsigned, argidx) 97 __field(unsigned, cbidx) 98 ), 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) 104 ); 105 106TRACE_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), 109 TP_STRUCT__entry( 110 __field(unsigned int, op) 111 __field(size_t, args) 112 __field(enum xen_mc_extend_args, res) 113 ), 114 TP_fast_assign(__entry->op = op; 115 __entry->args = args; 116 __entry->res = res), 117 TP_printk("extending op %u%s by %zu bytes res %s", 118 __entry->op, xen_hypercall_name(__entry->op), 119 __entry->args, 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" : "???") 123 ); 124 125/* mmu */ 126DECLARE_EVENT_CLASS(xen_mmu__set_pte, 127 TP_PROTO(pte_t *ptep, pte_t pteval), 128 TP_ARGS(ptep, pteval), 129 TP_STRUCT__entry( 130 __field(pte_t *, ptep) 131 __field(pteval_t, pteval) 132 ), 133 TP_fast_assign(__entry->ptep = ptep; 134 __entry->pteval = pteval.pte), 135 TP_printk("ptep %p pteval %0*llx (raw %0*llx)", 136 __entry->ptep, 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) 139 ); 140 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)) 145 146DEFINE_XEN_MMU_SET_PTE(xen_mmu_set_pte); 147DEFINE_XEN_MMU_SET_PTE(xen_mmu_set_pte_atomic); 148 149TRACE_EVENT(xen_mmu_set_domain_pte, 150 TP_PROTO(pte_t *ptep, pte_t pteval, unsigned domid), 151 TP_ARGS(ptep, pteval, domid), 152 TP_STRUCT__entry( 153 __field(pte_t *, ptep) 154 __field(pteval_t, pteval) 155 __field(unsigned, domid) 156 ), 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", 161 __entry->ptep, 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, 164 __entry->domid) 165 ); 166 167TRACE_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), 171 TP_STRUCT__entry( 172 __field(struct mm_struct *, mm) 173 __field(unsigned long, addr) 174 __field(pte_t *, ptep) 175 __field(pteval_t, pteval) 176 ), 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) 185 ); 186 187TRACE_EVENT(xen_mmu_pte_clear, 188 TP_PROTO(struct mm_struct *mm, unsigned long addr, pte_t *ptep), 189 TP_ARGS(mm, addr, ptep), 190 TP_STRUCT__entry( 191 __field(struct mm_struct *, mm) 192 __field(unsigned long, addr) 193 __field(pte_t *, ptep) 194 ), 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) 200 ); 201 202TRACE_EVENT(xen_mmu_set_pmd, 203 TP_PROTO(pmd_t *pmdp, pmd_t pmdval), 204 TP_ARGS(pmdp, pmdval), 205 TP_STRUCT__entry( 206 __field(pmd_t *, pmdp) 207 __field(pmdval_t, pmdval) 208 ), 209 TP_fast_assign(__entry->pmdp = pmdp; 210 __entry->pmdval = pmdval.pmd), 211 TP_printk("pmdp %p pmdval %0*llx (raw %0*llx)", 212 __entry->pmdp, 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) 215 ); 216 217TRACE_EVENT(xen_mmu_pmd_clear, 218 TP_PROTO(pmd_t *pmdp), 219 TP_ARGS(pmdp), 220 TP_STRUCT__entry( 221 __field(pmd_t *, pmdp) 222 ), 223 TP_fast_assign(__entry->pmdp = pmdp), 224 TP_printk("pmdp %p", __entry->pmdp) 225 ); 226 227#if CONFIG_PGTABLE_LEVELS >= 4 228 229TRACE_EVENT(xen_mmu_set_pud, 230 TP_PROTO(pud_t *pudp, pud_t pudval), 231 TP_ARGS(pudp, pudval), 232 TP_STRUCT__entry( 233 __field(pud_t *, pudp) 234 __field(pudval_t, pudval) 235 ), 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)", 239 __entry->pudp, 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) 242 ); 243 244TRACE_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), 247 TP_STRUCT__entry( 248 __field(pgd_t *, pgdp) 249 __field(pgd_t *, user_pgdp) 250 __field(pgdval_t, pgdval) 251 ), 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) 259 ); 260 261TRACE_EVENT(xen_mmu_pud_clear, 262 TP_PROTO(pud_t *pudp), 263 TP_ARGS(pudp), 264 TP_STRUCT__entry( 265 __field(pud_t *, pudp) 266 ), 267 TP_fast_assign(__entry->pudp = pudp), 268 TP_printk("pudp %p", __entry->pudp) 269 ); 270#else 271 272TRACE_EVENT(xen_mmu_set_pud, 273 TP_PROTO(pud_t *pudp, pud_t pudval), 274 TP_ARGS(pudp, pudval), 275 TP_STRUCT__entry( 276 __field(pud_t *, pudp) 277 __field(pudval_t, pudval) 278 ), 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)", 282 __entry->pudp, 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) 285 ); 286 287#endif 288 289TRACE_EVENT(xen_mmu_pgd_clear, 290 TP_PROTO(pgd_t *pgdp), 291 TP_ARGS(pgdp), 292 TP_STRUCT__entry( 293 __field(pgd_t *, pgdp) 294 ), 295 TP_fast_assign(__entry->pgdp = pgdp), 296 TP_printk("pgdp %p", __entry->pgdp) 297 ); 298 299DECLARE_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), 303 TP_STRUCT__entry( 304 __field(struct mm_struct *, mm) 305 __field(unsigned long, addr) 306 __field(pte_t *, ptep) 307 __field(pteval_t, pteval) 308 ), 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) 317 ); 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)) 323 324DEFINE_XEN_MMU_PTEP_MODIFY_PROT(xen_mmu_ptep_modify_prot_start); 325DEFINE_XEN_MMU_PTEP_MODIFY_PROT(xen_mmu_ptep_modify_prot_commit); 326 327TRACE_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), 330 TP_STRUCT__entry( 331 __field(struct mm_struct *, mm) 332 __field(unsigned long, pfn) 333 __field(unsigned, level) 334 __field(bool, pinned) 335 ), 336 TP_fast_assign(__entry->mm = mm; 337 __entry->pfn = pfn; 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") 343 ); 344 345TRACE_EVENT(xen_mmu_release_ptpage, 346 TP_PROTO(unsigned long pfn, unsigned level, bool pinned), 347 TP_ARGS(pfn, level, pinned), 348 TP_STRUCT__entry( 349 __field(unsigned long, pfn) 350 __field(unsigned, level) 351 __field(bool, pinned) 352 ), 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") 359 ); 360 361DECLARE_EVENT_CLASS(xen_mmu_pgd, 362 TP_PROTO(struct mm_struct *mm, pgd_t *pgd), 363 TP_ARGS(mm, pgd), 364 TP_STRUCT__entry( 365 __field(struct mm_struct *, mm) 366 __field(pgd_t *, pgd) 367 ), 368 TP_fast_assign(__entry->mm = mm; 369 __entry->pgd = pgd), 370 TP_printk("mm %p pgd %p", __entry->mm, __entry->pgd) 371 ); 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), \ 375 TP_ARGS(mm, pgd)) 376 377DEFINE_XEN_MMU_PGD_EVENT(xen_mmu_pgd_pin); 378DEFINE_XEN_MMU_PGD_EVENT(xen_mmu_pgd_unpin); 379 380TRACE_EVENT(xen_mmu_flush_tlb_all, 381 TP_PROTO(int x), 382 TP_ARGS(x), 383 TP_STRUCT__entry(__array(char, x, 0)), 384 TP_fast_assign((void)x), 385 TP_printk("%s", "") 386 ); 387 388TRACE_EVENT(xen_mmu_flush_tlb, 389 TP_PROTO(int x), 390 TP_ARGS(x), 391 TP_STRUCT__entry(__array(char, x, 0)), 392 TP_fast_assign((void)x), 393 TP_printk("%s", "") 394 ); 395 396TRACE_EVENT(xen_mmu_flush_tlb_single, 397 TP_PROTO(unsigned long addr), 398 TP_ARGS(addr), 399 TP_STRUCT__entry( 400 __field(unsigned long, addr) 401 ), 402 TP_fast_assign(__entry->addr = addr), 403 TP_printk("addr %lx", __entry->addr) 404 ); 405 406TRACE_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), 410 TP_STRUCT__entry( 411 __field(unsigned, ncpus) 412 __field(struct mm_struct *, mm) 413 __field(unsigned long, addr) 414 __field(unsigned long, end) 415 ), 416 TP_fast_assign(__entry->ncpus = cpumask_weight(cpus); 417 __entry->mm = mm; 418 __entry->addr = addr, 419 __entry->end = end), 420 TP_printk("ncpus %d mm %p addr %lx, end %lx", 421 __entry->ncpus, __entry->mm, __entry->addr, __entry->end) 422 ); 423 424TRACE_EVENT(xen_mmu_write_cr3, 425 TP_PROTO(bool kernel, unsigned long cr3), 426 TP_ARGS(kernel, cr3), 427 TP_STRUCT__entry( 428 __field(bool, kernel) 429 __field(unsigned long, cr3) 430 ), 431 TP_fast_assign(__entry->kernel = kernel; 432 __entry->cr3 = cr3), 433 TP_printk("%s cr3 %lx", 434 __entry->kernel ? "kernel" : "user", __entry->cr3) 435 ); 436 437 438/* CPU */ 439TRACE_EVENT(xen_cpu_write_ldt_entry, 440 TP_PROTO(struct desc_struct *dt, int entrynum, u64 desc), 441 TP_ARGS(dt, entrynum, desc), 442 TP_STRUCT__entry( 443 __field(struct desc_struct *, dt) 444 __field(int, entrynum) 445 __field(u64, desc) 446 ), 447 TP_fast_assign(__entry->dt = dt; 448 __entry->entrynum = entrynum; 449 __entry->desc = desc; 450 ), 451 TP_printk("dt %p entrynum %d entry %016llx", 452 __entry->dt, __entry->entrynum, 453 (unsigned long long)__entry->desc) 454 ); 455 456TRACE_EVENT(xen_cpu_write_idt_entry, 457 TP_PROTO(gate_desc *dt, int entrynum, const gate_desc *ent), 458 TP_ARGS(dt, entrynum, ent), 459 TP_STRUCT__entry( 460 __field(gate_desc *, dt) 461 __field(int, entrynum) 462 ), 463 TP_fast_assign(__entry->dt = dt; 464 __entry->entrynum = entrynum; 465 ), 466 TP_printk("dt %p entrynum %d", 467 __entry->dt, __entry->entrynum) 468 ); 469 470TRACE_EVENT(xen_cpu_load_idt, 471 TP_PROTO(const struct desc_ptr *desc), 472 TP_ARGS(desc), 473 TP_STRUCT__entry( 474 __field(unsigned long, addr) 475 ), 476 TP_fast_assign(__entry->addr = desc->address), 477 TP_printk("addr %lx", __entry->addr) 478 ); 479 480TRACE_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), 483 TP_STRUCT__entry( 484 __field(u64, desc) 485 __field(struct desc_struct *, dt) 486 __field(int, entrynum) 487 __field(int, type) 488 ), 489 TP_fast_assign(__entry->dt = dt; 490 __entry->entrynum = entrynum; 491 __entry->desc = *(u64 *)desc; 492 __entry->type = type; 493 ), 494 TP_printk("dt %p entrynum %d type %d desc %016llx", 495 __entry->dt, __entry->entrynum, __entry->type, 496 (unsigned long long)__entry->desc) 497 ); 498 499TRACE_EVENT(xen_cpu_set_ldt, 500 TP_PROTO(const void *addr, unsigned entries), 501 TP_ARGS(addr, entries), 502 TP_STRUCT__entry( 503 __field(const void *, addr) 504 __field(unsigned, entries) 505 ), 506 TP_fast_assign(__entry->addr = addr; 507 __entry->entries = entries), 508 TP_printk("addr %p entries %u", 509 __entry->addr, __entry->entries) 510 ); 511 512 513#endif /* _TRACE_XEN_H */ 514 515/* This part must be outside protection */ 516#include <trace/define_trace.h> 517