Skip to content

GPU debug support (eudebug)

Mika Kuoppala intel-xe 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest21 patches 40 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/21drm/xe: Export xe_hw_engine's mmio accessorsdrivers/gpu/drm/xe/xe_hw_engine.c drivers/gpu/drm/xe/xe_hw_engine.h+7 -32 replies
2/21drm/xe: Move and export xe_hw_engine lookup.drivers/gpu/drm/xe/xe_exec_queue.c drivers/gpu/drm/xe/xe_hw_engine.c drivers/gpu/drm/xe/xe_hw_engine.h+41 -332 replies
3/21drm/xe/eudebug: Introduce eudebug supportdrivers/gpu/drm/xe/Makefile drivers/gpu/drm/xe/xe_device.c drivers/gpu/drm/xe/xe_device_types.h +6 more+1425 -27 replies
4/21kernel: export ptrace_may_accesskernel/ptrace.c+1 -03 replies
5/21drm/xe/eudebug: Use ptrace_may_access for xe_eudebug_attachdrivers/gpu/drm/xe/xe_eudebug.c+1 -21 reply
6/21drm/xe/eudebug: Introduce discovery for resourcesdrivers/gpu/drm/xe/xe_device.c drivers/gpu/drm/xe/xe_device_types.h drivers/gpu/drm/xe/xe_eudebug.c +1 more+106 -10 replies
7/21drm/xe/eudebug: Introduce exec_queue eventsdrivers/gpu/drm/xe/xe_eudebug.c drivers/gpu/drm/xe/xe_eudebug.h drivers/gpu/drm/xe/xe_eudebug_types.h +2 more+235 -30 replies
8/21drm/xe/eudebug: hw enablement for eudebugdrivers/gpu/drm/xe/regs/xe_engine_regs.h drivers/gpu/drm/xe/regs/xe_gt_regs.h drivers/gpu/drm/xe/xe_eudebug.c +2 more+68 -04 replies
9/21drm/xe: Add EUDEBUG_ENABLE exec queue propertydrivers/gpu/drm/xe/regs/xe_engine_regs.h drivers/gpu/drm/xe/xe_exec_queue.c drivers/gpu/drm/xe/xe_exec_queue_types.h +4 more+60 -82 replies
10/21drm/xe/eudebug: Introduce per device attention scan workerdrivers/gpu/drm/xe/Makefile drivers/gpu/drm/xe/regs/xe_engine_regs.h drivers/gpu/drm/xe/regs/xe_gt_regs.h +8 more+624 -24 replies
11/21drm/xe/eudebug: Introduce EU control interfacedrivers/gpu/drm/xe/regs/xe_gt_regs.h drivers/gpu/drm/xe/xe_eudebug.c drivers/gpu/drm/xe/xe_eudebug_types.h +3 more+586 -370 replies
12/21drm/xe/eudebug: Add vm bind and vm bind opsdrivers/gpu/drm/xe/xe_eudebug.c drivers/gpu/drm/xe/xe_eudebug.h drivers/gpu/drm/xe/xe_eudebug_types.h +3 more+425 -30 replies
13/21drm/xe/eudebug: Add UFENCE events with acksdrivers/gpu/drm/xe/xe_eudebug.c drivers/gpu/drm/xe/xe_eudebug.h drivers/gpu/drm/xe/xe_eudebug_types.h +6 more+333 -283 replies
14/21drm/xe/eudebug: vm open/pread/pwritedrivers/gpu/drm/xe/regs/xe_gt_regs.h drivers/gpu/drm/xe/xe_eudebug.c include/uapi/drm/xe_drm_eudebug.h+512 -01 reply
15/21drm/xe/eudebug: implement userptr_vma accessdrivers/gpu/drm/xe/xe_eudebug.c+55 -111 replies
16/21drm/xe: Debug metadata create/destroy ioctlsdrivers/gpu/drm/xe/Makefile drivers/gpu/drm/xe/xe_debug_metadata.c drivers/gpu/drm/xe/xe_debug_metadata.h +4 more+236 -10 replies
17/21drm/xe: Attach debug metadata to vmadrivers/gpu/drm/xe/xe_debug_metadata.c drivers/gpu/drm/xe/xe_debug_metadata.h drivers/gpu/drm/xe/xe_vm.c +2 more+243 -41 reply
18/21drm/xe/eudebug: Add debug metadata support for xe_eudebugdrivers/gpu/drm/xe/xe_debug_metadata.c drivers/gpu/drm/xe/xe_eudebug.c drivers/gpu/drm/xe/xe_eudebug.h +3 more+392 -100 replies
19/21drm/xe/eudebug: Implement vm_bind_op discoverydrivers/gpu/drm/xe/xe_eudebug.c+40 -01 reply
20/21drm/xe/eudebug: Dynamically toggle debugger functionalitydrivers/gpu/drm/xe/xe_device.c drivers/gpu/drm/xe/xe_device_types.h drivers/gpu/drm/xe/xe_eudebug.c +7 more+178 -374 replies
21/21drm/xe/eudebug_test: Introduce xe_eudebug wa kunit testdrivers/gpu/drm/xe/tests/xe_eudebug.c drivers/gpu/drm/xe/tests/xe_live_test_mod.c drivers/gpu/drm/xe/xe_eudebug.c+176 -00 replies

