From: Vladimir Bely <vlwwwwww@gmail.com>
To: Rob Clark <robin.clark@oss.qualcomm.com>,
Dmitry Baryshkov <lumag@kernel.org>
Cc: Abhinav Kumar <abhinav.kumar@linux.dev>,
Jessica Zhang <jesszhan0024@gmail.com>,
Sean Paul <sean@poorly.run>,
Marijn Suijten <marijn.suijten@somainline.org>,
David Airlie <airlied@gmail.com>, Simona Vetter <simona@ffwll.ch>,
linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org,
freedreno@lists.freedesktop.org, linux-kernel@vger.kernel.org
Subject: [PATCH v4 0/2] drm/msm/gem: defer shared GPU VM teardown until last VMA user
Date: Sat, 5 Dec 2026 02:10:56 +0300 [thread overview]
Message-ID: <20261204231058.699120-1-vlwwwwww@gmail.com> (raw)
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
next reply other threads:[~2026-12-04 23:11 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-04 23:10 Vladimir Bely [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261204231058.699120-1-vlwwwwww@gmail.com \
--to=vlwwwwww@gmail.com \
--cc=abhinav.kumar@linux.dev \
--cc=airlied@gmail.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=freedreno@lists.freedesktop.org \
--cc=jesszhan0024@gmail.com \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lumag@kernel.org \
--cc=marijn.suijten@somainline.org \
--cc=robin.clark@oss.qualcomm.com \
--cc=sean@poorly.run \
--cc=simona@ffwll.ch \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®