From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 4B2EBC369C2 for ; Mon, 5 May 2025 07:30:00 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 83B9E10E28B; Mon, 5 May 2025 07:29:59 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=collabora.com header.i=@collabora.com header.b="MmWbvLdf"; dkim-atps=neutral Received: from bali.collaboradmins.com (bali.collaboradmins.com [148.251.105.195]) by gabe.freedesktop.org (Postfix) with ESMTPS id 1E9AD10E28B for ; Mon, 5 May 2025 07:29:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1746430194; bh=uqAzRrNSam0VlsKE9vorYxsmGw5PUh3RsPStunbGhMA=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=MmWbvLdftaraoFpRW3vnGbLBHRZ/B1D6cEWlZ7zRUV55vjWM+7CVOKlfFdeLJPzOb 2WJNCN0JffwgL/VkGfTwkPEd7N6sYmbjyuziDSuFF06+LAEknV0c8HVfLIan7ANxOz 5oy3KtB2vMap76cunv9smFK5IDnSVclhX0VI9kT1i7SwEC77fHCXP+fG4uPemEAzw9 ujaqRw9n5yr0CsZY3TLtkhMbKyCIPbcsGVCJONvSjmnULIO2bcLnX79Lj3duT4tk8p v9/ckNr3AddNKjeaKbs0F7ElE0IpWlcqT5He57OsPxEEUy6Dy/WWIdabvhGlnxml/Q 9jidHaMb9MIgw== Received: from localhost (unknown [IPv6:2a01:e0a:2c:6930:5cf4:84a1:2763:fe0d]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: bbrezillon) by bali.collaboradmins.com (Postfix) with ESMTPSA id 5FF6217E0858; Mon, 5 May 2025 09:29:54 +0200 (CEST) Date: Mon, 5 May 2025 09:29:49 +0200 From: Boris Brezillon To: Simona Vetter Cc: Thomas Zimmermann , simona@ffwll.ch, airlied@gmail.com, asrivats@redhat.com, andyshrk@163.com, christian.koenig@amd.com, mripard@kernel.org, maarten.lankhorst@linux.intel.com, dri-devel@lists.freedesktop.org, Sumit Semwal , linux-media@vger.kernel.org, linaro-mm-sig@lists.linaro.org Subject: Re: [PATCH v3] drm/gem: Internally test import_attach for imported objects Message-ID: <20250505092949.1124657d@collabora.com> In-Reply-To: References: <20250416065820.26076-1-tzimmermann@suse.de> Organization: Collabora X-Mailer: Claws Mail 4.3.1 (GTK 3.24.49; x86_64-redhat-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" On Wed, 30 Apr 2025 11:07:17 +0200 Simona Vetter wrote: > On Wed, Apr 16, 2025 at 11:38:03AM +0200, Simona Vetter wrote: > > On Wed, Apr 16, 2025 at 08:57:45AM +0200, Thomas Zimmermann wrote: =20 > > > Test struct drm_gem_object.import_attach to detect imported objects. > > >=20 > > > During object clenanup, the dma_buf field might be NULL. Testing it in > > > an object's free callback then incorrectly does a cleanup as for nati= ve > > > objects. Happens for calls to drm_mode_destroy_dumb_ioctl() that > > > clears the dma_buf field in drm_gem_object_exported_dma_buf_free(). > > >=20 > > > v3: > > > - only test for import_attach (Boris) > > > v2: > > > - use import_attach.dmabuf instead of dma_buf (Christian) > > >=20 > > > Signed-off-by: Thomas Zimmermann > > > Fixes: b57aa47d39e9 ("drm/gem: Test for imported GEM buffers with hel= per") > > > Reported-by: Andy Yan > > > Closes: https://lore.kernel.org/dri-devel/38d09d34.4354.196379aa560.C= oremail.andyshrk@163.com/ > > > Tested-by: Andy Yan > > > Cc: Thomas Zimmermann > > > Cc: Anusha Srivatsa > > > Cc: Christian K=C3=B6nig > > > Cc: Maarten Lankhorst > > > Cc: Maxime Ripard > > > Cc: David Airlie > > > Cc: Simona Vetter > > > Cc: Sumit Semwal > > > Cc: "Christian K=C3=B6nig" > > > Cc: dri-devel@lists.freedesktop.org > > > Cc: linux-media@vger.kernel.org > > > Cc: linaro-mm-sig@lists.linaro.org =20 > >=20 > > Reviewed-by: Simona Vetter =20 >=20 > Also quick doc request: We do have a bit of overview documentation for > prime here about specifically this lifetime fun, and why there's a chain > of references and hence a distinction between imported foreign dma-buf and > re-imported native dma-buf: >=20 > https://dri.freedesktop.org/docs/drm/gpu/drm-mm.html#reference-counting-f= or-gem-drivers >=20 > I think it would be good to augment this with more links to functions > (like this one recently added and fixed in this patch here) and struct > members to that overview. And maybe also link from key function and struct > functions back to that overview doc. Otherwise I think the next person > will get confused by this rather tricky code again and break a corner > cases. BTW, could we also backmerge 6.15-rc5 into drm-misc-next so the fix is also present in drm-misc-next?