Reviews trailers per patch

4 of 21 patches have a Reviewed-by or Acked-by.

PatchMatthew BrostJonathan CavittAndi Shyti
1/21R-b
2/21R-b
3/21
4/21R-b
5/21
6/21
7/21
8/21
9/21
10/21
11/21
12/21
13/21
14/21
15/21R-b R-b
16/21
17/21
18/21
19/21
20/21
21/21

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 3 reviewers.

Read the v1 thread

Cover letter [PATCH 00/21] GPU debug support (eudebug)

Hi,

We (Intel eudebug kernel team) would like to submit this patchset to enable debug support for Intel GPU devices.

The aim is to allow Level-Zero + GDB (or some other tool) to attach to xe driver in order to receive information about relevant driver resources, hardware events and to allow debug related hardware control. End goal is full debug capability of supported Intel hardware, see [4].

Debugger first opens a connection to a device through drm ioctl with debug target process as a pid. This will return a dedicated file descriptor used for debugging for further events and control.

Xe internal resources that are considered essential to debugger functionality are relayed as events to the debugger. On debugger connection, all existing resources are relayed to debugger (discovery) and from that point onwards, as they are created/destroyed.

uapi is extended to allow an application/lib to provide debug metadata information. These are relayed as events to the debugger so it can decode the program state.

Along with the resource and metadata events, an event for hardware exceptions, called EU attention, is provided. The debugger, with the assistance of an exception handling program called System Routine (short: SIP) provided with the pipeline setup, can determine which specific EU/thread and instruction encountered the breakpoint or other exceptions.

EU controlling ioctl interface is also introduced where debugger can manipulate individual threads of the currently active workload. This interface enables the debugger to interrupt all threads on demand, check their current state and resume them individually.

The intent is to provide a similar but not API compatible functionality as in out-of-tree i915 debugger support:
https://dgpu-docs.intel.com/driver/gpu-debugging.html

For xe the aim is to have all support merged in upstream, starting with this series. With Lunarlake being first targetted hardware.

I have split the events into xe_drm_eudebug.h instead pushing everything into xe_drm.h, in order to help distinguish what is controlled by which descriptor. If it's through the original xe fd, it is in xe_drm.h and if it's through the opened debugger connection fd, it is in xe_drm_eudebug.h.

Latest code can be found in:
[1] https://gitlab.freedesktop.org/miku/kernel/-/tree/eudebug-dev

With the associated IGT tests:
[2] https://gitlab.freedesktop.org/cmanszew/igt-gpu-tools/-/tree/eudebug-dev

The user for this uapi:
[3] https://github.com/intel/compute-runtime
Event loop and thread control interaction can be found at:
https://github.com/intel/compute-runtime/tree/master/level_zero/tools/source/debug/linux/xe
And the wrappers in:
https://github.com/intel/compute-runtime/tree/master/shared/source/os_interface/linux/xe
https://github.com/intel/compute-runtime/blob/master/shared/source/os_interface/linux/xe/ioctl_helper_xe_debugger.cpp
Note that the XE support is disabled by default and you will need NEO_ENABLE_XE_EU_DEBUG_SUPPORT enabled in order to test.

GDB support:
[4]: https://sourceware.org/pipermail/gdb-patches/2024-July/210264.html

Thank you in advance for any comments and insight.

Andrzej Hajda (1):
drm/xe/eudebug: implement userptr_vma access

Christoph Manszewski (3):
drm/xe/eudebug: Add vm bind and vm bind ops drm/xe/eudebug: Dynamically toggle debugger functionality drm/xe/eudebug_test: Introduce xe_eudebug wa kunit test

