← Documents Documentation/gpu/amdgpu/debugging.rst GitHub 원문 ↗

Linux 6.18.37 · GPU

GPU Debugging

AMDGPU GPUVM page fault decode와 backlight brightness trace 절차의 전문 번역입니다.

Source pathDocumentation/gpu/amdgpu/debugging.rst
Source versionLinux v6.18.37
TranslationDUJINLABS 전문 번역 + 해설

요약·해설과 원문, 전문 번역을 서로 분리했습니다. API 이름, symbol, source path는 원문 표기를 사용합니다.

1. 요약·해설

원문의 핵심 논리와 kernel programming 관점의 보충 설명입니다. 아래의 전문 번역과는 별도로 작성했습니다.

요약·해설

debugging.rst:1-105

AMDGPU GPUVM page fault와 backlight brightness 문제를 조사하는 문서입니다. GPUVM module parameter, kernel log field, memory hub와 VMID/PASID, client ID, permission bit, RW 방향, UMR 자료와 boot-time brightness trace option을 전문 번역했습니다.

Page fault 조사의 핵심은 log를 순서대로 해석하는 것입니다. `vmid == 0` 여부로 kernel/firmware 가능성을 먼저 분류하고, client block과 fault address를 찾은 뒤 `PERMISSION_FAULTS` bitmask와 `RW`를 결합해 잘못된 page-table permission과 접근 방향을 확인합니다.

AMDGPU debugging 조사 지도
증상첫 진입점핵심 증거
일반 GPU 상태·hangAMDGPU DebugFSring, MQD, fence, power, memory, register
GPU page faultkernel log + GPUVM optionhub, vmid, pasid, address, client ID, permission, RW
shader·register 분석UMRraw ring, wave, GPR, VRAM/GTT와 register
backlight 변화amdgpu_dm_brightness traceboot 이후 모든 brightness change request

증상별 첫 진입점과 핵심 증거입니다.

2. 영어 원문 전체

번역 기준이 된 Linux v6.18.37 원문입니다. 줄 번호는 이 버전의 파일 좌표입니다.

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

3. 한국어 전문 번역

영어 원문의 문단 순서와 의미를 유지한 전체 번역입니다. 코드, 함수명, symbol과 URL은 원문 표기를 유지합니다.

일반 GPU debugging 진입점

1-10

GPU 문제를 조사할 때 먼저 AMDGPU DebugFS 문서의 interface를 확인합니다. Debugfs file은 ring, MQD, fence, power, memory, register와 firmware 상태를 관찰하거나 test·reset 같은 동작을 실행하는 진단 수단입니다.

Debugfs는 보통 `/sys/kernel/debug/dri/<num>` 아래에 있으며 안정된 userspace ABI가 아닙니다. 대상 DRM device와 file의 side effect를 확인한 뒤 사용해야 합니다.

GPU debugging 진입점
자료주요 역할
AMDGPU DebugFS장치별 진단 file, raw data, 상태와 제어 interface
GPUVM Debuggingpage fault 정지·page-table update 방식과 fault log 해석
UMR범용 AMD GPU register·wave·memory 진단 도구
Backlight tracebrightness change request의 발생 지점 추적

이 문서와 AMDGPU DebugFS 문서의 역할을 구분합니다.

===============
 GPU Debugging
===============

General Debugging Options
=========================

The DebugFS section provides documentation on a number files to aid in debugging
issues on the GPU.

GPUVM debugging module parameter

11-22

Driver는 GPU virtual memory 문제를 조사하기 위한 module parameter를 제공합니다. 두 option 모두 값이 0이 아닐 때 동작이 바뀌며, 재현 조건과 성능·진행 상태에 영향을 줄 수 있으므로 debugging 목적으로 사용합니다.

GPUVM debugging option
Parameter0이 아닐 때의 동작진단 관점
vm_fault_stopGPU page fault가 발생하면 GPU memory controller를 정지fault 직후 상태를 보존해 조사
vm_update_modeGPU 대신 CPU가 GPU page table을 updateGPU page-table update 경로를 배제해 문제 범위 축소

두 module parameter의 non-zero 동작을 원문 그대로 정리했습니다.


GPUVM Debugging
===============

To aid in debugging GPU virtual memory related problems, the driver supports a
number of options module parameters:

`vm_fault_stop` - If non-0, halt the GPU memory controller on a GPU page fault.

`vm_update_mode` - If non-0, use the CPU to update GPU page tables rather than
the GPU.

GPUVM page fault log의 구조

23-42

Kernel log에 GPU page fault가 나타나면 memory hub, `vmid`, `pasid`, process, fault address, IH client, `VM_L2_PROTECTION_FAULT_STATUS`의 하위 필드를 순서대로 읽어 application에서 무엇이 잘못됐는지 좁힐 수 있습니다.

