1 #if !defined(_I915_TRACE_H_) || defined(TRACE_HEADER_MULTI_READ) 2 #define _I915_TRACE_H_ 3 4 #include <linux/stringify.h> 5 #include <linux/types.h> 6 #include <linux/tracepoint.h> 7 8 #include <drm/drmP.h> 9 #include "i915_drv.h" 10 #include "intel_drv.h" 11 #include "intel_ringbuffer.h" 12 13 #undef TRACE_SYSTEM 14 #define TRACE_SYSTEM i915 15 #define TRACE_INCLUDE_FILE i915_trace 16 17 /* pipe updates */ 18 19 TRACE_EVENT(i915_pipe_update_start, 20 TP_PROTO(struct intel_crtc *crtc), 21 TP_ARGS(crtc), 22 23 TP_STRUCT__entry( 24 __field(enum pipe, pipe) 25 __field(u32, frame) 26 __field(u32, scanline) 27 __field(u32, min) 28 __field(u32, max) 29 ), 30 31 TP_fast_assign( 32 __entry->pipe = crtc->pipe; 33 __entry->frame = crtc->base.dev->driver->get_vblank_counter(crtc->base.dev, 34 crtc->pipe); 35 __entry->scanline = intel_get_crtc_scanline(crtc); 36 __entry->min = crtc->debug.min_vbl; 37 __entry->max = crtc->debug.max_vbl; 38 ), 39 40 TP_printk("pipe %c, frame=%u, scanline=%u, min=%u, max=%u", 41 pipe_name(__entry->pipe), __entry->frame, 42 __entry->scanline, __entry->min, __entry->max) 43 ); 44 45 TRACE_EVENT(i915_pipe_update_vblank_evaded, 46 TP_PROTO(struct intel_crtc *crtc), 47 TP_ARGS(crtc), 48 49 TP_STRUCT__entry( 50 __field(enum pipe, pipe) 51 __field(u32, frame) 52 __field(u32, scanline) 53 __field(u32, min) 54 __field(u32, max) 55 ), 56 57 TP_fast_assign( 58 __entry->pipe = crtc->pipe; 59 __entry->frame = crtc->debug.start_vbl_count; 60 __entry->scanline = crtc->debug.scanline_start; 61 __entry->min = crtc->debug.min_vbl; 62 __entry->max = crtc->debug.max_vbl; 63 ), 64 65 TP_printk("pipe %c, frame=%u, scanline=%u, min=%u, max=%u", 66 pipe_name(__entry->pipe), __entry->frame, 67 __entry->scanline, __entry->min, __entry->max) 68 ); 69 70 TRACE_EVENT(i915_pipe_update_end, 71 TP_PROTO(struct intel_crtc *crtc, u32 frame, int scanline_end), 72 TP_ARGS(crtc, frame, scanline_end), 73 74 TP_STRUCT__entry( 75 __field(enum pipe, pipe) 76 __field(u32, frame) 77 __field(u32, scanline) 78 ), 79 80 TP_fast_assign( 81 __entry->pipe = crtc->pipe; 82 __entry->frame = frame; 83 __entry->scanline = scanline_end; 84 ), 85 86 TP_printk("pipe %c, frame=%u, scanline=%u", 87 pipe_name(__entry->pipe), __entry->frame, 88 __entry->scanline) 89 ); 90 91 /* object tracking */ 92 93 TRACE_EVENT(i915_gem_object_create, 94 TP_PROTO(struct drm_i915_gem_object *obj), 95 TP_ARGS(obj), 96 97 TP_STRUCT__entry( 98 __field(struct drm_i915_gem_object *, obj) 99 __field(u32, size) 100 ), 101 102 TP_fast_assign( 103 __entry->obj = obj; 104 __entry->size = obj->base.size; 105 ), 106 107 TP_printk("obj=%p, size=%u", __entry->obj, __entry->size) 108 ); 109 110 TRACE_EVENT(i915_gem_shrink, 111 TP_PROTO(struct drm_i915_private *i915, unsigned long target, unsigned flags), 112 TP_ARGS(i915, target, flags), 113 114 TP_STRUCT__entry( 115 __field(int, dev) 116 __field(unsigned long, target) 117 __field(unsigned, flags) 118 ), 119 120 TP_fast_assign( 121 __entry->dev = i915->dev->primary->index; 122 __entry->target = target; 123 __entry->flags = flags; 124 ), 125 126 TP_printk("dev=%d, target=%lu, flags=%x", 127 __entry->dev, __entry->target, __entry->flags) 128 ); 129 130 TRACE_EVENT(i915_vma_bind, 131 TP_PROTO(struct i915_vma *vma, unsigned flags), 132 TP_ARGS(vma, flags), 133 134 TP_STRUCT__entry( 135 __field(struct drm_i915_gem_object *, obj) 136 __field(struct i915_address_space *, vm) 137 __field(u64, offset) 138 __field(u32, size) 139 __field(unsigned, flags) 140 ), 141 142 TP_fast_assign( 143 __entry->obj = vma->obj; 144 __entry->vm = vma->vm; 145 __entry->offset = vma->node.start; 146 __entry->size = vma->node.size; 147 __entry->flags = flags; 148 ), 149 150 TP_printk("obj=%p, offset=%016llx size=%x%s vm=%p", 151 __entry->obj, __entry->offset, __entry->size, 152 __entry->flags & PIN_MAPPABLE ? ", mappable" : "", 153 __entry->vm) 154 ); 155 156 TRACE_EVENT(i915_vma_unbind, 157 TP_PROTO(struct i915_vma *vma), 158 TP_ARGS(vma), 159 160 TP_STRUCT__entry( 161 __field(struct drm_i915_gem_object *, obj) 162 __field(struct i915_address_space *, vm) 163 __field(u64, offset) 164 __field(u32, size) 165 ), 166 167 TP_fast_assign( 168 __entry->obj = vma->obj; 169 __entry->vm = vma->vm; 170 __entry->offset = vma->node.start; 171 __entry->size = vma->node.size; 172 ), 173 174 TP_printk("obj=%p, offset=%016llx size=%x vm=%p", 175 __entry->obj, __entry->offset, __entry->size, __entry->vm) 176 ); 177 178 #define VM_TO_TRACE_NAME(vm) \ 179 (i915_is_ggtt(vm) ? "G" : \ 180 "P") 181 182 DECLARE_EVENT_CLASS(i915_va, 183 TP_PROTO(struct i915_address_space *vm, u64 start, u64 length, const char *name), 184 TP_ARGS(vm, start, length, name), 185 186 TP_STRUCT__entry( 187 __field(struct i915_address_space *, vm) 188 __field(u64, start) 189 __field(u64, end) 190 __string(name, name) 191 ), 192 193 TP_fast_assign( 194 __entry->vm = vm; 195 __entry->start = start; 196 __entry->end = start + length - 1; 197 __assign_str(name, name); 198 ), 199 200 TP_printk("vm=%p (%s), 0x%llx-0x%llx", 201 __entry->vm, __get_str(name), __entry->start, __entry->end) 202 ); 203 204 DEFINE_EVENT(i915_va, i915_va_alloc, 205 TP_PROTO(struct i915_address_space *vm, u64 start, u64 length, const char *name), 206 TP_ARGS(vm, start, length, name) 207 ); 208 209 DECLARE_EVENT_CLASS(i915_px_entry, 210 TP_PROTO(struct i915_address_space *vm, u32 px, u64 start, u64 px_shift), 211 TP_ARGS(vm, px, start, px_shift), 212 213 TP_STRUCT__entry( 214 __field(struct i915_address_space *, vm) 215 __field(u32, px) 216 __field(u64, start) 217 __field(u64, end) 218 ), 219 220 TP_fast_assign( 221 __entry->vm = vm; 222 __entry->px = px; 223 __entry->start = start; 224 __entry->end = ((start + (1ULL << px_shift)) & ~((1ULL << px_shift)-1)) - 1; 225 ), 226 227 TP_printk("vm=%p, pde=%d (0x%llx-0x%llx)", 228 __entry->vm, __entry->px, __entry->start, __entry->end) 229 ); 230 231 DEFINE_EVENT(i915_px_entry, i915_page_table_entry_alloc, 232 TP_PROTO(struct i915_address_space *vm, u32 pde, u64 start, u64 pde_shift), 233 TP_ARGS(vm, pde, start, pde_shift) 234 ); 235 236 DEFINE_EVENT_PRINT(i915_px_entry, i915_page_directory_entry_alloc, 237 TP_PROTO(struct i915_address_space *vm, u32 pdpe, u64 start, u64 pdpe_shift), 238 TP_ARGS(vm, pdpe, start, pdpe_shift), 239 240 TP_printk("vm=%p, pdpe=%d (0x%llx-0x%llx)", 241 __entry->vm, __entry->px, __entry->start, __entry->end) 242 ); 243 244 DEFINE_EVENT_PRINT(i915_px_entry, i915_page_directory_pointer_entry_alloc, 245 TP_PROTO(struct i915_address_space *vm, u32 pml4e, u64 start, u64 pml4e_shift), 246 TP_ARGS(vm, pml4e, start, pml4e_shift), 247 248 TP_printk("vm=%p, pml4e=%d (0x%llx-0x%llx)", 249 __entry->vm, __entry->px, __entry->start, __entry->end) 250 ); 251 252 /* Avoid extra math because we only support two sizes. The format is defined by 253 * bitmap_scnprintf. Each 32 bits is 8 HEX digits followed by comma */ 254 #define TRACE_PT_SIZE(bits) \ 255 ((((bits) == 1024) ? 288 : 144) + 1) 256 257 DECLARE_EVENT_CLASS(i915_page_table_entry_update, 258 TP_PROTO(struct i915_address_space *vm, u32 pde, 259 struct i915_page_table *pt, u32 first, u32 count, u32 bits), 260 TP_ARGS(vm, pde, pt, first, count, bits), 261 262 TP_STRUCT__entry( 263 __field(struct i915_address_space *, vm) 264 __field(u32, pde) 265 __field(u32, first) 266 __field(u32, last) 267 __dynamic_array(char, cur_ptes, TRACE_PT_SIZE(bits)) 268 ), 269 270 TP_fast_assign( 271 __entry->vm = vm; 272 __entry->pde = pde; 273 __entry->first = first; 274 __entry->last = first + count - 1; 275 scnprintf(__get_str(cur_ptes), 276 TRACE_PT_SIZE(bits), 277 "%*pb", 278 bits, 279 pt->used_ptes); 280 ), 281 282 TP_printk("vm=%p, pde=%d, updating %u:%u\t%s", 283 __entry->vm, __entry->pde, __entry->last, __entry->first, 284 __get_str(cur_ptes)) 285 ); 286 287 DEFINE_EVENT(i915_page_table_entry_update, i915_page_table_entry_map, 288 TP_PROTO(struct i915_address_space *vm, u32 pde, 289 struct i915_page_table *pt, u32 first, u32 count, u32 bits), 290 TP_ARGS(vm, pde, pt, first, count, bits) 291 ); 292 293 TRACE_EVENT(i915_gem_object_change_domain, 294 TP_PROTO(struct drm_i915_gem_object *obj, u32 old_read, u32 old_write), 295 TP_ARGS(obj, old_read, old_write), 296 297 TP_STRUCT__entry( 298 __field(struct drm_i915_gem_object *, obj) 299 __field(u32, read_domains) 300 __field(u32, write_domain) 301 ), 302 303 TP_fast_assign( 304 __entry->obj = obj; 305 __entry->read_domains = obj->base.read_domains | (old_read << 16); 306 __entry->write_domain = obj->base.write_domain | (old_write << 16); 307 ), 308 309 TP_printk("obj=%p, read=%02x=>%02x, write=%02x=>%02x", 310 __entry->obj, 311 __entry->read_domains >> 16, 312 __entry->read_domains & 0xffff, 313 __entry->write_domain >> 16, 314 __entry->write_domain & 0xffff) 315 ); 316 317 TRACE_EVENT(i915_gem_object_pwrite, 318 TP_PROTO(struct drm_i915_gem_object *obj, u32 offset, u32 len), 319 TP_ARGS(obj, offset, len), 320 321 TP_STRUCT__entry( 322 __field(struct drm_i915_gem_object *, obj) 323 __field(u32, offset) 324 __field(u32, len) 325 ), 326 327 TP_fast_assign( 328 __entry->obj = obj; 329 __entry->offset = offset; 330 __entry->len = len; 331 ), 332 333 TP_printk("obj=%p, offset=%u, len=%u", 334 __entry->obj, __entry->offset, __entry->len) 335 ); 336 337 TRACE_EVENT(i915_gem_object_pread, 338 TP_PROTO(struct drm_i915_gem_object *obj, u32 offset, u32 len), 339 TP_ARGS(obj, offset, len), 340 341 TP_STRUCT__entry( 342 __field(struct drm_i915_gem_object *, obj) 343 __field(u32, offset) 344 __field(u32, len) 345 ), 346 347 TP_fast_assign( 348 __entry->obj = obj; 349 __entry->offset = offset; 350 __entry->len = len; 351 ), 352 353 TP_printk("obj=%p, offset=%u, len=%u", 354 __entry->obj, __entry->offset, __entry->len) 355 ); 356 357 TRACE_EVENT(i915_gem_object_fault, 358 TP_PROTO(struct drm_i915_gem_object *obj, u32 index, bool gtt, bool write), 359 TP_ARGS(obj, index, gtt, write), 360 361 TP_STRUCT__entry( 362 __field(struct drm_i915_gem_object *, obj) 363 __field(u32, index) 364 __field(bool, gtt) 365 __field(bool, write) 366 ), 367 368 TP_fast_assign( 369 __entry->obj = obj; 370 __entry->index = index; 371 __entry->gtt = gtt; 372 __entry->write = write; 373 ), 374 375 TP_printk("obj=%p, %s index=%u %s", 376 __entry->obj, 377 __entry->gtt ? "GTT" : "CPU", 378 __entry->index, 379 __entry->write ? ", writable" : "") 380 ); 381 382 DECLARE_EVENT_CLASS(i915_gem_object, 383 TP_PROTO(struct drm_i915_gem_object *obj), 384 TP_ARGS(obj), 385 386 TP_STRUCT__entry( 387 __field(struct drm_i915_gem_object *, obj) 388 ), 389 390 TP_fast_assign( 391 __entry->obj = obj; 392 ), 393 394 TP_printk("obj=%p", __entry->obj) 395 ); 396 397 DEFINE_EVENT(i915_gem_object, i915_gem_object_clflush, 398 TP_PROTO(struct drm_i915_gem_object *obj), 399 TP_ARGS(obj) 400 ); 401 402 DEFINE_EVENT(i915_gem_object, i915_gem_object_destroy, 403 TP_PROTO(struct drm_i915_gem_object *obj), 404 TP_ARGS(obj) 405 ); 406 407 TRACE_EVENT(i915_gem_evict, 408 TP_PROTO(struct drm_device *dev, u32 size, u32 align, unsigned flags), 409 TP_ARGS(dev, size, align, flags), 410 411 TP_STRUCT__entry( 412 __field(u32, dev) 413 __field(u32, size) 414 __field(u32, align) 415 __field(unsigned, flags) 416 ), 417 418 TP_fast_assign( 419 __entry->dev = dev->primary->index; 420 __entry->size = size; 421 __entry->align = align; 422 __entry->flags = flags; 423 ), 424 425 TP_printk("dev=%d, size=%d, align=%d %s", 426 __entry->dev, __entry->size, __entry->align, 427 __entry->flags & PIN_MAPPABLE ? ", mappable" : "") 428 ); 429 430 TRACE_EVENT(i915_gem_evict_everything, 431 TP_PROTO(struct drm_device *dev), 432 TP_ARGS(dev), 433 434 TP_STRUCT__entry( 435 __field(u32, dev) 436 ), 437 438 TP_fast_assign( 439 __entry->dev = dev->primary->index; 440 ), 441 442 TP_printk("dev=%d", __entry->dev) 443 ); 444 445 TRACE_EVENT(i915_gem_evict_vm, 446 TP_PROTO(struct i915_address_space *vm), 447 TP_ARGS(vm), 448 449 TP_STRUCT__entry( 450 __field(u32, dev) 451 __field(struct i915_address_space *, vm) 452 ), 453 454 TP_fast_assign( 455 __entry->dev = vm->dev->primary->index; 456 __entry->vm = vm; 457 ), 458 459 TP_printk("dev=%d, vm=%p", __entry->dev, __entry->vm) 460 ); 461 462 TRACE_EVENT(i915_gem_ring_sync_to, 463 TP_PROTO(struct drm_i915_gem_request *to_req, 464 struct intel_engine_cs *from, 465 struct drm_i915_gem_request *req), 466 TP_ARGS(to_req, from, req), 467 468 TP_STRUCT__entry( 469 __field(u32, dev) 470 __field(u32, sync_from) 471 __field(u32, sync_to) 472 __field(u32, seqno) 473 ), 474 475 TP_fast_assign( 476 __entry->dev = from->dev->primary->index; 477 __entry->sync_from = from->id; 478 __entry->sync_to = to_req->ring->id; 479 __entry->seqno = i915_gem_request_get_seqno(req); 480 ), 481 482 TP_printk("dev=%u, sync-from=%u, sync-to=%u, seqno=%u", 483 __entry->dev, 484 __entry->sync_from, __entry->sync_to, 485 __entry->seqno) 486 ); 487 488 TRACE_EVENT(i915_gem_ring_dispatch, 489 TP_PROTO(struct drm_i915_gem_request *req, u32 flags), 490 TP_ARGS(req, flags), 491 492 TP_STRUCT__entry( 493 __field(u32, dev) 494 __field(u32, ring) 495 __field(u32, seqno) 496 __field(u32, flags) 497 ), 498 499 TP_fast_assign( 500 struct intel_engine_cs *ring = 501 i915_gem_request_get_ring(req); 502 __entry->dev = ring->dev->primary->index; 503 __entry->ring = ring->id; 504 __entry->seqno = i915_gem_request_get_seqno(req); 505 __entry->flags = flags; 506 i915_trace_irq_get(ring, req); 507 ), 508 509 TP_printk("dev=%u, ring=%u, seqno=%u, flags=%x", 510 __entry->dev, __entry->ring, __entry->seqno, __entry->flags) 511 ); 512 513 TRACE_EVENT(i915_gem_ring_flush, 514 TP_PROTO(struct drm_i915_gem_request *req, u32 invalidate, u32 flush), 515 TP_ARGS(req, invalidate, flush), 516 517 TP_STRUCT__entry( 518 __field(u32, dev) 519 __field(u32, ring) 520 __field(u32, invalidate) 521 __field(u32, flush) 522 ), 523 524 TP_fast_assign( 525 __entry->dev = req->ring->dev->primary->index; 526 __entry->ring = req->ring->id; 527 __entry->invalidate = invalidate; 528 __entry->flush = flush; 529 ), 530 531 TP_printk("dev=%u, ring=%x, invalidate=%04x, flush=%04x", 532 __entry->dev, __entry->ring, 533 __entry->invalidate, __entry->flush) 534 ); 535 536 DECLARE_EVENT_CLASS(i915_gem_request, 537 TP_PROTO(struct drm_i915_gem_request *req), 538 TP_ARGS(req), 539 540 TP_STRUCT__entry( 541 __field(u32, dev) 542 __field(u32, ring) 543 __field(u32, seqno) 544 ), 545 546 TP_fast_assign( 547 struct intel_engine_cs *ring = 548 i915_gem_request_get_ring(req); 549 __entry->dev = ring->dev->primary->index; 550 __entry->ring = ring->id; 551 __entry->seqno = i915_gem_request_get_seqno(req); 552 ), 553 554 TP_printk("dev=%u, ring=%u, seqno=%u", 555 __entry->dev, __entry->ring, __entry->seqno) 556 ); 557 558 DEFINE_EVENT(i915_gem_request, i915_gem_request_add, 559 TP_PROTO(struct drm_i915_gem_request *req), 560 TP_ARGS(req) 561 ); 562 563 TRACE_EVENT(i915_gem_request_notify, 564 TP_PROTO(struct intel_engine_cs *ring), 565 TP_ARGS(ring), 566 567 TP_STRUCT__entry( 568 __field(u32, dev) 569 __field(u32, ring) 570 __field(u32, seqno) 571 ), 572 573 TP_fast_assign( 574 __entry->dev = ring->dev->primary->index; 575 __entry->ring = ring->id; 576 __entry->seqno = ring->get_seqno(ring, false); 577 ), 578 579 TP_printk("dev=%u, ring=%u, seqno=%u", 580 __entry->dev, __entry->ring, __entry->seqno) 581 ); 582 583 DEFINE_EVENT(i915_gem_request, i915_gem_request_retire, 584 TP_PROTO(struct drm_i915_gem_request *req), 585 TP_ARGS(req) 586 ); 587 588 DEFINE_EVENT(i915_gem_request, i915_gem_request_complete, 589 TP_PROTO(struct drm_i915_gem_request *req), 590 TP_ARGS(req) 591 ); 592 593 TRACE_EVENT(i915_gem_request_wait_begin, 594 TP_PROTO(struct drm_i915_gem_request *req), 595 TP_ARGS(req), 596 597 TP_STRUCT__entry( 598 __field(u32, dev) 599 __field(u32, ring) 600 __field(u32, seqno) 601 __field(bool, blocking) 602 ), 603 604 /* NB: the blocking information is racy since mutex_is_locked 605 * doesn't check that the current thread holds the lock. The only 606 * other option would be to pass the boolean information of whether 607 * or not the class was blocking down through the stack which is 608 * less desirable. 609 */ 610 TP_fast_assign( 611 struct intel_engine_cs *ring = 612 i915_gem_request_get_ring(req); 613 __entry->dev = ring->dev->primary->index; 614 __entry->ring = ring->id; 615 __entry->seqno = i915_gem_request_get_seqno(req); 616 __entry->blocking = 617 mutex_is_locked(&ring->dev->struct_mutex); 618 ), 619 620 TP_printk("dev=%u, ring=%u, seqno=%u, blocking=%s", 621 __entry->dev, __entry->ring, 622 __entry->seqno, __entry->blocking ? "yes (NB)" : "no") 623 ); 624 625 DEFINE_EVENT(i915_gem_request, i915_gem_request_wait_end, 626 TP_PROTO(struct drm_i915_gem_request *req), 627 TP_ARGS(req) 628 ); 629 630 TRACE_EVENT(i915_flip_request, 631 TP_PROTO(int plane, struct drm_i915_gem_object *obj), 632 633 TP_ARGS(plane, obj), 634 635 TP_STRUCT__entry( 636 __field(int, plane) 637 __field(struct drm_i915_gem_object *, obj) 638 ), 639 640 TP_fast_assign( 641 __entry->plane = plane; 642 __entry->obj = obj; 643 ), 644 645 TP_printk("plane=%d, obj=%p", __entry->plane, __entry->obj) 646 ); 647 648 TRACE_EVENT(i915_flip_complete, 649 TP_PROTO(int plane, struct drm_i915_gem_object *obj), 650 651 TP_ARGS(plane, obj), 652 653 TP_STRUCT__entry( 654 __field(int, plane) 655 __field(struct drm_i915_gem_object *, obj) 656 ), 657 658 TP_fast_assign( 659 __entry->plane = plane; 660 __entry->obj = obj; 661 ), 662 663 TP_printk("plane=%d, obj=%p", __entry->plane, __entry->obj) 664 ); 665 666 TRACE_EVENT_CONDITION(i915_reg_rw, 667 TP_PROTO(bool write, u32 reg, u64 val, int len, bool trace), 668 669 TP_ARGS(write, reg, val, len, trace), 670 671 TP_CONDITION(trace), 672 673 TP_STRUCT__entry( 674 __field(u64, val) 675 __field(u32, reg) 676 __field(u16, write) 677 __field(u16, len) 678 ), 679 680 TP_fast_assign( 681 __entry->val = (u64)val; 682 __entry->reg = reg; 683 __entry->write = write; 684 __entry->len = len; 685 ), 686 687 TP_printk("%s reg=0x%x, len=%d, val=(0x%x, 0x%x)", 688 __entry->write ? "write" : "read", 689 __entry->reg, __entry->len, 690 (u32)(__entry->val & 0xffffffff), 691 (u32)(__entry->val >> 32)) 692 ); 693 694 TRACE_EVENT(intel_gpu_freq_change, 695 TP_PROTO(u32 freq), 696 TP_ARGS(freq), 697 698 TP_STRUCT__entry( 699 __field(u32, freq) 700 ), 701 702 TP_fast_assign( 703 __entry->freq = freq; 704 ), 705 706 TP_printk("new_freq=%u", __entry->freq) 707 ); 708 709 /** 710 * DOC: i915_ppgtt_create and i915_ppgtt_release tracepoints 711 * 712 * With full ppgtt enabled each process using drm will allocate at least one 713 * translation table. With these traces it is possible to keep track of the 714 * allocation and of the lifetime of the tables; this can be used during 715 * testing/debug to verify that we are not leaking ppgtts. 716 * These traces identify the ppgtt through the vm pointer, which is also printed 717 * by the i915_vma_bind and i915_vma_unbind tracepoints. 718 */ 719 DECLARE_EVENT_CLASS(i915_ppgtt, 720 TP_PROTO(struct i915_address_space *vm), 721 TP_ARGS(vm), 722 723 TP_STRUCT__entry( 724 __field(struct i915_address_space *, vm) 725 __field(u32, dev) 726 ), 727 728 TP_fast_assign( 729 __entry->vm = vm; 730 __entry->dev = vm->dev->primary->index; 731 ), 732 733 TP_printk("dev=%u, vm=%p", __entry->dev, __entry->vm) 734 ) 735 736 DEFINE_EVENT(i915_ppgtt, i915_ppgtt_create, 737 TP_PROTO(struct i915_address_space *vm), 738 TP_ARGS(vm) 739 ); 740 741 DEFINE_EVENT(i915_ppgtt, i915_ppgtt_release, 742 TP_PROTO(struct i915_address_space *vm), 743 TP_ARGS(vm) 744 ); 745 746 /** 747 * DOC: i915_context_create and i915_context_free tracepoints 748 * 749 * These tracepoints are used to track creation and deletion of contexts. 750 * If full ppgtt is enabled, they also print the address of the vm assigned to 751 * the context. 752 */ 753 DECLARE_EVENT_CLASS(i915_context, 754 TP_PROTO(struct intel_context *ctx), 755 TP_ARGS(ctx), 756 757 TP_STRUCT__entry( 758 __field(u32, dev) 759 __field(struct intel_context *, ctx) 760 __field(struct i915_address_space *, vm) 761 ), 762 763 TP_fast_assign( 764 __entry->ctx = ctx; 765 __entry->vm = ctx->ppgtt ? &ctx->ppgtt->base : NULL; 766 __entry->dev = ctx->i915->dev->primary->index; 767 ), 768 769 TP_printk("dev=%u, ctx=%p, ctx_vm=%p", 770 __entry->dev, __entry->ctx, __entry->vm) 771 ) 772 773 DEFINE_EVENT(i915_context, i915_context_create, 774 TP_PROTO(struct intel_context *ctx), 775 TP_ARGS(ctx) 776 ); 777 778 DEFINE_EVENT(i915_context, i915_context_free, 779 TP_PROTO(struct intel_context *ctx), 780 TP_ARGS(ctx) 781 ); 782 783 /** 784 * DOC: switch_mm tracepoint 785 * 786 * This tracepoint allows tracking of the mm switch, which is an important point 787 * in the lifetime of the vm in the legacy submission path. This tracepoint is 788 * called only if full ppgtt is enabled. 789 */ 790 TRACE_EVENT(switch_mm, 791 TP_PROTO(struct intel_engine_cs *ring, struct intel_context *to), 792 793 TP_ARGS(ring, to), 794 795 TP_STRUCT__entry( 796 __field(u32, ring) 797 __field(struct intel_context *, to) 798 __field(struct i915_address_space *, vm) 799 __field(u32, dev) 800 ), 801 802 TP_fast_assign( 803 __entry->ring = ring->id; 804 __entry->to = to; 805 __entry->vm = to->ppgtt? &to->ppgtt->base : NULL; 806 __entry->dev = ring->dev->primary->index; 807 ), 808 809 TP_printk("dev=%u, ring=%u, ctx=%p, ctx_vm=%p", 810 __entry->dev, __entry->ring, __entry->to, __entry->vm) 811 ); 812 813 #endif /* _I915_TRACE_H_ */ 814 815 /* This part must be outside protection */ 816 #undef TRACE_INCLUDE_PATH 817 #define TRACE_INCLUDE_PATH . 818 #include <trace/define_trace.h> 819