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->drm.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 TRACE_EVENT(i915_va_alloc, 179 TP_PROTO(struct i915_vma *vma), 180 TP_ARGS(vma), 181 182 TP_STRUCT__entry( 183 __field(struct i915_address_space *, vm) 184 __field(u64, start) 185 __field(u64, end) 186 ), 187 188 TP_fast_assign( 189 __entry->vm = vma->vm; 190 __entry->start = vma->node.start; 191 __entry->end = vma->node.start + vma->node.size - 1; 192 ), 193 194 TP_printk("vm=%p (%c), 0x%llx-0x%llx", 195 __entry->vm, i915_is_ggtt(__entry->vm) ? 'G' : 'P', __entry->start, __entry->end) 196 ); 197 198 DECLARE_EVENT_CLASS(i915_px_entry, 199 TP_PROTO(struct i915_address_space *vm, u32 px, u64 start, u64 px_shift), 200 TP_ARGS(vm, px, start, px_shift), 201 202 TP_STRUCT__entry( 203 __field(struct i915_address_space *, vm) 204 __field(u32, px) 205 __field(u64, start) 206 __field(u64, end) 207 ), 208 209 TP_fast_assign( 210 __entry->vm = vm; 211 __entry->px = px; 212 __entry->start = start; 213 __entry->end = ((start + (1ULL << px_shift)) & ~((1ULL << px_shift)-1)) - 1; 214 ), 215 216 TP_printk("vm=%p, pde=%d (0x%llx-0x%llx)", 217 __entry->vm, __entry->px, __entry->start, __entry->end) 218 ); 219 220 DEFINE_EVENT(i915_px_entry, i915_page_table_entry_alloc, 221 TP_PROTO(struct i915_address_space *vm, u32 pde, u64 start, u64 pde_shift), 222 TP_ARGS(vm, pde, start, pde_shift) 223 ); 224 225 DEFINE_EVENT_PRINT(i915_px_entry, i915_page_directory_entry_alloc, 226 TP_PROTO(struct i915_address_space *vm, u32 pdpe, u64 start, u64 pdpe_shift), 227 TP_ARGS(vm, pdpe, start, pdpe_shift), 228 229 TP_printk("vm=%p, pdpe=%d (0x%llx-0x%llx)", 230 __entry->vm, __entry->px, __entry->start, __entry->end) 231 ); 232 233 DEFINE_EVENT_PRINT(i915_px_entry, i915_page_directory_pointer_entry_alloc, 234 TP_PROTO(struct i915_address_space *vm, u32 pml4e, u64 start, u64 pml4e_shift), 235 TP_ARGS(vm, pml4e, start, pml4e_shift), 236 237 TP_printk("vm=%p, pml4e=%d (0x%llx-0x%llx)", 238 __entry->vm, __entry->px, __entry->start, __entry->end) 239 ); 240 241 /* Avoid extra math because we only support two sizes. The format is defined by 242 * bitmap_scnprintf. Each 32 bits is 8 HEX digits followed by comma */ 243 #define TRACE_PT_SIZE(bits) \ 244 ((((bits) == 1024) ? 288 : 144) + 1) 245 246 DECLARE_EVENT_CLASS(i915_page_table_entry_update, 247 TP_PROTO(struct i915_address_space *vm, u32 pde, 248 struct i915_page_table *pt, u32 first, u32 count, u32 bits), 249 TP_ARGS(vm, pde, pt, first, count, bits), 250 251 TP_STRUCT__entry( 252 __field(struct i915_address_space *, vm) 253 __field(u32, pde) 254 __field(u32, first) 255 __field(u32, last) 256 __dynamic_array(char, cur_ptes, TRACE_PT_SIZE(bits)) 257 ), 258 259 TP_fast_assign( 260 __entry->vm = vm; 261 __entry->pde = pde; 262 __entry->first = first; 263 __entry->last = first + count - 1; 264 scnprintf(__get_str(cur_ptes), 265 TRACE_PT_SIZE(bits), 266 "%*pb", 267 bits, 268 pt->used_ptes); 269 ), 270 271 TP_printk("vm=%p, pde=%d, updating %u:%u\t%s", 272 __entry->vm, __entry->pde, __entry->last, __entry->first, 273 __get_str(cur_ptes)) 274 ); 275 276 DEFINE_EVENT(i915_page_table_entry_update, i915_page_table_entry_map, 277 TP_PROTO(struct i915_address_space *vm, u32 pde, 278 struct i915_page_table *pt, u32 first, u32 count, u32 bits), 279 TP_ARGS(vm, pde, pt, first, count, bits) 280 ); 281 282 TRACE_EVENT(i915_gem_object_change_domain, 283 TP_PROTO(struct drm_i915_gem_object *obj, u32 old_read, u32 old_write), 284 TP_ARGS(obj, old_read, old_write), 285 286 TP_STRUCT__entry( 287 __field(struct drm_i915_gem_object *, obj) 288 __field(u32, read_domains) 289 __field(u32, write_domain) 290 ), 291 292 TP_fast_assign( 293 __entry->obj = obj; 294 __entry->read_domains = obj->base.read_domains | (old_read << 16); 295 __entry->write_domain = obj->base.write_domain | (old_write << 16); 296 ), 297 298 TP_printk("obj=%p, read=%02x=>%02x, write=%02x=>%02x", 299 __entry->obj, 300 __entry->read_domains >> 16, 301 __entry->read_domains & 0xffff, 302 __entry->write_domain >> 16, 303 __entry->write_domain & 0xffff) 304 ); 305 306 TRACE_EVENT(i915_gem_object_pwrite, 307 TP_PROTO(struct drm_i915_gem_object *obj, u32 offset, u32 len), 308 TP_ARGS(obj, offset, len), 309 310 TP_STRUCT__entry( 311 __field(struct drm_i915_gem_object *, obj) 312 __field(u32, offset) 313 __field(u32, len) 314 ), 315 316 TP_fast_assign( 317 __entry->obj = obj; 318 __entry->offset = offset; 319 __entry->len = len; 320 ), 321 322 TP_printk("obj=%p, offset=%u, len=%u", 323 __entry->obj, __entry->offset, __entry->len) 324 ); 325 326 TRACE_EVENT(i915_gem_object_pread, 327 TP_PROTO(struct drm_i915_gem_object *obj, u32 offset, u32 len), 328 TP_ARGS(obj, offset, len), 329 330 TP_STRUCT__entry( 331 __field(struct drm_i915_gem_object *, obj) 332 __field(u32, offset) 333 __field(u32, len) 334 ), 335 336 TP_fast_assign( 337 __entry->obj = obj; 338 __entry->offset = offset; 339 __entry->len = len; 340 ), 341 342 TP_printk("obj=%p, offset=%u, len=%u", 343 __entry->obj, __entry->offset, __entry->len) 344 ); 345 346 TRACE_EVENT(i915_gem_object_fault, 347 TP_PROTO(struct drm_i915_gem_object *obj, u32 index, bool gtt, bool write), 348 TP_ARGS(obj, index, gtt, write), 349 350 TP_STRUCT__entry( 351 __field(struct drm_i915_gem_object *, obj) 352 __field(u32, index) 353 __field(bool, gtt) 354 __field(bool, write) 355 ), 356 357 TP_fast_assign( 358 __entry->obj = obj; 359 __entry->index = index; 360 __entry->gtt = gtt; 361 __entry->write = write; 362 ), 363 364 TP_printk("obj=%p, %s index=%u %s", 365 __entry->obj, 366 __entry->gtt ? "GTT" : "CPU", 367 __entry->index, 368 __entry->write ? ", writable" : "") 369 ); 370 371 DECLARE_EVENT_CLASS(i915_gem_object, 372 TP_PROTO(struct drm_i915_gem_object *obj), 373 TP_ARGS(obj), 374 375 TP_STRUCT__entry( 376 __field(struct drm_i915_gem_object *, obj) 377 ), 378 379 TP_fast_assign( 380 __entry->obj = obj; 381 ), 382 383 TP_printk("obj=%p", __entry->obj) 384 ); 385 386 DEFINE_EVENT(i915_gem_object, i915_gem_object_clflush, 387 TP_PROTO(struct drm_i915_gem_object *obj), 388 TP_ARGS(obj) 389 ); 390 391 DEFINE_EVENT(i915_gem_object, i915_gem_object_destroy, 392 TP_PROTO(struct drm_i915_gem_object *obj), 393 TP_ARGS(obj) 394 ); 395 396 TRACE_EVENT(i915_gem_evict, 397 TP_PROTO(struct i915_address_space *vm, u32 size, u32 align, unsigned int flags), 398 TP_ARGS(vm, size, align, flags), 399 400 TP_STRUCT__entry( 401 __field(u32, dev) 402 __field(struct i915_address_space *, vm) 403 __field(u32, size) 404 __field(u32, align) 405 __field(unsigned int, flags) 406 ), 407 408 TP_fast_assign( 409 __entry->dev = vm->i915->drm.primary->index; 410 __entry->vm = vm; 411 __entry->size = size; 412 __entry->align = align; 413 __entry->flags = flags; 414 ), 415 416 TP_printk("dev=%d, vm=%p, size=%d, align=%d %s", 417 __entry->dev, __entry->vm, __entry->size, __entry->align, 418 __entry->flags & PIN_MAPPABLE ? ", mappable" : "") 419 ); 420 421 TRACE_EVENT(i915_gem_evict_everything, 422 TP_PROTO(struct drm_device *dev), 423 TP_ARGS(dev), 424 425 TP_STRUCT__entry( 426 __field(u32, dev) 427 ), 428 429 TP_fast_assign( 430 __entry->dev = dev->primary->index; 431 ), 432 433 TP_printk("dev=%d", __entry->dev) 434 ); 435 436 TRACE_EVENT(i915_gem_evict_vm, 437 TP_PROTO(struct i915_address_space *vm), 438 TP_ARGS(vm), 439 440 TP_STRUCT__entry( 441 __field(u32, dev) 442 __field(struct i915_address_space *, vm) 443 ), 444 445 TP_fast_assign( 446 __entry->dev = vm->i915->drm.primary->index; 447 __entry->vm = vm; 448 ), 449 450 TP_printk("dev=%d, vm=%p", __entry->dev, __entry->vm) 451 ); 452 453 TRACE_EVENT(i915_gem_evict_node, 454 TP_PROTO(struct i915_address_space *vm, struct drm_mm_node *node, unsigned int flags), 455 TP_ARGS(vm, node, flags), 456 457 TP_STRUCT__entry( 458 __field(u32, dev) 459 __field(struct i915_address_space *, vm) 460 __field(u64, start) 461 __field(u64, size) 462 __field(unsigned long, color) 463 __field(unsigned int, flags) 464 ), 465 466 TP_fast_assign( 467 __entry->dev = vm->i915->drm.primary->index; 468 __entry->vm = vm; 469 __entry->start = node->start; 470 __entry->size = node->size; 471 __entry->color = node->color; 472 __entry->flags = flags; 473 ), 474 475 TP_printk("dev=%d, vm=%p, start=%llx size=%llx, color=%lx, flags=%x", 476 __entry->dev, __entry->vm, 477 __entry->start, __entry->size, 478 __entry->color, __entry->flags) 479 ); 480 481 TRACE_EVENT(i915_gem_ring_sync_to, 482 TP_PROTO(struct drm_i915_gem_request *to, 483 struct drm_i915_gem_request *from), 484 TP_ARGS(to, from), 485 486 TP_STRUCT__entry( 487 __field(u32, dev) 488 __field(u32, sync_from) 489 __field(u32, sync_to) 490 __field(u32, seqno) 491 ), 492 493 TP_fast_assign( 494 __entry->dev = from->i915->drm.primary->index; 495 __entry->sync_from = from->engine->id; 496 __entry->sync_to = to->engine->id; 497 __entry->seqno = from->global_seqno; 498 ), 499 500 TP_printk("dev=%u, sync-from=%u, sync-to=%u, seqno=%u", 501 __entry->dev, 502 __entry->sync_from, __entry->sync_to, 503 __entry->seqno) 504 ); 505 506 TRACE_EVENT(i915_gem_ring_dispatch, 507 TP_PROTO(struct drm_i915_gem_request *req, u32 flags), 508 TP_ARGS(req, flags), 509 510 TP_STRUCT__entry( 511 __field(u32, dev) 512 __field(u32, ring) 513 __field(u32, seqno) 514 __field(u32, flags) 515 ), 516 517 TP_fast_assign( 518 __entry->dev = req->i915->drm.primary->index; 519 __entry->ring = req->engine->id; 520 __entry->seqno = req->global_seqno; 521 __entry->flags = flags; 522 dma_fence_enable_sw_signaling(&req->fence); 523 ), 524 525 TP_printk("dev=%u, ring=%u, seqno=%u, flags=%x", 526 __entry->dev, __entry->ring, __entry->seqno, __entry->flags) 527 ); 528 529 TRACE_EVENT(i915_gem_ring_flush, 530 TP_PROTO(struct drm_i915_gem_request *req, u32 invalidate, u32 flush), 531 TP_ARGS(req, invalidate, flush), 532 533 TP_STRUCT__entry( 534 __field(u32, dev) 535 __field(u32, ring) 536 __field(u32, invalidate) 537 __field(u32, flush) 538 ), 539 540 TP_fast_assign( 541 __entry->dev = req->i915->drm.primary->index; 542 __entry->ring = req->engine->id; 543 __entry->invalidate = invalidate; 544 __entry->flush = flush; 545 ), 546 547 TP_printk("dev=%u, ring=%x, invalidate=%04x, flush=%04x", 548 __entry->dev, __entry->ring, 549 __entry->invalidate, __entry->flush) 550 ); 551 552 DECLARE_EVENT_CLASS(i915_gem_request, 553 TP_PROTO(struct drm_i915_gem_request *req), 554 TP_ARGS(req), 555 556 TP_STRUCT__entry( 557 __field(u32, dev) 558 __field(u32, ring) 559 __field(u32, seqno) 560 ), 561 562 TP_fast_assign( 563 __entry->dev = req->i915->drm.primary->index; 564 __entry->ring = req->engine->id; 565 __entry->seqno = req->global_seqno; 566 ), 567 568 TP_printk("dev=%u, ring=%u, seqno=%u", 569 __entry->dev, __entry->ring, __entry->seqno) 570 ); 571 572 DEFINE_EVENT(i915_gem_request, i915_gem_request_add, 573 TP_PROTO(struct drm_i915_gem_request *req), 574 TP_ARGS(req) 575 ); 576 577 TRACE_EVENT(i915_gem_request_notify, 578 TP_PROTO(struct intel_engine_cs *engine), 579 TP_ARGS(engine), 580 581 TP_STRUCT__entry( 582 __field(u32, dev) 583 __field(u32, ring) 584 __field(u32, seqno) 585 ), 586 587 TP_fast_assign( 588 __entry->dev = engine->i915->drm.primary->index; 589 __entry->ring = engine->id; 590 __entry->seqno = intel_engine_get_seqno(engine); 591 ), 592 593 TP_printk("dev=%u, ring=%u, seqno=%u", 594 __entry->dev, __entry->ring, __entry->seqno) 595 ); 596 597 DEFINE_EVENT(i915_gem_request, i915_gem_request_retire, 598 TP_PROTO(struct drm_i915_gem_request *req), 599 TP_ARGS(req) 600 ); 601 602 DEFINE_EVENT(i915_gem_request, i915_gem_request_complete, 603 TP_PROTO(struct drm_i915_gem_request *req), 604 TP_ARGS(req) 605 ); 606 607 TRACE_EVENT(i915_gem_request_wait_begin, 608 TP_PROTO(struct drm_i915_gem_request *req), 609 TP_ARGS(req), 610 611 TP_STRUCT__entry( 612 __field(u32, dev) 613 __field(u32, ring) 614 __field(u32, seqno) 615 __field(bool, blocking) 616 ), 617 618 /* NB: the blocking information is racy since mutex_is_locked 619 * doesn't check that the current thread holds the lock. The only 620 * other option would be to pass the boolean information of whether 621 * or not the class was blocking down through the stack which is 622 * less desirable. 623 */ 624 TP_fast_assign( 625 __entry->dev = req->i915->drm.primary->index; 626 __entry->ring = req->engine->id; 627 __entry->seqno = req->global_seqno; 628 __entry->blocking = 629 mutex_is_locked(&req->i915->drm.struct_mutex); 630 ), 631 632 TP_printk("dev=%u, ring=%u, seqno=%u, blocking=%s", 633 __entry->dev, __entry->ring, 634 __entry->seqno, __entry->blocking ? "yes (NB)" : "no") 635 ); 636 637 DEFINE_EVENT(i915_gem_request, i915_gem_request_wait_end, 638 TP_PROTO(struct drm_i915_gem_request *req), 639 TP_ARGS(req) 640 ); 641 642 TRACE_EVENT(i915_flip_request, 643 TP_PROTO(int plane, struct drm_i915_gem_object *obj), 644 645 TP_ARGS(plane, obj), 646 647 TP_STRUCT__entry( 648 __field(int, plane) 649 __field(struct drm_i915_gem_object *, obj) 650 ), 651 652 TP_fast_assign( 653 __entry->plane = plane; 654 __entry->obj = obj; 655 ), 656 657 TP_printk("plane=%d, obj=%p", __entry->plane, __entry->obj) 658 ); 659 660 TRACE_EVENT(i915_flip_complete, 661 TP_PROTO(int plane, struct drm_i915_gem_object *obj), 662 663 TP_ARGS(plane, obj), 664 665 TP_STRUCT__entry( 666 __field(int, plane) 667 __field(struct drm_i915_gem_object *, obj) 668 ), 669 670 TP_fast_assign( 671 __entry->plane = plane; 672 __entry->obj = obj; 673 ), 674 675 TP_printk("plane=%d, obj=%p", __entry->plane, __entry->obj) 676 ); 677 678 TRACE_EVENT_CONDITION(i915_reg_rw, 679 TP_PROTO(bool write, i915_reg_t reg, u64 val, int len, bool trace), 680 681 TP_ARGS(write, reg, val, len, trace), 682 683 TP_CONDITION(trace), 684 685 TP_STRUCT__entry( 686 __field(u64, val) 687 __field(u32, reg) 688 __field(u16, write) 689 __field(u16, len) 690 ), 691 692 TP_fast_assign( 693 __entry->val = (u64)val; 694 __entry->reg = i915_mmio_reg_offset(reg); 695 __entry->write = write; 696 __entry->len = len; 697 ), 698 699 TP_printk("%s reg=0x%x, len=%d, val=(0x%x, 0x%x)", 700 __entry->write ? "write" : "read", 701 __entry->reg, __entry->len, 702 (u32)(__entry->val & 0xffffffff), 703 (u32)(__entry->val >> 32)) 704 ); 705 706 TRACE_EVENT(intel_gpu_freq_change, 707 TP_PROTO(u32 freq), 708 TP_ARGS(freq), 709 710 TP_STRUCT__entry( 711 __field(u32, freq) 712 ), 713 714 TP_fast_assign( 715 __entry->freq = freq; 716 ), 717 718 TP_printk("new_freq=%u", __entry->freq) 719 ); 720 721 /** 722 * DOC: i915_ppgtt_create and i915_ppgtt_release tracepoints 723 * 724 * With full ppgtt enabled each process using drm will allocate at least one 725 * translation table. With these traces it is possible to keep track of the 726 * allocation and of the lifetime of the tables; this can be used during 727 * testing/debug to verify that we are not leaking ppgtts. 728 * These traces identify the ppgtt through the vm pointer, which is also printed 729 * by the i915_vma_bind and i915_vma_unbind tracepoints. 730 */ 731 DECLARE_EVENT_CLASS(i915_ppgtt, 732 TP_PROTO(struct i915_address_space *vm), 733 TP_ARGS(vm), 734 735 TP_STRUCT__entry( 736 __field(struct i915_address_space *, vm) 737 __field(u32, dev) 738 ), 739 740 TP_fast_assign( 741 __entry->vm = vm; 742 __entry->dev = vm->i915->drm.primary->index; 743 ), 744 745 TP_printk("dev=%u, vm=%p", __entry->dev, __entry->vm) 746 ) 747 748 DEFINE_EVENT(i915_ppgtt, i915_ppgtt_create, 749 TP_PROTO(struct i915_address_space *vm), 750 TP_ARGS(vm) 751 ); 752 753 DEFINE_EVENT(i915_ppgtt, i915_ppgtt_release, 754 TP_PROTO(struct i915_address_space *vm), 755 TP_ARGS(vm) 756 ); 757 758 /** 759 * DOC: i915_context_create and i915_context_free tracepoints 760 * 761 * These tracepoints are used to track creation and deletion of contexts. 762 * If full ppgtt is enabled, they also print the address of the vm assigned to 763 * the context. 764 */ 765 DECLARE_EVENT_CLASS(i915_context, 766 TP_PROTO(struct i915_gem_context *ctx), 767 TP_ARGS(ctx), 768 769 TP_STRUCT__entry( 770 __field(u32, dev) 771 __field(struct i915_gem_context *, ctx) 772 __field(struct i915_address_space *, vm) 773 ), 774 775 TP_fast_assign( 776 __entry->ctx = ctx; 777 __entry->vm = ctx->ppgtt ? &ctx->ppgtt->base : NULL; 778 __entry->dev = ctx->i915->drm.primary->index; 779 ), 780 781 TP_printk("dev=%u, ctx=%p, ctx_vm=%p", 782 __entry->dev, __entry->ctx, __entry->vm) 783 ) 784 785 DEFINE_EVENT(i915_context, i915_context_create, 786 TP_PROTO(struct i915_gem_context *ctx), 787 TP_ARGS(ctx) 788 ); 789 790 DEFINE_EVENT(i915_context, i915_context_free, 791 TP_PROTO(struct i915_gem_context *ctx), 792 TP_ARGS(ctx) 793 ); 794 795 /** 796 * DOC: switch_mm tracepoint 797 * 798 * This tracepoint allows tracking of the mm switch, which is an important point 799 * in the lifetime of the vm in the legacy submission path. This tracepoint is 800 * called only if full ppgtt is enabled. 801 */ 802 TRACE_EVENT(switch_mm, 803 TP_PROTO(struct intel_engine_cs *engine, struct i915_gem_context *to), 804 805 TP_ARGS(engine, to), 806 807 TP_STRUCT__entry( 808 __field(u32, ring) 809 __field(struct i915_gem_context *, to) 810 __field(struct i915_address_space *, vm) 811 __field(u32, dev) 812 ), 813 814 TP_fast_assign( 815 __entry->ring = engine->id; 816 __entry->to = to; 817 __entry->vm = to->ppgtt? &to->ppgtt->base : NULL; 818 __entry->dev = engine->i915->drm.primary->index; 819 ), 820 821 TP_printk("dev=%u, ring=%u, ctx=%p, ctx_vm=%p", 822 __entry->dev, __entry->ring, __entry->to, __entry->vm) 823 ); 824 825 #endif /* _I915_TRACE_H_ */ 826 827 /* This part must be outside protection */ 828 #undef TRACE_INCLUDE_PATH 829 #define TRACE_INCLUDE_PATH . 830 #include <trace/define_trace.h> 831