All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v4 0/2] drm/msm/gem: defer shared GPU VM teardown until last VMA user
@ 2026-12-04 23:10 Vladimir Bely
  2026-12-04 23:10 ` [PATCH v4 1/2] " Vladimir Bely
  2026-12-04 23:10 ` [PATCH v4 2/2] drm/msm/gem: use guard(gem_lock) in has_vma() Vladimir Bely
  0 siblings, 2 replies; 4+ messages in thread
From: Vladimir Bely @ 2026-12-04 23:10 UTC (permalink / raw)
  To: Rob Clark, Dmitry Baryshkov
  Cc: Abhinav Kumar, Jessica Zhang, Sean Paul, Marijn Suijten,
	David Airlie, Simona Vetter, linux-arm-msm, dri-devel, freedreno,
	linux-kernel

On GPUs without per-process pagetables (a2xx-a5xx), all contexts share
priv->gpu->vm, so tearing down the GPU VMA in msm_gem_close() breaks
other users of a shared/imported buffer.

Patch 1 defers the shared priv->gpu->vm teardown to msm_gem_vma_put()
using explicit msm_gem_lock()/msm_gem_unlock() so it backports cleanly
to stable kernels.  Patch 2 converts has_vma() to guard(gem_lock) on
msm-next.

Changes in v4 (addressing Rob Clark's review):
- Patch 1: use drm_gpuvm_bo_find()/drm_gpuvm_bo_put() in has_vma()
  instead of open-coding the drm_gem_for_each_gpuvm_bo() loop.
- Patch 2: add follow-up patch converting has_vma() to guard(gem_lock)
  so Patch 1 stays easy to backport to stable trees.

Changes in v3:
- Use msm_gem_lock()/msm_gem_unlock() in has_vma() instead of
  guard(gem_lock) so the fix builds on v7.4/stable trees as well.
- Fix the commit subject in the Fixes: trailer.

Changes in v2:
- Re-check vma_ref after the unlocked dma_resv_wait_timeout() and again
  under msm_gem_lock_vm_and_obj() for both priv->gpu->vm and
  priv->kms->vm.
- Re-check dma_resv_test_signaled() under the lock and loop on an ABA
  vma_get/submit/vma_put cycle.

Link: https://lore.kernel.org/linux-arm-msm/20261129090012.183245-1-vlwwwwww@gmail.com/ [v3]

Vladimir Bely (2):
  drm/msm/gem: defer shared GPU VM teardown until last VMA user
  drm/msm/gem: use guard(gem_lock) in has_vma()

 drivers/gpu/drm/msm/msm_gem.c | 58 ++++++++++++++++++++++++++++++++++-
 1 file changed, 57 insertions(+), 1 deletion(-)


base-commit: dca2f1b25860f8caa0406f858e76a3a21671a012
-- 
2.43.0


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

end of thread, other threads:[~2026-12-04 23:41 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-04 23:10 [PATCH v4 0/2] drm/msm/gem: defer shared GPU VM teardown until last VMA user Vladimir Bely
2026-12-04 23:10 ` [PATCH v4 1/2] " Vladimir Bely
2026-12-04 23:41   ` sashiko-bot
2026-12-04 23:10 ` [PATCH v4 2/2] drm/msm/gem: use guard(gem_lock) in has_vma() Vladimir Bely

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.