From mboxrd@z Thu Jan 1 00:00:00 1970 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 327D5606A331 for ; Tue, 1 Dec 2026 15:09:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.a=rsa-sha256 header.s=mail header.b=IiCF0Zm9 Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 8773610F9C7; Tue, 1 Dec 2026 15:09:45 +0000 (UTC) Received: from bali.collaboradmins.com (bali.collaboradmins.com [148.251.105.195]) by gabe.freedesktop.org (Postfix) with ESMTPS id A9A9A10F9C7 for ; Tue, 1 Dec 2026 15:09:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1796137778; bh=DRQvBUlA6y+H2/HdJDC5HgrGQ/hfVAJzM+89rJ79U/s=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=IiCF0Zm9TOV+DKNZ4L+2zrs6J+fj04ASr9eoiTk+JXkax5wkBG5TOYo8eVtzsb1Jj 845ox8abMY3pwWzuLkmcqY9COo5lJAPydpI6LdWpkTvEhSIq9KJgaoNbL7JWUpnlrp 4qoirmkX0oq8f/ub56iLnMyiVIoh8zs1FWc3iQUN1J72hRO7yImEToNbBynwrpIdB3 XS8XTqTwCH90rv9464RuYobzs5NtGjsxLKm/j/MXMLQ9ov4j6ClfNct6TmfTcpVS4Q 2uWskKZYyA+Qs3BsAUp9Kvvu0Lz2i68JnbpvicAFaBQSDm/hXGBsZ+xOQuleXHsyqj nE8yoYjeT2pAA== Received: from fedora1.home (unknown [100.64.0.11]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange secp256r1 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: bbrezillon) by bali.collaboradmins.com (Postfix) with ESMTPSA id 604CF17E004B; Tue, 01 Dec 2026 16:09:37 +0100 (CET) Date: Tue, 1 Dec 2026 16:09:30 +0100 From: Boris Brezillon To: Christian =?UTF-8?B?S8O2bmln?= Cc: Steven Price , Liviu Dudau , Akash Goel , Karunika Choo , Lukas Zapolskas , Chris Diamand , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Sumit Semwal , Philipp Stanner , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, linaro-mm-sig@lists.linaro.org, Xianzhong Li Subject: Re: [PATCH] drm/panthor: Skip job dependencies when we can Message-ID: <20261201160930.10feff50@fedora1.home> In-Reply-To: References: <20261201-panhtor-dep-skip-v1-1-432f313dea0f@collabora.com> Organization: Collabora X-Mailer: Claws Mail 4.4.0 (GTK 3.24.52; x86_64-redhat-linux-gnu) X-Archived-By: 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-Archive: List-Post: List-Help: List-Subscribe: , Sender: "dri-devel" X-Spam-Status: No, score=-17.3 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_2 autolearn=unavailable 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 On Tue, 1 Dec 2026 15:40:03 +0100 Christian K=C3=B6nig wrote: > On 12/1/26 14:58, Boris Brezillon wrote: > > If a job is passed a dependency that's coming from the same queue the > > job is targeting, we can get rid of the dependency because of the > > implicit serialization provided by the queue. This will allow us to take > > benefit of the pipelining provided by the ring buffer (no extra > > MCU <-> CPU round-trip to have the job pushed to the ring buffer). > >=20 > > Signed-off-by: Boris Brezillon > > Cc: Xianzhong Li > > --- > > Some recent effort to improve job pipelining [1] showed that the > > MCU <-> CPU round-trip that lets us signal job fences adds a > > non-negligible overhead, and this problem seems to be easier and > > more systematically fixed if it's addressed at the KMD side, so > > here's a patch doing exactly that. > >=20 > > [1]https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/46172 > > --- > > drivers/gpu/drm/panthor/panthor_drv.c | 41 +++++++++++++++++++++++++++= ++++++++ > > 1 file changed, 41 insertions(+) > >=20 > > diff --git a/drivers/gpu/drm/panthor/panthor_drv.c b/drivers/gpu/drm/pa= nthor/panthor_drv.c > > index dc8d0191aef4..cfffb9e2dec8 100644 > > --- a/drivers/gpu/drm/panthor/panthor_drv.c > > +++ b/drivers/gpu/drm/panthor/panthor_drv.c > > @@ -7,6 +7,8 @@ > > #include > > #endif > > =20 > > +#include > > +#include > > #include > > #include > > #include > > @@ -591,6 +593,40 @@ panthor_submit_ctx_push_fences(struct panthor_subm= it_ctx *ctx) > > } > > } > > =20 > > +static bool can_skip_dep(const struct drm_sched_job *job, struct dma_f= ence *fence) > > +{ > > + if (!fence) > > + return true; > > + > > + /* This fence comes from our queue, and the serialization happening at > > + * the queue level makes it so we can skip the CPU wait. > > + */ > > + if (fence->context =3D=3D job->entity->fence_context || > > + fence->context =3D=3D job->entity->fence_context + 1) > > + return true; > > + > > + if (dma_fence_is_chain(fence)) { > > + dma_fence_chain_for_each(fence, fence) { > > + if (!can_skip_dep(job, dma_fence_chain_contained(fence))) =20 >=20 > Recursion is usually not allowed inside the Linux kernel even when like i= n this case it is limited. >=20 > But you can use the dma_fence_unwrap_for_each() helper for this which sho= uld make the code much easier to write and understand. Oh yeah, I was definitely looking for something like that, just didn't look in the right place. I'll send a v2 making use of this helper. Thanks, Boris