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=1796134506; b=YKQ720X7/BSWpUla2CQQCdE+aYAEcFBdnQRdhjHPojm/zrtjh9b+Kt6ioPuT1imH0l6B eXAPrEY7PicCS2Qy0Bm72aJzjTAosNh+jiA0UYCYVUgZ8MpmBrxTP1vg4q0zD9C5y8cMS V6UHlHotZ0UWa8ZHIgNytBPF0FdVlxtUFstHHyRdb5uSNvJgs4rMF99sOTtxM93UBcZCg 9zB5/pjNJwU2IndRJiqZbFcXFuRsFSu6+1iP7Th+VPIi17ebBkuSIbQxRweTWsvkPtarD 3/Qx0Vy8DVldHSP4IblO9toMop6m0USjuyjersQ97J2N1exak2i78MdZfSPLmye9QxA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796134506; 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=8klWWVVE/1i+T4p+tjF+lPMaprKtM6bJWESK1yLmXzU=; b=gfEfuedFHQnI7xQK69yJFGRszJXz03fcRJCCDKLgTGdN98z7xvv5+56PZsqSxPD6nXCo pys7XWjiJhHi7njUpceIdmrHj+mebAAXb7LEBrNPJjy591lGQHgkQ6wLDp+IHyaFMMQIE AklkpYvpVOk8j96bPObBpJA6MKMbbSLqjwqW3AmmBArGtyx9YzPawMuVTnClTF8Z0zGur GzVt7Nqp9nGvdQR0L7bUqm7ca5wVyFr6Ak2vkphE7nMKX+Pss3fMIdX7z84sAjPE4nq+V 4gn1Y5p+GdwXv877odF6Rwu+gMwFvkbx2fseSL62rzauEs+/fGQgdoPoGYpfRq1Mvrw== 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=lJ8hX2gT; 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)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 05521606A325; Tue, 1 Dec 2026 14:15:05 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 05521606A325 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=lJ8hX2gT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1796134503; bh=7FBUdCqMfno3vjdjLZmDtl6AeRNdaFxQlESGVOtGDVQ=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=lJ8hX2gTQZZQS9nRy+SwNC8OSnNSDWPb4ChcSnAF73sVTflWoVFK2ISBNmIwg51OG p33TZccBrGIGkOAYTYVsT87/mhfUpx4y2uHidKpGvOQUn4ZamBAhDNVuhHyk46Zaxr /VMyxja2/FxBKPg7WmhuFov73NSCH97xI84C55vwUvPM5eukrwJT3WHEjoJ04DuXAK jfsJN2y1AfS6D5lyN2xt1unlpC2Kc8tApatg9KhF8g4GB4zHFTzLDXMXojKS8JjSY2 t2OVgZlk2i3L5LndVzbIXOoAuGrXLCQfV3v6zauwEl5A0nEigw3315UjhVSw9rx5YN A+grzd5Z7Hi2Q== 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 F18FB17E004B; Tue, 01 Dec 2026 15:15:02 +0100 (CET) Date: Tue, 1 Dec 2026 15:14:54 +0100 From: Boris Brezillon To: Steven Price , Liviu Dudau , Akash Goel , Karunika Choo , Lukas Zapolskas , Chris Diamand Cc: Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Sumit Semwal , Christian =?UTF-8?B?S8O2bmln?= , 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: <20261201151454.2f7ce848@fedora1.home> In-Reply-To: <20261201-panhtor-dep-skip-v1-1-432f313dea0f@collabora.com> 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-kernel@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=US-ASCII Content-Transfer-Encoding: 7bit On Tue, 01 Dec 2026 14:58:53 +0100 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). > > 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. > > [1]https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/46172 > --- > drivers/gpu/drm/panthor/panthor_drv.c | 41 +++++++++++++++++++++++++++++++++++ > 1 file changed, 41 insertions(+) > > diff --git a/drivers/gpu/drm/panthor/panthor_drv.c b/drivers/gpu/drm/panthor/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 > > +#include > +#include > #include > #include > #include > @@ -591,6 +593,40 @@ panthor_submit_ctx_push_fences(struct panthor_submit_ctx *ctx) > } > } > > +static bool can_skip_dep(const struct drm_sched_job *job, struct dma_fence *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 == job->entity->fence_context || > + fence->context == 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))) > + return false; Oops, missing dma_fence_put() here (dma_fence_chain_for_each() owns a fence ref which needs to be released if we bail out early). > + } > + > + return true; > + } else if (dma_fence_is_array(fence)) { > + struct dma_fence *sub_fence; > + u32 index; > + > + dma_fence_array_for_each(sub_fence, index, fence) { > + if (!can_skip_dep(job, sub_fence)) > + return false; > + } > + > + return true; > + } > + > + return false; > +} > + > /** > * panthor_submit_ctx_add_sync_deps_to_job() - Add sync wait operations as > * job dependencies. > @@ -637,6 +673,11 @@ panthor_submit_ctx_add_sync_deps_to_job(struct panthor_submit_ctx *ctx, > return ret; > } > > + if (can_skip_dep(job, fence)) { > + dma_fence_put(fence); > + continue; > + } > + > ret = drm_sched_job_add_dependency(job, fence); > if (ret) > return ret; > > --- > base-commit: 28f286b0dfa9610d4ee2447415e964e8bc603056 > change-id: 20261201-panhtor-dep-skip-9c6a3e2f7cc7 > > Best regards,