Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [RFC 0/2] Add tracepoints to profile SVM page faults and migration
@ 2025-09-09 15:03 Francois Dugast
  2025-09-09 15:03 ` [RFC 1/2] drm/xe/migrate: Add tracepoint during VRAM copy Francois Dugast
                   ` (5 more replies)
  0 siblings, 6 replies; 13+ messages in thread
From: Francois Dugast @ 2025-09-09 15:03 UTC (permalink / raw)
  To: intel-xe; +Cc: matthew.brost, michal.mrozek, Francois Dugast

Xe already provides various tracepoints thanks to the infrastructure in
xe_trace. Add a few more new tracepoints specifically to debug and profile
SVM page faults and migration. This can be useful when developing with SVM
in KMD, in UMD, or in applications. Those are standard tracepoints which
can be used with standard usespace tools such as bpftrace:

    $ sudo bpftrace -e 'tracepoint:xe:xe_migrate_vram { printf("Migrating 0x%lx bytes at %llx\n", args->len, args->vram_addr); }'
    Attaching 1 probe...
    Migrating 0x200000 bytes at 2fae00000
    Migrating 0x200000 bytes at 2fae00000
    Migrating 0x200000 bytes at 2fac00000

Another way without bpftrace is to enable them manually:

    $ echo 1 | sudo tee /sys/kernel/tracing/events/xe/xe_handle_svm_pagefault/enable
    $ echo 1 | sudo tee /sys/kernel/tracing/events/xe/xe_handle_vma_pagefault/enable
    $ echo 1 | sudo tee /sys/kernel/tracing/events/xe/xe_migrate_vram/enable
    $ echo 1 | sudo tee /sys/kernel/tracing/tracing_on

After this, run the workload, then the trace is visible in
/sys/kernel/tracing/trace:

# tracer: nop
#
# entries-in-buffer/entries-written: 202/202   #P:16
#
#                                _-----=> irqs-off/BH-disabled
#                               / _----=> need-resched
#                              | / _---=> hardirq/softirq
#                              || / _--=> preempt-depth
#                              ||| / _-=> migrate-disable
#                              |||| /     delay
#           TASK-PID     CPU#  |||||  TIMESTAMP  FUNCTION
#              | |         |   |||||     |         |
 xe_exec_system_-1375    [002] .....   120.736639: tracing_mark_write: xe_exec_system_allocator: executing
 xe_exec_system_-1375    [003] .....   122.588912: tracing_mark_write: xe_exec_system_allocator: starting subtest compute-basic
   kworker/u65:0-674     [012] .....   122.632024: xe_handle_vma_pagefault: dev=0000:00:08.0 addr=100000 fault_type=0 access_type=0 fault_level=0 engine_class=0 rcs engine_instance=0
   kworker/u65:0-674     [012] .....   122.633158: xe_handle_vma_pagefault: dev=0000:00:08.0 addr=83e0000 fault_type=0 access_type=0 fault_level=0 engine_class=0 rcs engine_instance=0
   kworker/u65:0-674     [012] .....   122.633956: xe_handle_vma_pagefault: dev=0000:00:08.0 addr=83e0000 fault_type=0 access_type=0 fault_level=0 engine_class=0 rcs engine_instance=0
   kworker/u65:0-674     [012] .....   122.633982: xe_handle_vma_pagefault: dev=0000:00:08.0 addr=83e0000 fault_type=0 access_type=0 fault_level=0 engine_class=0 rcs engine_instance=0
   ...
   kworker/u65:0-674     [012] .....   122.636255: xe_handle_vma_pagefault: dev=0000:00:08.0 addr=63d0000 fault_type=0 access_type=0 fault_level=0 engine_class=0 rcs engine_instance=0
   kworker/u65:0-674     [012] .....   122.636263: xe_handle_svm_pagefault: dev=0000:00:08.0 addr=7f03f0611000 fault_type=0 access_type=0 fault_level=0 engine_class=0 rcs engine_instance=0
   kworker/u65:0-674     [012] .....   122.638854: xe_migrate_vram: dev=0000:00:08.0 len=200000 vram_addr=2fae00000 dir=TO_VRAM
   kworker/u65:0-674     [012] .....   122.641581: xe_handle_svm_pagefault: dev=0000:00:08.0 addr=7f03f0611000 fault_type=0 access_type=0 fault_level=0 engine_class=0 rcs engine_instance=0
   kworker/u65:0-674     [012] .....   122.641593: xe_handle_svm_pagefault: dev=0000:00:08.0 addr=7f03f0612000 fault_type=0 access_type=0 fault_level=0 engine_class=0 rcs engine_instance=0
   kworker/u65:0-674     [012] .....   122.641600: xe_handle_svm_pagefault: dev=0000:00:08.0 addr=7f03f0612000 fault_type=0 access_type=0 fault_level=0 engine_class=0 rcs engine_instance=0
   ...
   kworker/u65:0-674     [012] .....   122.645512: xe_handle_svm_pagefault: dev=0000:00:08.0 addr=7f03f020f000 fault_type=0 access_type=0 fault_level=0 engine_class=0 rcs engine_instance=0
   kworker/u65:0-674     [012] .....   122.645520: xe_handle_svm_pagefault: dev=0000:00:08.0 addr=7f03f0245000 fault_type=0 access_type=0 fault_level=0 engine_class=0 rcs engine_instance=0
   kworker/u65:0-674     [012] .....   122.645648: xe_handle_vma_pagefault: dev=0000:00:08.0 addr=10000 fault_type=0 access_type=0 fault_level=0 engine_class=0 rcs engine_instance=0
 xe_exec_system_-1375    [003] .....   122.646985: xe_migrate_vram: dev=0000:00:08.0 len=200000 vram_addr=2fae00000 dir=TO_SRAM
 xe_exec_system_-1375    [003] .....   122.649282: xe_migrate_vram: dev=0000:00:08.0 len=200000 vram_addr=2fac00000 dir=TO_SRAM
 xe_exec_system_-1375    [003] .....   122.667223: tracing_mark_write: xe_exec_system_allocator: finished subtest compute-basic, SUCCESS


