Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8CDC6606A31C for ; Sun, 29 Nov 2026 01:36:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=NZqvWhCL Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C9D3010EA8E; Sun, 29 Nov 2026 01:36:07 +0000 (UTC) Received: from tor.source.kernel.org (tor.source.kernel.org [172.105.4.254]) by gabe.freedesktop.org (Postfix) with ESMTPS id 658A410EA8E for ; Sun, 29 Nov 2026 01:36:01 +0000 (UTC) Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by tor.source.kernel.org (Postfix) with ESMTP id 36312609F1; Sun, 29 Nov 2026 01:36:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CAC2C1F000C1; Sun, 29 Nov 2026 01:35:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1795916159; bh=k7gZ0peK1Xo++iYODUIYiyJMi53MrT0Y2c6+DhAEZVA=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=NZqvWhCLjlpSz0jLwxNOZ/mYlH/trSBGOqyS5XA9o5npAUovDzn3i+F5/5JybqD8c PcTr/VqmkYX1+o+yIe1hPPURSridSLd+DB7Xo+on+ajfuI4M7lqDV5IWoC8C3vGRBT EiKfZZ7d6Ap0+Q0MDSRPBX/k0yCD5OOVOT006JzZSoYzT59XpyVllWAXoBsldxI5cV UzdAG0Reg7Nax5PKlzeWoU1j3bs7q+ampuqZaCL2Vwzx5cWH0eSDiraAzJRaXzv7oe na4hwhQQM/ODS0VrLQTB6m+pVh0hHk7CdOJDMUsWZEBHnPJ/BgOI9x6ICa5w6ysHjp Efaldk22HuOKg== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH v2] drm/msm/gem: defer shared GPU VM teardown until last VMA user To: "Vladimir Bely" Cc: dri-devel@lists.freedesktop.org In-Reply-To: <20261129011759.1025516-1-vlwwwwww@gmail.com> References: <20261129000944.986285-1-vlwwwwww@gmail.com> <20261129011759.1025516-1-vlwwwwww@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Sun, 29 Nov 2026 01:35:59 +0000 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: sashiko-reviews@lists.linux.dev Sender: "dri-devel" X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 X-Archived-By: 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 > 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 exampl= e, > 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() on= ce > vma_ref drops to zero =E2=80=94 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 [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, st= ruct drm_file *file) > static void put_iova_spaces(struct drm_gem_object *obj, struct drm_gpuvm= *vm, > bool close, const char *reason); > =20 > +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. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261129011759.1025= 516-1-vlwwwwww@gmail.com?part=3D1