Dominik Grzegorzek (10):
drm/xe: Export xe_hw_engine's mmio accessors drm/xe: Move and export xe_hw_engine lookup. drm/xe/eudebug: Introduce exec_queue events drm/xe/eudebug: hw enablement for eudebug drm/xe: Add EUDEBUG_ENABLE exec queue property drm/xe/eudebug: Introduce per device attention scan worker drm/xe/eudebug: Introduce EU control interface drm/xe: Debug metadata create/destroy ioctls drm/xe: Attach debug metadata to vma drm/xe/eudebug: Add debug metadata support for xe_eudebug

Jonathan Cavitt (1):
drm/xe/eudebug: Use ptrace_may_access for xe_eudebug_attach

Mika Kuoppala (6):
drm/xe/eudebug: Introduce eudebug support
kernel: export ptrace_may_access drm/xe/eudebug: Introduce discovery for resources drm/xe/eudebug: Add UFENCE events with acks drm/xe/eudebug: vm open/pread/pwrite drm/xe/eudebug: Implement vm_bind_op discovery

 drivers/gpu/drm/xe/Makefile                  |    5 +-
 drivers/gpu/drm/xe/regs/xe_engine_regs.h     |    8 +
 drivers/gpu/drm/xe/regs/xe_gt_regs.h         |   43 +
 drivers/gpu/drm/xe/tests/xe_eudebug.c        |  170 +
 drivers/gpu/drm/xe/tests/xe_live_test_mod.c  |    2 +
 drivers/gpu/drm/xe/xe_debug_metadata.c       |  125 +
 drivers/gpu/drm/xe/xe_debug_metadata.h       |   25 +
 drivers/gpu/drm/xe/xe_debug_metadata_types.h |   28 +
 drivers/gpu/drm/xe/xe_device.c               |   47 +-
 drivers/gpu/drm/xe/xe_device_types.h         |   45 +
 drivers/gpu/drm/xe/xe_eudebug.c              | 3841 ++++++++++++++++++
 drivers/gpu/drm/xe/xe_eudebug.h              |   51 +
 drivers/gpu/drm/xe/xe_eudebug_types.h        |  326 ++
 drivers/gpu/drm/xe/xe_exec.c                 |    2 +-
 drivers/gpu/drm/xe/xe_exec_queue.c           |   80 +-
 drivers/gpu/drm/xe/xe_exec_queue_types.h     |    7 +
 drivers/gpu/drm/xe/xe_gt_debug.c             |  152 +
 drivers/gpu/drm/xe/xe_gt_debug.h             |   27 +
 drivers/gpu/drm/xe/xe_hw_engine.c            |   39 +-
 drivers/gpu/drm/xe/xe_hw_engine.h            |   11 +
 drivers/gpu/drm/xe/xe_lrc.c                  |   16 +-
 drivers/gpu/drm/xe/xe_lrc.h                  |    4 +-
 drivers/gpu/drm/xe/xe_reg_sr.c               |   21 +-
 drivers/gpu/drm/xe/xe_reg_sr.h               |    4 +-
 drivers/gpu/drm/xe/xe_rtp.c                  |    2 +-
 drivers/gpu/drm/xe/xe_rtp_types.h            |    1 +
 drivers/gpu/drm/xe/xe_sync.c                 |   49 +-
 drivers/gpu/drm/xe/xe_sync.h                 |    8 +-
 drivers/gpu/drm/xe/xe_sync_types.h           |   26 +-
 drivers/gpu/drm/xe/xe_vm.c                   |  227 +-
 drivers/gpu/drm/xe/xe_vm_types.h             |   26 +
 include/uapi/drm/xe_drm.h                    |   96 +-
 include/uapi/drm/xe_drm_eudebug.h            |  226 ++
 kernel/ptrace.c                              |    1 +
 34 files changed, 5655 insertions(+), 86 deletions(-)
 create mode 100644 drivers/gpu/drm/xe/tests/xe_eudebug.c
 create mode 100644 drivers/gpu/drm/xe/xe_debug_metadata.c
 create mode 100644 drivers/gpu/drm/xe/xe_debug_metadata.h
 create mode 100644 drivers/gpu/drm/xe/xe_debug_metadata_types.h
 create mode 100644 drivers/gpu/drm/xe/xe_eudebug.c
 create mode 100644 drivers/gpu/drm/xe/xe_eudebug.h
 create mode 100644 drivers/gpu/drm/xe/xe_eudebug_types.h
 create mode 100644 drivers/gpu/drm/xe/xe_gt_debug.c
 create mode 100644 drivers/gpu/drm/xe/xe_gt_debug.h
 create mode 100644 include/uapi/drm/xe_drm_eudebug.h
Signature · 1 line
2.34.1