Francois Dugast (2):
  drm/xe/migrate: Add tracepoint during VRAM copy
  drm/xe/gt_pagefault: Add tracepoints when handing page faults

 drivers/gpu/drm/xe/xe_gt_pagefault.c       | 22 ++-----
 drivers/gpu/drm/xe/xe_gt_pagefault_types.h | 25 ++++++++
 drivers/gpu/drm/xe/xe_migrate.c            |  9 ++-
 drivers/gpu/drm/xe/xe_migrate_types.h      | 14 +++++
 drivers/gpu/drm/xe/xe_trace.h              | 72 ++++++++++++++++++++++
 5 files changed, 121 insertions(+), 21 deletions(-)
 create mode 100644 drivers/gpu/drm/xe/xe_gt_pagefault_types.h
 create mode 100644 drivers/gpu/drm/xe/xe_migrate_types.h

-- 
2.43.0


^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2025-09-10 17:58 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-09 15:03 [RFC 0/2] Add tracepoints to profile SVM page faults and migration Francois Dugast
2025-09-09 15:03 ` [RFC 1/2] drm/xe/migrate: Add tracepoint during VRAM copy Francois Dugast
2025-09-09 19:03   ` Summers, Stuart
2025-09-09 15:03 ` [RFC 2/2] drm/xe/gt_pagefault: Add tracepoints when handing page faults Francois Dugast
2025-09-09 19:08   ` Summers, Stuart
2025-09-09 20:29     ` Matthew Brost
2025-09-10 17:33       ` Summers, Stuart
2025-09-10  7:59     ` Francois Dugast
2025-09-10 17:57       ` Summers, Stuart
2025-09-09 15:11 ` ✗ CI.checkpatch: warning for Add tracepoints to profile SVM page faults and migration Patchwork
2025-09-09 15:12 ` ✓ CI.KUnit: success " Patchwork
2025-09-09 15:47 ` ✓ Xe.CI.BAT: " Patchwork
2025-09-09 20:43 ` ✗ Xe.CI.Full: failure " Patchwork

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox