Skip to content

kgsl: hwsched: Reset the GPU after a fault when it has no soft reset - #27

Open
Jure Rebernik (asdwjure) wants to merge 1 commit into
qualcomm-linux:gfx-kernel.le.0.0from
asdwjure:hwsched-gen7-reset
Open

Jure Rebernik (asdwjure) wants to merge 1 commit into
qualcomm-linux:gfx-kernel.le.0.0from
asdwjure:hwsched-gen7-reset

Conversation

@asdwjure

@asdwjure Jure Rebernik (asdwjure) commented Nov 8, 2026 •

Copy link
Copy Markdown

Problem

Since 5f419ba ("kgsl: gen8: Ensure single GPU reset"), adreno_hwsched_do_fault() resets the GPU only when adreno_hwsched_snapshot_and_soft_reset() returns an error. That function returns 0 when the GPU has no soft_reset hook, and no gen7 GPU has one. So on gen7 no hwsched fault resets the GPU: the fault stays set, the dispatcher handles it again on every run, and the GPU keeps running the faulting work.

How it shows

On an Adreno 740 (QCS8550, gen7_2_1, KGSL in upstream-kernel mode), a process that exits while its kernel still has more than 30 s of work left makes the GMU time out on the context unregister ("Ack timeout for context unregister"). After that:

  • do_fault_header() logs the same fault more than 10000 times in 3 minutes, and reset_count does not move.
  • The GPU keeps executing the dead process's kernel, and its freed buffers produce a stream of GPU page faults.
  • The exiting process stays in adreno_last_close() waiting for the active count, and every later open of /dev/kgsl-3d0 blocks on the device mutex until a reboot.

Change

Reset the GPU when it has no soft reset, as the dispatcher did before 5f419ba. GPUs with a soft reset (gen8) keep the current behavior.

Testing

On OAK4-D and OAK4-S boards (QCS8550, Adreno 740), with KGSL v1.0.17 plus this change: a test that starts a kernel of about 5 minutes and exits 5 s later. Without the change the exit never completes and the GPU stays unusable. With it the exit completes after the 30 s unregister timeout, KGSL resets the GPU once, and a new kernel computes correct results (5 of 5 repeats). Other GPU workloads (OpenCL, DepthAI ImageManip on the GPU) are unchanged.

AI use

The analysis, the change and this description were prepared with the help of an AI coding assistant (Claude), and reviewed by me.

Since commit 5f419ba ("kgsl: gen8: Ensure single GPU reset"),
adreno_hwsched_do_fault() resets the GPU only when
adreno_hwsched_snapshot_and_soft_reset() returns an error. That
function resets through the soft_reset hook of the GPU and returns 0
when there is no such hook. Gen7 GPUs have none, so on them no hwsched
fault resets the GPU any more: the fault stays set, the dispatcher
handles it again on every run and the GPU keeps running the faulting
work.

On an Adreno 740 (QCS8550, gen7_2_1), a process that exits during a
GPU kernel with more than 30 s of work left makes the GMU time out on
the context unregister. KGSL then handles the same fault more than
10000 times in 3 minutes, the GPU keeps executing the dead process's
kernel into freed memory (a stream of GPU page faults), and every
later open of /dev/kgsl-3d0 blocks on the device mutex until a
reboot. With this change KGSL resets the GPU once, the exit completes
after the 30 s unregister timeout and the next kernel runs.

Reset the GPU when it has no soft reset, as the dispatcher did before.

The analysis, the change and this message were prepared with the help
of an AI coding assistant (Claude). The failure was reproduced and the
change tested on OAK4-D and OAK4-S boards (QCS8550, Adreno 740).

Fixes: 5f419ba ("kgsl: gen8: Ensure single GPU reset")
Signed-off-by: Jure Rebernik <jure.rebernik@luxonis.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant