dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Vladimir Bely" <vlwwwwww@gmail.com>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH v2] drm/msm/gem: defer shared GPU VM teardown until last VMA user
Date: Sun, 29 Nov 2026 01:35:59 +0000	[thread overview]
Message-ID: <sashiko-outbox-239206@kernel.org> (raw)
In-Reply-To: <20261129011759.1025516-1-vlwwwwww@gmail.com>

Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [High] drm/msm: undefined gem_lock guard class in has_vma() breaks
  build
- [Low] drm/msm: inaccurate commit subject in Fixes: trailer for
  111fdd2198e6
--

commit 2d67e62e55be07ff8942dc714f5cd6ae5d9e884c
Author: Vladimir Bely <vlwwwwww@gmail.com>

> drm/msm/gem: defer shared GPU VM teardown until last VMA user
>
> On GPUs without per-process pagetables (a2xx-a5xx), every context shares
> priv->gpu->vm.  When a buffer is shared between two processes (for example,
> an app and a compositor via dma-buf), closing the handle in one process
> calls msm_gem_close() -> put_iova_spaces(obj, ctx->vm, ...), which tears
> down the single shared GPU VMA while the other process is still rendering
> with it.  On Adreno 306 (MSM8916), this triggers continuous GPU IOMMU
> faults and display corruption.
>
> Skip the per-handle teardown in msm_gem_close() when ctx->vm is the shared
> priv->gpu->vm, and instead tear down that mapping in msm_gem_vma_put() once
> vma_ref drops to zero — matching how the shared priv->kms->vm is already
> handled.  Check has_vma() before waiting on fences or locking priv->gpu->vm
> so GPUs with per-process pagetables pay no extra cost.
>
> After waiting unlocked for fences, re-check both vma_ref and fence
> signaling under msm_gem_lock_vm_and_obj() before calling put_iova_spaces()
> so a concurrent msm_gem_vma_get() (or a get/submit/put cycle) cannot race
> with teardown.  Also re-check vma_ref under the lock for priv->kms->vm.
>
> Fixes: 111fdd2198e6 ("drm/msm: Add drm_gpuvm support")
> Cc: stable@vger.kernel.org
> Signed-off-by: Vladimir Bely <vlwwwwww@gmail.com>

[Severity: Low]
The quoted subject in the Fixes: tag does not match the commit in git
history.  Should this be:

  Fixes: 111fdd2198e6 ("drm/msm: drm_gpuvm conversion")

> diff --git a/drivers/gpu/drm/msm/msm_gem.c b/drivers/gpu/drm/msm/msm_gem.c
> index 130ae27ee00be..a150038265a88 100644
> --- a/drivers/gpu/drm/msm/msm_gem.c
> +++ b/drivers/gpu/drm/msm/msm_gem.c
> @@ -52,8 +52,23 @@ static int msm_gem_open(struct drm_gem_object *obj, struct drm_file *file)
>  static void put_iova_spaces(struct drm_gem_object *obj, struct drm_gpuvm *vm,
>  			    bool close, const char *reason);
>  
> +static bool has_vma(struct drm_gem_object *obj, struct drm_gpuvm *vm)
> +{
> +	struct drm_gpuvm_bo *vm_bo;
> +
> +	guard(gem_lock)(obj);

[Severity: High]
Does this compile?  Neither drivers/gpu/drm/msm/msm_gem.h nor
include/drm/drm_gem.h defines a gem_lock cleanup guard class, so
guard(gem_lock)(obj) fails to build with undeclared class_gem_lock_t,
class_gem_lock_constructor and class_gem_lock_destructor identifiers.
Either DEFINE_GUARD(gem_lock, struct drm_gem_object *, msm_gem_lock(_T),
msm_gem_unlock(_T)) needs to be added to msm_gem.h, or has_vma() should
call msm_gem_lock() and msm_gem_unlock() directly.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261129011759.1025516-1-vlwwwwww@gmail.com?part=1

  reply	other threads:[~2026-11-29  1:36 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-29  0:09 [PATCH] drm/msm/gem: defer shared GPU VM teardown until last VMA user Vladimir Bely
2026-11-29  0:23 ` sashiko-bot
2026-11-29  1:17 ` [PATCH v2] " Vladimir Bely
2026-11-29  1:35   ` sashiko-bot [this message]
2026-11-29  8:16   ` kernel test robot
2026-11-29  9:00   ` [PATCH v3] " 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=sashiko-outbox-239206@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=vlwwwwww@gmail.com \
    /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