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 BF181D11707 for ; Mon, 1 Dec 2025 13:39:38 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 7F00410E411; Mon, 1 Dec 2025 13:39:34 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; secure) header.d=mailbox.org header.i=@mailbox.org header.b="raC6aTam"; dkim-atps=neutral Received: from mout-p-103.mailbox.org (mout-p-103.mailbox.org [80.241.56.161]) by gabe.freedesktop.org (Postfix) with ESMTPS id E9EA910E7C3; Thu, 27 Nov 2025 10:16:39 +0000 (UTC) Received: from smtp1.mailbox.org (smtp1.mailbox.org [10.196.197.1]) (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) by mout-p-103.mailbox.org (Postfix) with ESMTPS id 4dHC5J3Srfz9t5M; Thu, 27 Nov 2025 11:16:36 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mailbox.org; s=mail20150812; t=1764238596; h=from:from:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=/LwMaXtJBDLXQXsCQXnsteb1mtiqvJkilJ+dHEkj54k=; b=raC6aTamMxW3XjfgydWAdK4gvLHYOWYg89ZahO46b/L2hJ73UNWoB23IOUuy6deSE87H2x gLKD+aF4bvPXisVcAZwug5eUHK/cGm2GfGUsFGsk212L3JVrzXrc4tdNBxR30B+P7OwYKd 1HZU1boijNknhlg/InkP09RyDOiqqdhmza522BYaqiacCFTGGvUHVzmOiBcYEqtUilZoA9 6owl1co+7Wkf5nGrOCEuG8ZResFMNoaECA2zEkWgZngSNfOO5UMCUbLDhWDijZ8kwMsFCY qSNRytCNexkzAcgGNAuuIvkdIyXOrYvtLQoWA4CRnxVFQQEHBqdG3/17b1Gt3Q== Message-ID: <89c04c8b3ca0fadf73452ca20ffd61cb106d762a.camel@mailbox.org> Subject: Re: [PATCH 1/6] dma-buf/dma-fence: Add dma_fence_test_signaled_flag() From: Philipp Stanner To: Christian =?ISO-8859-1?Q?K=F6nig?= , phasta@kernel.org, Matthew Brost Cc: Sumit Semwal , Gustavo Padovan , Felix Kuehling , Alex Deucher , David Airlie , Simona Vetter , Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , Tvrtko Ursulin , Huang Rui , Matthew Auld , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , Lucas De Marchi , Thomas =?ISO-8859-1?Q?Hellstr=F6m?= , linux-media@vger.kernel.org, dri-devel@lists.freedesktop.org, linaro-mm-sig@lists.linaro.org, linux-kernel@vger.kernel.org, amd-gfx@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org, rust-for-linux@vger.kernel.org, Tvrtko Ursulin Date: Thu, 27 Nov 2025 11:16:26 +0100 In-Reply-To: References: <20251126131914.149445-2-phasta@kernel.org> <20251126131914.149445-3-phasta@kernel.org> <35189892c0cb774155e2012d41371b4d3f8e7d0f.camel@mailbox.org> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MBO-RS-ID: bc88f92c2f8974133ff X-MBO-RS-META: yz6764qr1bhitjd3f1i7yofkkz7wzuth X-Mailman-Approved-At: Mon, 01 Dec 2025 13:39:28 +0000 X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: phasta@kernel.org Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" On Thu, 2025-11-27 at 11:01 +0100, Christian K=C3=B6nig wrote: > On 11/27/25 10:16, Philipp Stanner wrote: > > On Thu, 2025-11-27 at 09:11 +0100, Christian K=C3=B6nig wrote: > > > On 11/26/25 17:55, Matthew Brost wrote: > > > > On Wed, Nov 26, 2025 at 08:41:27AM -0800, Matthew Brost wrote: > > > > > On Wed, Nov 26, 2025 at 02:19:10PM +0100, Philipp Stanner wrote: > > > > > > The dma_fence framework checks at many places whether the signa= led flag > > > > > > of a fence is already set. The code can be simplified and made = more > > > > > > readable by providing a helper function for that. > > > > > >=20 > > > > > > Add dma_fence_test_signaled_flag(), which only checks whether a= fence is > > > > > > signaled. Use it internally. > > > > > >=20 > > > > > > Suggested-by: Tvrtko Ursulin > > > > > > Signed-off-by: Philipp Stanner > > > > >=20 > > > > > This is a nice cleanp: > > > > > Reviewed-by: Matthew Brost > > > > >=20 > > > > > > --- > > > > > > =C2=A0drivers/dma-buf/dma-fence.c | 19 +++++++++---------- > > > > > > =C2=A0include/linux/dma-fence.h=C2=A0=C2=A0 | 24 ++++++++++++++= ++++++++-- > > > > > > =C2=A02 files changed, 31 insertions(+), 12 deletions(-) > > > > > >=20 > > > > > > diff --git a/drivers/dma-buf/dma-fence.c b/drivers/dma-buf/dma-= fence.c > > > > > > index 39e6f93dc310..25117a906846 100644 > > > > > > --- a/drivers/dma-buf/dma-fence.c > > > > > > +++ b/drivers/dma-buf/dma-fence.c > > > > > > @@ -372,8 +372,7 @@ int dma_fence_signal_timestamp_locked(struc= t dma_fence *fence, > > > > > > =C2=A0 > > > > > > =C2=A0 lockdep_assert_held(fence->lock); > > > > > > =C2=A0 > > > > > > - if (unlikely(test_and_set_bit(DMA_FENCE_FLAG_SIGNALED_BIT, > > > > > > - =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 &fence->flags))) > > > >=20 > > > > I need to read a little better, I think this change isn't quite rig= ht. > > > > The original code is test and set, the updated code is test only (i= .e., > > > > you are missing the set step). So maybe just leave this line as is. > > >=20 > > > Oh, good point! I've totally missed that as well. > >=20 > > Oh dear; I also just saw it when opening the mail client ._. > >=20 > > >=20 > > > But that means that this patch set hasn't even been smoke tested. > >=20 > > I've built it and did some basic testing with my Nouveau system. Any > > suggestions? Do you have a CI that one can trigger? >=20 > DMA-buf has CONFIG_DMABUF_SELFTESTS which should be able to catch things = like that. >=20 > But even running Nouveau should have found this since basically no fence = at would signal any more. They will signal and execute their callbacks, but all is_signaled() checks are then broken. Thx for the feedback, I'll be more careful with changes like those and test more extensively. P.