debugging.rst 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. ===============
  2. GPU Debugging
  3. ===============
  4. General Debugging Options
  5. =========================
  6. The DebugFS section provides documentation on a number files to aid in debugging
  7. issues on the GPU.
  8. GPUVM Debugging
  9. ===============
  10. To aid in debugging GPU virtual memory related problems, the driver supports a
  11. number of options module parameters:
  12. `vm_fault_stop` - If non-0, halt the GPU memory controller on a GPU page fault.
  13. `vm_update_mode` - If non-0, use the CPU to update GPU page tables rather than
  14. the GPU.
  15. Decoding a GPUVM Page Fault
  16. ===========================
  17. If you see a GPU page fault in the kernel log, you can decode it to figure
  18. out what is going wrong in your application. A page fault in your kernel
  19. log may look something like this:
  20. ::
  21. [gfxhub0] no-retry page fault (src_id:0 ring:24 vmid:3 pasid:32777, for process glxinfo pid 2424 thread glxinfo:cs0 pid 2425)
  22. in page starting at address 0x0000800102800000 from IH client 0x1b (UTCL2)
  23. VM_L2_PROTECTION_FAULT_STATUS:0x00301030
  24. Faulty UTCL2 client ID: TCP (0x8)
  25. MORE_FAULTS: 0x0
  26. WALKER_ERROR: 0x0
  27. PERMISSION_FAULTS: 0x3
  28. MAPPING_ERROR: 0x0
  29. RW: 0x0
  30. First you have the memory hub, gfxhub and mmhub. gfxhub is the memory
  31. hub used for graphics, compute, and sdma on some chips. mmhub is the
  32. memory hub used for multi-media and sdma on some chips.
  33. Next you have the vmid and pasid. If the vmid is 0, this fault was likely
  34. caused by the kernel driver or firmware. If the vmid is non-0, it is generally
  35. a fault in a user application. The pasid is used to link a vmid to a system
  36. process id. If the process is active when the fault happens, the process
  37. information will be printed.
  38. The GPU virtual address that caused the fault comes next.
  39. The client ID indicates the GPU block that caused the fault.
  40. Some common client IDs:
  41. - CB/DB: The color/depth backend of the graphics pipe
  42. - CPF: Command Processor Frontend
  43. - CPC: Command Processor Compute
  44. - CPG: Command Processor Graphics
  45. - TCP/SQC/SQG: Shaders
  46. - SDMA: SDMA engines
  47. - VCN: Video encode/decode engines
  48. - JPEG: JPEG engines
  49. PERMISSION_FAULTS describe what faults were encountered:
  50. - bit 0: the PTE was not valid
  51. - bit 1: the PTE read bit was not set
  52. - bit 2: the PTE write bit was not set
  53. - bit 3: the PTE execute bit was not set
  54. Finally, RW, indicates whether the access was a read (0) or a write (1).
  55. In the example above, a shader (cliend id = TCP) generated a read (RW = 0x0) to
  56. an invalid page (PERMISSION_FAULTS = 0x3) at GPU virtual address
  57. 0x0000800102800000. The user can then inspect their shader code and resource
  58. descriptor state to determine what caused the GPU page fault.
  59. UMR
  60. ===
  61. `umr <https://gitlab.freedesktop.org/tomstdenis/umr>`_ is a general purpose
  62. GPU debugging and diagnostics tool. Please see the umr
  63. `documentation <https://umr.readthedocs.io/en/main/>`_ for more information
  64. about its capabilities.
  65. Debugging backlight brightness
  66. ==============================
  67. Default backlight brightness is intended to be set via the policy advertised
  68. by the firmware. Firmware will often provide different defaults for AC or DC.
  69. Furthermore, some userspace software will save backlight brightness during
  70. the previous boot and attempt to restore it.
  71. Some firmware also has support for a feature called "Custom Backlight Curves"
  72. where an input value for brightness is mapped along a linearly interpolated
  73. curve of brightness values that better match display characteristics.
  74. In the event of problems happening with backlight, there is a trace event
  75. that can be enabled at bootup to log every brightness change request.
  76. This can help isolate where the problem is. To enable the trace event add
  77. the following to the kernel command line:
  78. tp_printk trace_event=amdgpu_dm:amdgpu_dm_brightness:mod:amdgpu trace_buf_size=1M