Repository navigation
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
Open
Jure Rebernik (asdwjure) wants to merge 1 commit into
Jure Rebernik (asdwjure) wants to merge 1 commit into
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Since 5f419ba ("kgsl: gen8: Ensure single GPU reset"),
adreno_hwsched_do_fault()resets the GPU only whenadreno_hwsched_snapshot_and_soft_reset()returns an error. That function returns 0 when the GPU has nosoft_resethook, 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, andreset_countdoes not move.adreno_last_close()waiting for the active count, and every later open of/dev/kgsl-3d0blocks 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.