From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=148.251.105.195 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796137780; b=r7gUQjiWNAn7C6Dc5DrhUSImfj010wkDjikW2vp28bs5/O8oP7aYiHwhqJHVa6jFoLCV 47o8ulmXJXas6CVgOIzgwq2NUL1eoZOWqidTUCR+p2YwtbVyr009T8w3jCjG2C8bZSDz0 bB4qvbovqvS2FaHfPXkGeIjHz5zLLPqmVomqyDqhf3MNTe9h/J3qDdRwSuGfqvd51ojLL 0lpBRIanjRL2VSNV16ECFyxzXXl0Q2Bpy2HjJsjUg0HNl+vAGve3UbDWvpy3Em8Xon/OJ 8p6oqveKqwWk+LYyH6RZCHMyn+A19RkScRt6rAJJiphaScspbLymccKc2iUFcipceVg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796137780; h=DMARC-Filter:DKIM-Signature:Received:Date:From:To:Cc:Subject: Message-ID:In-Reply-To:References:Organization:X-Mailer:MIME-Version: Content-Type:Content-Transfer-Encoding; bh=vQCGqad8Afr3wop6/vjSBgZwMzEPvD3MQbKY4Sb8Ej8=; b=uxXyygc7kstciIsOGroIiRFp8poh+ANVWJUwgxNToovBKe72ZyLKfNHYMiQvEBpDxiQd qfgsYSNFkV9fvevPWnqkW3qPLylcFA6ZvXqUtRhjN17r03iCRSEmAULTvmXMBK7RIqsW1 XsKDYVMt6CC+RCObympQ+KRs9tsvGka2NOuFNpfRmmh6ABZCatMf2PpA+SPj5/q3We1zV dyAk5jIBZFj2nvxPqjwL6OyWaZ062ydO+u9eL7Z8xo1+aGGEpIkahzmfabQ3og0Srfzn9 5aY8HTEUazvLsKej3cwHM2kwdikRKSlc5S55PK41BW1qql7GHCR6OEYOqb9J+YrRW4A== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=collabora.com; spf=pass smtp.mailfrom=collabora.com; dkim=pass header.d=collabora.com header.i=@collabora.com header.a=rsa-sha256 header.s=mail header.b=IiCF0Zm9; arc=none smtp.remote-ip=148.251.105.195 Received: from bali.collaboradmins.com (bali.collaboradmins.com [148.251.105.195]) (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 2AADB606A31A; Tue, 1 Dec 2026 15:09:39 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 2AADB606A31A Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=collabora.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=collabora.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=collabora.com header.i=@collabora.com header.a=rsa-sha256 header.s=mail header.b=IiCF0Zm9 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-Mailing-List: linux-media@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable 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