Looks good to me:
Reviewed-by: Iago Toral Quiroga <[email protected]>

I was not aware that hang checks were happening at second boundaries,
regardless of the time at which the hangcheck was queued, it doesn't
sound like a good idea, so I think it is good to change that.

On the other hand, now we rearm the hang check every 100ms instead
which is a much smaller window. I understand this reduces visible
impact of the workaround when the issue happens, but I am wondering
whether this alone has any visible performance impact for the 99% of
the time we are not hitting the problem, I presume you haven't seen
any?

Iago

El mié, 18-11-2026 a las 18:47 -0300, Maíra Canal escribió:
> Mesa issue #16652 [1] reports GPU resets every few minutes on the
> Raspberry Pi 3. They happen when text labels are drawn over their
> shadows:
> two different threaded fragment shaders, plus untextured single-
> threaded
> ones, in the same tiles.
> 
> During a hang, the performance counters show four QPUs fetching
> instructions with 0 cache hits, ~6.5M misses per 100 ms, and 0 valid
> instructions executed. This matches HW erratum GFXH-16: the QPUs of a
> slice share one instruction cache and can livelock, evicting each
> other's
> fills. Since shader code always starts at offset 0 of a page-aligned
> BO,
> every shader competes for the same cache sets.
> 
> This series works around it:
> 
>   - Patch 3 starts each shader's code at one of four offsets in its
> BO,
>     spreading shaders across cache sets.
> 
>   - Patch 4 clears the slice instruction and uniforms caches when the
>     hangcheck finds no progress, and resets the GPU only if the stall
>     persists. It is meant to recover from livelocks the offsets don't
>     prevent.
> 
> Patches 1 and 2 fix an off-by-one in the shader BO handle check and a
> NULL pointer dereference in validate_gl_shader_rec(), found while
> working
> on patch 3.
> 
> Tested on a Raspberry Pi 3B+ with the issue's reproducer, 4 x 15 min
> runs:
> 
>   without the series:  29 GPU resets
>   with patches 1-3:     0 GPU resets
> 
> [1] https://gitlab.freedesktop.org/mesa/mesa/-/issues/16652
> 
> Best regards,
> - Maíra
> 
> ---
> Maíra Canal (4):
>       drm/vc4: Fix off-by-one in the shader record BO handle check
>       drm/vc4: Check for a validated shader before reading its thread
> mode
>       drm/vc4: Start shader code at varying offsets in its BO
>       drm/vc4: Clear the slice caches before resetting a stalled GPU
> 
>  drivers/gpu/drm/vc4/vc4_bo.c               | 43
> +++++++++++++++++++++++-------
>  drivers/gpu/drm/vc4/vc4_drv.h              | 15 ++++++++++-
>  drivers/gpu/drm/vc4/vc4_gem.c              | 20 ++++++++++++--
>  drivers/gpu/drm/vc4/vc4_validate.c         | 17 +++++++-----
>  drivers/gpu/drm/vc4/vc4_validate_shaders.c |  7 ++---
>  5 files changed, 79 insertions(+), 23 deletions(-)
> ---
> base-commit: 80ac6d197218c3399d66674167a4d7c9051a25e2
> change-id: 20261112-vc4-icache-workaround-d11b444bc7e8
> 
> 

Reply via email to