All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] drm/vc4: Fix binner overflow-memory corruption and GPU hangs
@ 2026-07-18 17:28 Maíra Canal
  2026-07-18 17:28 ` [PATCH 1/3] drm/vc4: Supply the overflow slot size in BPOS, not the whole bin BO size Maíra Canal
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Maíra Canal @ 2026-07-18 17:28 UTC (permalink / raw)
  To: Jose Maria Casanova Crespo, Iago Toral, Emma Anholt,
	Maxime Ripard, Dave Stevenson, Raspberry Pi Kernel Maintenance
  Cc: kernel-dev, dri-devel, stable, Maíra Canal

This series fixes a couple of long-standing bugs in the VC4 binner's
out-of-memory (overflow) path. The binner writes each tile's binned
command list into a per-job binner BO that is carved into fixed slots,
and spills into overflow memory whenever a tile's list outgrows its
initial tile-alloc block. Bugs in that path have been reported for years
as GPU hangs, a GPU that stays permanently wedged after the first hang,
userspace heap corruption and occasional full system crashes [1][2].

The three patches address distinct problems and can be reviewed
independently, though they were all found while chasing the same reports.

Patch 1 address an issue in vc4_overflow_mem_work(). The function points
BPOA at a 512KB slot inside the 16MB binner BO but writes the size of the
*whole* BO to BPOS, so on every binner OOM event the hardware is authorized
to DMA tile lists across other in-flight jobs' slots and, for any slot but
the first, past the end of the BO into unrelated CMA memory.

Patch 2 resets the software overflow allocator and the BPOA/BPOS
registers on GPU reset. Today a reset force-completes the RENDER job that
would have consumed the pending overflow slot, so a slot leaks on every
reset and the hardware is left pointing at stale overflow memory that the
re-queued BIN job would consume before raising a fresh OOM.

Patch 3 dynamically sizes the initial tile-alloc block up to the 256-byte
hardware maximum, picking the largest size that still fits the binner
slot for the job's tile count. This keeps more tiles' lists in their
initial block and off the continuation-block chain, which VC4 does not
walk reliably, and takes the reported EmulationStation workload from
storming resets to zero. As explained in that patch, it is a mitigation
for a hardware limitation rather than a complete fix.

[1] https://github.com/raspberrypi/linux/issues/3221
[2] https://github.com/raspberrypi/linux/issues/5780

Best regards,
- Maíra

---
Jose Maria Casanova Crespo (1):
      drm/vc4: Supply the overflow slot size in BPOS, not the whole bin BO size

Maíra Canal (2):
      drm/vc4: Reset the binner overflow allocator on GPU reset
      drm/vc4: Dynamically size the initial tile-alloc block

 drivers/gpu/drm/vc4/vc4_drv.h       |  5 +++++
 drivers/gpu/drm/vc4/vc4_irq.c       | 14 +++++++++++++-
 drivers/gpu/drm/vc4/vc4_render_cl.c |  3 ++-
 drivers/gpu/drm/vc4/vc4_validate.c  | 29 ++++++++++++++++++++++++++---
 4 files changed, 46 insertions(+), 5 deletions(-)
---
base-commit: 7a4b7122a623e3d57fc15cf843a9d45fbd72c6ab
change-id: 20260718-vc4-bin-oom-fixes-29cf2cce2562


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2026-07-18 17:44 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-18 17:28 [PATCH 0/3] drm/vc4: Fix binner overflow-memory corruption and GPU hangs Maíra Canal
2026-07-18 17:28 ` [PATCH 1/3] drm/vc4: Supply the overflow slot size in BPOS, not the whole bin BO size Maíra Canal
2026-07-18 17:28 ` [PATCH 2/3] drm/vc4: Reset the binner overflow allocator on GPU reset Maíra Canal
2026-07-18 17:42   ` sashiko-bot
2026-07-18 17:28 ` [PATCH 3/3] drm/vc4: Dynamically size the initial tile-alloc block Maíra Canal
2026-07-18 17:44   ` sashiko-bot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.