drm/panfrost: GPU fault cascade ends in kernel memory corruption on Mali-G52 (RK3566)
Hi,
On a Mali-G52 (Rockchip RK3566), a run of job timeouts and soft-stop failures ends with the kernel taking paging requests at corrupt addresses, and an oops on the next fork(). The machine does not panic:
it keeps running and keeps routing packets, but every process that clones a VMA dies, so it is unusable and needs a power cycle.
I have ruled out the obvious candidate before writing -- details below -- so I am fairly sure this is not the 2019 per-slot reset race. Happy to be told otherwise.
The sequence
============
Captured over netconsole, because everything on the box stops before it can write to disk:
panfrost fde60000.gpu: Soft-stop failed
panfrost fde60000.gpu: Soft-stop failed
panfrost fde60000.gpu: gpu sched timeout, js=1, config=0x7300,
status=0x8, head=0xd73cf480, tail=0xd73cecc0,
sched_job=00000000317fe955
panfrost fde60000.gpu: Unhandled Page fault in AS0 at VA 0x000000001E0C2900
raw fault status: 0x664003C2
decoded fault status: SLAVE FAULT
exception type 0xC2: TRANSLATION_FAULT_2
access type 0x3: WRITE
source id 0x6640
panfrost fde60000.gpu: js fault, js=0, status=DATA_INVALID_FAULT,
head=0xd496dfc0, tail=0xd496dfc0
Unable to handle kernel paging request at virtual address 3f87ae4e3f41d124
Unable to handle kernel paging request at virtual address ffff3a2c0129b997
Internal error: Oops: 0000000096000004 [#1] SMP
EC = 0x25: DABT (current EL), FSC = 0x04: level 0 translation fault
CPU: 0 PID: 1 Comm: systemd Tainted: G W O
6.1.84-10-rk2410-nocsf #10
Hardware name: Radxa ZERO 3 (DT)
pc : anon_vma_interval_tree_insert+0x90/0xb4
Call trace:
anon_vma_interval_tree_insert+0x90/0xb4
anon_vma_clone+0x110/0x144
anon_vma_fork+0x30/0x134
dup_mmap+0x2c4/0x4bc
copy_process+0xa84/0x1314
kernel_clone+0xb0/0x288
__do_sys_clone+0x68/0x9c
__arm64_sys_clone+0x20/0x28Four separate paging requests at unrelated garbage addresses precede the oops, which is why this reads as corruption rather than one bad dereference.
Worth noting the GPU's own faulting access is a write the MMU blocked (TRANSLATION_FAULT_2, access type 0x3: WRITE), so it should not itself have reached kernel memory. That is what makes me look at the recovery path rather than at the GPU.
Why it is expensive: networking never clones a VMA, so the box still answers pings, while sshd -- which forks per connection -- dies at kex_exchange_identification, before authentication. No credential can get in, and journald is gone for the same reason, so nothing about this survives on the machine.
What I ruled out
================
The per-slot reset race (two timeout threads racing in the reset path, the T820 problem from 2019) does not apply here. The serialization is present in its modern form: panfrost_job_init() does
pfdev->reset.wq = alloc_ordered_workqueue("panfrost-reset", 0);and passes that workqueue to drm_sched_init() for every slot, so an ordered workqueue means panfrost_job_timedout() cannot run concurrently for two slots. I had reached for that explanation first, because the log shows js=0 and js=1 faulting in the same window.
This is also not a vendor divergence. The board runs a Rockchip BSP, so the next question was whether it had dropped something. It has not:
against upstream linux-6.1.y, this kernel's panfrost_job.c differs by nine lines, all DRM scheduler API signature adaptations (drm_sched_start, drm_sched_init, hw_rq_count -> credit_count), with no logic changes. So the above happens on a stock upstream 6.1 panfrost path with the serialized reset in place.
A question about HW_ISSUE_8408
==============================
"Repeatedly Soft-stopping a job chain consisting of (Vertex Shader,
Cache Flush, Tiler) jobs causes DATA_INVALID_FAULT"
That is close to word-for-word what the log shows: repeated soft-stop failures on js=1 (vertex/tiler), DATA_INVALID_FAULT on js=0. But it is declared only in hw_issues_t600, not for G52. Is that because G52 does not have it, or because nobody has had cause to flag it there?
Against that, HW_ISSUE_9435 is in hw_issues_all -- the compute endpoint's 4-deep task queue means a soft stop cannot complete until all four tasks do -- so "Soft-stop failed" on its own may be unremarkable, and I would rather say so than lean on it.
Recoverable vs fatal
====================
Two cascades on one boot, with identical DATA_INVALID_FAULT counts:
recoverable fatal span 3 s 14 s gpu sched timeout 6 10 DATA_INVALID_FAULT 3 3 Soft-stop failed 0 2 TRANSLATION_FAULT_2 0 1 outcome GPU recovers, oops
display restores
at +4.4 s, ~70 s
more rendering on
the same boot
So escalation tracks the driver failing to stop the hung job rather than the number of faulting jobs. Given HW_ISSUE_9435 that may be correlation rather than cause.
What I do not have
==================
- A mainline reproduction. It is a vendor kernel, though as above its panfrost is upstream's to nine API-signature lines, so "vendor kernel" is not by itself the explanation. If reproducing on mainline is the precondition for looking at this, say so and I will see what I can arrange.
- A minimal reproducer. The trigger is a full application rendering a large scene.
- A devcoredump: the driver logs "failed to allocate devcoredump file" at exactly the moment one would be most useful. panfrost_core_dump(job) is called from panfrost_job_timedout() immediately before the reset, so that may deserve its own look.
- Determinism. Five runs in an identical environment gave one cascade and four clean runs.
Environment
===========
Mali-G52 r1 MC1 on Rockchip RK3566
mali-g52 id 0x7402 major 0x1 minor 0x0
[drm] Initialized panfrost 1.2.0 20180908 for fde60000.gpu on minor 1
features: 00000000,00000cf7 issues: 00000000,00000400 kernel 6.1.84-10-rk2410-nocsf #10 (Rockchip BSP), aarch64 taint G W O -- out-of-tree panel_mipi_dbi, gpio_backlight
Userspace is panvk (Mesa 26.3.0-devel), which needs PAN_I_WANT_A_BROKEN_VULKAN_DRIVER=1. A separate userspace problem on the same hardware is filed as mesa/mesa#16595; this report is only about the kernel turning a GPU fault into memory corruption, which no userspace submission should be able to do.
I have the full 301-line netconsole capture -- the above trimmed from it -- and can send it, or anything else that would help. If you want instrumentation run on this board, I can do that; each fatal occurrence costs a physical power cycle, so a targeted request beats a broad one.
One note for anyone reproducing: raise /proc/sys/kernel/printk to 7 first. At the default console loglevel of 4 none of these panfrost messages reach any console, netconsole included, and a run that faulted looks clean. Four earlier occurrences here produced no log at all for that reason.
Thanks,
Joel
I forgot to mention that the AI drafted this report, which I reviewed and sent. I'm happy to re-send a condensed version.
Also I left out "Assisted-by: LLM"
Cheers,
Joel
Quoted 174 lines · Joel Winarske
Hi,
On a Mali-G52 (Rockchip RK3566), a run of job timeouts and soft-stop failures ends with the kernel taking paging requests at corrupt addresses, and an oops on the next
fork(). The machine does not panic:
it keeps running and keeps routing packets, but every process that clones a VMA dies, so it is unusable and needs a power cycle.I have ruled out the obvious candidate before writing -- details below -- so I am fairly sure this is not the 2019 per-slot reset race. Happy to be told otherwise.
The sequence
============Captured over netconsole, because everything on the box stops before it can write to disk:
panfrost fde60000.gpu: Soft-stop failed
panfrost fde60000.gpu: Soft-stop failed
panfrost fde60000.gpu: gpu sched timeout, js=1, config=0x7300,status=0x8, head=0xd73cf480, tail=0xd73cecc0, sched_job=00000000317fe955 panfrost fde60000.gpu: Unhandled Page fault in AS0 at VA 0x000000001E0C2900 raw fault status: 0x664003C2 decoded fault status: SLAVE FAULT exception type 0xC2: TRANSLATION_FAULT_2 access type 0x3: WRITE source id 0x6640 panfrost fde60000.gpu: js fault, js=0, status=DATA_INVALID_FAULT, head=0xd496dfc0, tail=0xd496dfc0 Unable to handle kernel paging request at virtual address 3f87ae4e3f41d124 Unable to handle kernel paging request at virtual address ffff3a2c0129b997 Internal error: Oops: 0000000096000004 [#1] SMP EC = 0x25: DABT (current EL), FSC = 0x04: level 0 translation fault CPU: 0 PID: 1 Comm: systemd Tainted: G W O 6.1.84-10-rk2410-nocsf #10 Hardware name: Radxa ZERO 3 (DT) pc : anon_vma_interval_tree_insert+0x90/0xb4 Call trace: anon_vma_interval_tree_insert+0x90/0xb4 anon_vma_clone+0x110/0x144 anon_vma_fork+0x30/0x134 dup_mmap+0x2c4/0x4bc copy_process+0xa84/0x1314 kernel_clone+0xb0/0x288 __do_sys_clone+0x68/0x9c __arm64_sys_clone+0x20/0x28Four separate paging requests at unrelated garbage addresses precede the oops, which is why this reads as corruption rather than one bad dereference.
Worth noting the GPU's own faulting access is a write the MMU blocked (
TRANSLATION_FAULT_2, access type0x3: WRITE), so it should not itself have reached kernel memory. That is what makes me look at the recovery path rather than at the GPU.Why it is expensive: networking never clones a VMA, so the box still answers pings, while sshd -- which forks per connection -- dies at
kex_exchange_identification, before authentication. No credential can get in, and journald is gone for the same reason, so nothing about this survives on the machine.What I ruled out
================The per-slot reset race (two timeout threads racing in the reset path, the T820 problem from 2019) does not apply here. The serialization is present in its modern form:
panfrost_job_init()doespfdev->reset.wq = alloc_ordered_workqueue("panfrost-reset", 0);and passes that workqueue to
drm_sched_init()for every slot, so an ordered workqueue meanspanfrost_job_timedout()cannot run concurrently for two slots. I had reached for that explanation first, because the log shows js=0 and js=1 faulting in the same window.This is also not a vendor divergence. The board runs a Rockchip BSP, so the next question was whether it had dropped something. It has not:
against upstream linux-6.1.y, this kernel'spanfrost_job.cdiffers by nine lines, all DRM scheduler API signature adaptations (drm_sched_start,drm_sched_init,hw_rq_count->credit_count), with no logic changes. So the above happens on a stock upstream 6.1 panfrost path with the serialized reset in place.A question about
HW_ISSUE_8408
=============================="Repeatedly Soft-stopping a job chain consisting of (Vertex Shader,
Cache Flush, Tiler) jobs causesDATA_INVALID_FAULT"That is close to word-for-word what the log shows: repeated soft-stop failures on js=1 (vertex/tiler),
DATA_INVALID_FAULTon js=0. But it is declared only inhw_issues_t600, not for G52. Is that because G52 does not have it, or because nobody has had cause to flag it there?Against that,
HW_ISSUE_9435is inhw_issues_all-- the compute endpoint's 4-deep task queue means a soft stop cannot complete until all four tasks do -- so "Soft-stop failed" on its own may be unremarkable, and I would rather say so than lean on it.Recoverable vs fatal
====================Two cascades on one boot, with identical
DATA_INVALID_FAULTcounts:recoverable fatal span 3 s 14 s gpu sched timeout 6 10 DATA_INVALID_FAULT 3 3 Soft-stop failed 0 2 TRANSLATION_FAULT_2 0 1 outcome GPU recovers, oopsdisplay restores
at +4.4 s, ~70 s
more rendering on
the same bootSo escalation tracks the driver failing to stop the hung job rather than the number of faulting jobs. Given
HW_ISSUE_9435that may be correlation rather than cause.What I do not have
==================- A mainline reproduction. It is a vendor kernel, though as above its panfrost is upstream's to nine API-signature lines, so "vendor kernel" is not by itself the explanation. If reproducing on mainline is the precondition for looking at this, say so and I will see what I can arrange.
- A minimal reproducer. The trigger is a full application rendering a large scene.
- A devcoredump: the driver logs "failed to allocate devcoredump file" at exactly the moment one would be most useful.panfrost_core_dump(job)is called frompanfrost_job_timedout()immediately before the reset, so that may deserve its own look.
- Determinism. Five runs in an identical environment gave one cascade and four clean runs.Environment
===========Mali-G52 r1 MC1 on Rockchip RK3566
mali-g52 id0x7402major0x1minor0x0
[drm] Initialized panfrost 1.2.0 20180908 for fde60000.gpu on minor 1
features: 00000000,00000cf7 issues: 00000000,00000400 kernel 6.1.84-10-rk2410-nocsf #10 (Rockchip BSP), aarch64 taint G W O -- out-of-treepanel_mipi_dbi,gpio_backlightUserspace is panvk (Mesa 26.3.0-devel), which needs PAN_I_WANT_A_BROKEN_VULKAN_DRIVER=1. A separate userspace problem on the same hardware is filed as mesa/mesa#16595; this report is only about the kernel turning a GPU fault into memory corruption, which no userspace submission should be able to do.
I have the full 301-line netconsole capture -- the above trimmed from it -- and can send it, or anything else that would help. If you want instrumentation run on this board, I can do that; each fatal occurrence costs a physical power cycle, so a targeted request beats a broad one.
One note for anyone reproducing: raise
/proc/sys/kernel/printkto 7 first. At the default console loglevel of 4 none of these panfrost messages reach any console, netconsole included, and a run that faulted looks clean. Four earlier occurrences here produced no log at all for that reason.Thanks,
Joel
Hi,
Quoted 21 lines · Joel Winarske
Hi,
On a Mali-G52 (Rockchip RK3566), a run of job timeouts and soft-stop failures ends with the kernel taking paging requests at corrupt addresses, and an oops on the next
fork(). The machine does not panic:
it keeps running and keeps routing packets, but every process that clones a VMA dies, so it is unusable and needs a power cycle.I have ruled out the obvious candidate before writing -- details below -- so I am fairly sure this is not the 2019 per-slot reset race. Happy to be told otherwise.
The sequence
============Captured over netconsole, because everything on the box stops before it can write to disk:
panfrost fde60000.gpu: Soft-stop failed
panfrost fde60000.gpu: Soft-stop failed
panfrost fde60000.gpu: gpu sched timeout, js=1, config=0x7300,
Quoted 16 lines
status=0x8, head=0xd73cf480, tail=0xd73cecc0,
sched_job=00000000317fe955
panfrost fde60000.gpu: Unhandled Page fault in AS0 at VA 0x000000001E0C2900
raw fault status: 0x664003C2
decoded fault status: SLAVE FAULT
exception type 0xC2: TRANSLATION_FAULT_2
access type 0x3: WRITE
source id 0x6640
panfrost fde60000.gpu: js fault, js=0, status=DATA_INVALID_FAULT,
head=0xd496dfc0, tail=0xd496dfc0
Unable to handle kernel paging request at virtual address 3f87ae4e3f41d124
Unable to handle kernel paging request at virtual address ffff3a2c0129b997
Internal error: Oops: 0000000096000004 [#1] SMP
EC = 0x25: DABT (current EL), FSC = 0x04: level 0 translation fault
CPU: 0 PID: 1 Comm: systemd Tainted: G W O
6.1.84-10-rk2410-nocsf #10This is a vendor kernel... Generally we try not to spend much time on bug reports from a vendor kernel because we don't know what changes might have been made. I note you claim there isn't much difference (checking the panfrost code), but we don't even know whether this is a panfrost issue or if something else in the kernel is broken.
Quoted 12 lines
Hardware name: Radxa ZERO 3 (DT)
pc : anon_vma_interval_tree_insert+0x90/0xb4
Call trace:
anon_vma_interval_tree_insert+0x90/0xb4
anon_vma_clone+0x110/0x144
anon_vma_fork+0x30/0x134
dup_mmap+0x2c4/0x4bc
copy_process+0xa84/0x1314
kernel_clone+0xb0/0x288
__do_sys_clone+0x68/0x9c
__arm64_sys_clone+0x20/0x28[...]
Quoted 8 lines
What I do not have
==================- A mainline reproduction. It is a vendor kernel, though as above its panfrost is upstream's to nine API-signature lines, so "vendor kernel" is not by itself the explanation. If reproducing on mainline is the precondition for looking at this, say so and I will see what I can arrange.
It would be a very good start to see if this happens with mainline. Ideally test with the newly released v7.3 so we can see if there are any recent fixes.
Obviously one outcome might be that a bug fix needs to be backported to a stable branch - but if we know mainline doesn't reproduce then "git bisect" can be used to track down the fix. Or if it does reproduce then obviously we want to fix it upstream.
Quoted 2 lines
- A minimal reproducer. The trigger is a full application rendering a large scene.
The most useful thing is a reliable reproducer - if you can produce a minimal reproducer then others can help out with testing, but I wouldn't spend much time on that at this point. But see below.
Quoted 2 lines
- A devcoredump: the driver logs "failed to allocate devcoredump file" at exactly the moment one would be most useful.
devcoredump is unlikely to help. There's a small possibility of identifying why the soft-stop failed - but the far more interesting thing is why the kernel faults afterwards occurred. And most likely they have the same root cause.
Quoted 4 lines
panfrost_core_dump(job)is called frompanfrost_job_timedout()immediately before the reset, so that may deserve its own look.
- Determinism. Five runs in an identical environment gave one cascade and four clean runs.
If you can make the test reliably show the issue then debugging would be much easier - otherwise you'll have to run the test multiple times and hope that e.g. 20 runs without issue isn't just fluke but actually points to the issue being fixed.
Quoted 10 lines
Environment
===========Mali-G52 r1 MC1 on Rockchip RK3566
mali-g52 id0x7402major0x1minor0x0
[drm] Initialized panfrost 1.2.0 20180908 for fde60000.gpu on minor 1
features: 00000000,00000cf7 issues: 00000000,00000400 kernel 6.1.84-10-rk2410-nocsf #10 (Rockchip BSP), aarch64 taint G W O -- out-of-treepanel_mipi_dbi,gpio_backlight
Quoted 5 lines
Userspace is panvk (Mesa 26.3.0-devel), which needs PAN_I_WANT_A_BROKEN_VULKAN_DRIVER=1. A separate userspace problem on the same hardware is filed as mesa/mesa#16595; this report is only about the kernel turning a GPU fault into memory corruption, which no userspace submission should be able to do.
User space shouldn't be able to break the kernel - so that's fine. We can debug the kernel issues. Although clearly if you want a reliable driver for user space you should be wary of that PAN_I_WANT_A_BROKEN_VULKAN_DRIVER flag.
Finally I'd appreciate it if you limit the use of AI to write your emails. Panfrost recently merged an AI policy for Mesa[1], and this part is particularly relevant:
Quoted 4 lines
We also do not want AI-generated issue reports and other project communication. This is because reports like that tend to be overly verbose and often confusing to read. We prefer a short report written by a human over a wall of text written by a machine. We can always ask for more details when needed.
Thanks,
Steve