아래 log는 원문의 예시를 그대로 보존합니다. `gfxhub0`, ring 24, `vmid:3`, `pasid:32777`, process와 thread 정보, GPU virtual address, UTCL2 client, permission과 read/write 상태가 함께 기록됩니다.

 [gfxhub0] no-retry page fault (src_id:0 ring:24 vmid:3 pasid:32777, for process glxinfo pid 2424 thread glxinfo:cs0 pid 2425)
   in page starting at address 0x0000800102800000 from IH client 0x1b (UTCL2)
 VM_L2_PROTECTION_FAULT_STATUS:0x00301030
         Faulty UTCL2 client ID: TCP (0x8)
         MORE_FAULTS: 0x0
         WALKER_ERROR: 0x0
         PERMISSION_FAULTS: 0x3
         MAPPING_ERROR: 0x0
         RW: 0x0
GPUVM page fault decode 순서
memory hub가 gfxhub인지 mmhub인지 확인vmid와 pasid로 kernel/firmware 또는 userspace 가능성 분류fault를 일으킨 GPU virtual address 확인client ID로 원인 GPU block 식별PERMISSION_FAULTS bit와 RW 값으로 접근 종류 판정shader code, resource descriptor와 process state 조사

Log field를 해석하는 권장 순서입니다.


Decoding a GPUVM Page Fault
===========================

If you see a GPU page fault in the kernel log, you can decode it to figure
out what is going wrong in your application.  A page fault in your kernel
log may look something like this:

::

 [gfxhub0] no-retry page fault (src_id:0 ring:24 vmid:3 pasid:32777, for process glxinfo pid 2424 thread glxinfo:cs0 pid 2425)
   in page starting at address 0x0000800102800000 from IH client 0x1b (UTCL2)
 VM_L2_PROTECTION_FAULT_STATUS:0x00301030
         Faulty UTCL2 client ID: TCP (0x8)
         MORE_FAULTS: 0x0
         WALKER_ERROR: 0x0
         PERMISSION_FAULTS: 0x3
         MAPPING_ERROR: 0x0
         RW: 0x0

Memory hub, VMID/PASID와 client ID

43-65

`gfxhub`는 일부 chip에서 graphics, compute, SDMA가 사용하는 memory hub이고, `mmhub`는 일부 chip에서 multimedia와 SDMA가 사용하는 memory hub입니다. 어느 hub에서 fault가 났는지는 원인 engine 범위를 정하는 첫 단서입니다.

`vmid`가 0이면 kernel driver 또는 firmware가 원인일 가능성이 높고, 0이 아니면 일반적으로 user application fault입니다. `pasid`는 `vmid`를 system process ID와 연결하며 fault 시 process가 살아 있으면 process 정보도 log에 출력됩니다.

그 다음 fault를 일으킨 GPU virtual address와 client ID를 확인합니다. Client ID는 실제 접근을 발생시킨 graphics, command processor, shader, SDMA, video 또는 JPEG block을 가리킵니다.

AMDGPU memory hub 구분
Hub사용 영역
gfxhubgraphics, compute, 일부 chip의 SDMA
mmhubmulti-media, 일부 chip의 SDMA

원문이 설명하는 hub별 대표 사용 영역입니다.

GPUVM fault client ID
Client IDGPU block
CB/DBgraphics pipe의 color/depth backend
CPFCommand Processor Frontend
CPCCommand Processor Compute
CPGCommand Processor Graphics
TCP/SQC/SQGShaders
SDMASDMA engines
VCNVideo encode/decode engines
JPEGJPEG engines

자주 나타나는 client ID와 원인 block입니다.

First you have the memory hub, gfxhub and mmhub.  gfxhub is the memory
hub used for graphics, compute, and sdma on some chips.  mmhub is the
memory hub used for multi-media and sdma on some chips.

Next you have the vmid and pasid.  If the vmid is 0, this fault was likely
caused by the kernel driver or firmware.  If the vmid is non-0, it is generally
a fault in a user application.  The pasid is used to link a vmid to a system
process id.  If the process is active when the fault happens, the process
information will be printed.

The GPU virtual address that caused the fault comes next.

The client ID indicates the GPU block that caused the fault.
Some common client IDs:

- CB/DB: The color/depth backend of the graphics pipe
- CPF: Command Processor Frontend
- CPC: Command Processor Compute
- CPG: Command Processor Graphics
- TCP/SQC/SQG: Shaders
- SDMA: SDMA engines
- VCN: Video encode/decode engines
- JPEG: JPEG engines

PERMISSION_FAULTS와 RW 판독

66-79

`PERMISSION_FAULTS`는 page-table entry에서 어떤 조건을 위반했는지 bitmask로 나타냅니다. 여러 bit가 동시에 set될 수 있으므로 값을 하나의 오류 이름으로만 읽지 말고 각 bit를 분해해야 합니다.

