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 <[email protected]>

> 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: [email protected]
> Signed-off-by: Vladimir Bely <[email protected]>

[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/[email protected]?part=1

Reply via email to