마지막 `RW` field는 접근 방향을 나타냅니다. 0은 read, 1은 write입니다. 원문 예시는 TCP shader가 `RW = 0x0` read를 수행했고 `PERMISSION_FAULTS = 0x3`이므로 bit 0과 bit 1, 즉 invalid PTE와 read bit 부재가 함께 나타난 경우입니다.

PERMISSION_FAULTS bit
Bit의미
0PTE가 valid하지 않음
1PTE read bit가 set되지 않음
2PTE write bit가 set되지 않음
3PTE execute bit가 set되지 않음

PTE validity와 read/write/execute permission bit입니다.

원문 fault example 해석
Field해석
Client IDTCPshader가 접근을 발생
RW0x0read access
PERMISSION_FAULTS0x3bit 0·1: invalid PTE 및 read bit 부재
GPU virtual address0x0000800102800000fault가 시작된 page address
다음 조사shader code / resource descriptor잘못된 address 또는 descriptor state 확인

예시 log의 핵심 field를 원인 조사 항목으로 연결합니다.


PERMISSION_FAULTS describe what faults were encountered:

- bit 0: the PTE was not valid
- bit 1: the PTE read bit was not set
- bit 2: the PTE write bit was not set
- bit 3: the PTE execute bit was not set

Finally, RW, indicates whether the access was a read (0) or a write (1).

In the example above, a shader (cliend id = TCP) generated a read (RW = 0x0) to
an invalid page (PERMISSION_FAULTS = 0x3) at GPU virtual address
0x0000800102800000.  The user can then inspect their shader code and resource
descriptor state to determine what caused the GPU page fault.

UMR 진단 도구

80-87

`umr`은 범용 GPU debugging·diagnostics tool입니다. AMDGPU debugfs의 raw ring, MQD, VRAM/GTT, register, wave와 GPR interface를 사람이 조사할 수 있는 형태로 다루는 데 사용됩니다.

Project와 사용법은 원문 링크를 유지합니다. Source repository는 `https://gitlab.freedesktop.org/tomstdenis/umr`, 기능 문서는 `https://umr.readthedocs.io/en/main/`입니다.

UMR 자료
자료URL
Source repositoryhttps://gitlab.freedesktop.org/tomstdenis/umr
Documentationhttps://umr.readthedocs.io/en/main/

원문이 제공하는 project와 documentation 링크입니다.


UMR
===

`umr <https://gitlab.freedesktop.org/tomstdenis/umr>`_ is a general purpose
GPU debugging and diagnostics tool.  Please see the umr
`documentation <https://umr.readthedocs.io/en/main/>`_ for more information
about its capabilities.

Backlight brightness 변화 추적

88-105

기본 backlight brightness는 firmware가 알리는 policy를 통해 설정하도록 설계되며, firmware는 AC와 DC 전원 상태에 서로 다른 default를 제공할 수 있습니다. 또한 일부 userspace software는 이전 boot의 brightness를 저장했다가 복원합니다.

일부 firmware의 `Custom Backlight Curves`는 입력 brightness 값을 display 특성에 더 맞는 brightness 값 곡선에 선형 보간하여 mapping합니다. 따라서 표시 값과 실제 panel 밝기의 관계가 단순 선형이 아닐 수 있습니다.

Backlight 문제가 있으면 boot 시 trace event를 enable해 모든 brightness change request를 기록할 수 있습니다. 어느 component가 값을 바꿨는지 분리하기 위해 다음 문자열을 kernel command line에 추가합니다.

tp_printk trace_event=amdgpu_dm:amdgpu_dm_brightness:mod:amdgpu trace_buf_size=1M
Backlight brightness 결정과 추적
firmware policy가 AC/DC별 default brightness 제공userspace가 이전 boot에서 저장한 brightness를 복원할 수 있음Custom Backlight Curves가 입력 값을 선형 보간 곡선에 mapping할 수 있음amdgpu_dm_brightness trace event가 모든 change request를 기록요청 시점과 값으로 문제 발생 component를 분리

Brightness 값의 가능한 출처와 trace 지점을 구조화했습니다.

Backlight trace kernel command line
Option값과 역할
tp_printktrace event를 printk 경로로 표시
trace_eventamdgpu_dm:amdgpu_dm_brightness:mod:amdgpu
trace_buf_size1M

Boot부터 brightness request를 기록하기 위한 세 부분입니다.


Debugging backlight brightness
==============================
Default backlight brightness is intended to be set via the policy advertised
by the firmware.  Firmware will often provide different defaults for AC or DC.
Furthermore, some userspace software will save backlight brightness during
the previous boot and attempt to restore it.

Some firmware also has support for a feature called "Custom Backlight Curves"
where an input value for brightness is mapped along a linearly interpolated
curve of brightness values that better match display characteristics.

In the event of problems happening with backlight, there is a trace event
that can be enabled at bootup to log every brightness change request.
This can help isolate where the problem is. To enable the trace event add
the following to the kernel command line:

  tp_printk trace_event=amdgpu_dm:amdgpu_dm_brightness:mod:amdgpu trace_buf_size=1M