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=1796133560; b=lyl6p8+eS7iJDY/qrjqNCq4/0uCLVdsXIDnPEVCCuYnjbuLA9RVqKL5hwRDgQ1rGLoVf qHv3WdO2lfwKyaGuaCwVVXH4QPKnKOAJFAAayncP0/WmOmG+XXtsWQxWs1ttmV7RqL0Po HRUsca+8E3HypHrAqMkXvF4oGTEoAzecqL997gorKx1ak0VTDhL8OT1s9YTCowmuEJu7t h2T0NPK9r0spsp+yB2PtAZ89oyw7Rlx71q/3asJ+zj4+nPQyzzMkF1xMfAbwCQKzdTR/F Ld0AwBvJ1q9o55KO/k5N1KVagz2xPxAzqjHH3VSzDlkmi6BQ4lTt/NQCpX1TghU/fvg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796133560; h=DMARC-Filter:DKIM-Signature:Received:From:Date:Subject:MIME-Version: Content-Type:Content-Transfer-Encoding:Message-Id:X-B4-Tracking: X-Change-ID:To:Cc:X-Mailer:X-Developer-Signature:X-Developer-Key; bh=srhADzVR4PgV3TESJAuFEaacztaOI94p+DZU6Jb6OUA=; b=EYPs4zQ4Ei6H5mUtsWfMaJDt9nxxTKKHzHhNuGhNcZv+JgJKaZNNa0UQBHHeIr0Xg6G5 um9m86IvXC9usUQMPHls8Dy60n+w1fK1KTPS2XZKycwMoK2ghL9wcj8nVwzmjaYIIV6Tt m+OaTpHDgfg70xcZ7uYOd6ffY1IY8FeZU3gsmUlZbjfT3FVgoYb3PHCuWGMMLqe08GzmN 9oXmSyahnKdGAthBqt0dFSSOc0jBQC6xzTOhK2r1hCejwArwSSl1bVcR/hJImiCFde1DH fWBTOulKAzTg5xKuHlYeVgrEvhm+5m++NzJOm1huM3FWizgwH1am0m0YA5yk3yja6Kw== 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=G5m4c+Xy; 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 E14F8606A31A; Tue, 1 Dec 2026 13:59:19 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org E14F8606A31A 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=G5m4c+Xy DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1796133558; bh=iYIoYFqYahOms1w3VDvoe6yrN22EZkz8NPLhm+Z8dbg=; h=From:Date:Subject:To:Cc:From; b=G5m4c+XykucEF4SHYxyeH9WMLhLzZYStcmBjBEETsaJHUxzx31T1IaPfNLpdSWxwL 3vVmd8gb+R8sDommh/5Wa3V6vLHK4q06xCsfJnb68X0a50p3cQ1Y/ofEDr+2Mm9R4c DwvcNlGwg4xj2ORBls1+YnmSfCXUMxMUx1mSoRO358fSyQLLrMemP5ji6ZAykiTEWO JDN0JfIaKph8Z5Vp9c5SZoyl9dFCOPwGVd1RnI9miT1tLzdAcM6FajjT2kfEQUaIPB xEn12nneNx/ojF4BwVdmqzOPAoxBnFjqyKiqB1ZJeWMOKoaRt89rBnuudNlp+xm+pX AW/TUaiWg15wg== Received: from fedora1.home (unknown [100.64.0.11]) (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 2E1C617E0648; Tue, 01 Dec 2026 14:59:17 +0100 (CET) From: Boris Brezillon Date: Tue, 01 Dec 2026 14:58:53 +0100 Subject: [PATCH] drm/panthor: Skip job dependencies when we can 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="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20261201-panhtor-dep-skip-v1-1-432f313dea0f@collabora.com> X-B4-Tracking: v=1; b=H4sIAAAAAAAA/x3MUQqAIBAFwKss77uFNCjyKtGH2FZLYKIRQXj3o DnAvCiSVQocvchya9EzwpFpCGH3cRPWBY5gW9sb2xpOPu7XmXmRxOXQxGPofSd2HUIY0BBSllW fv5zmWj99+ampYgAAAA== X-Change-ID: 20261201-panhtor-dep-skip-9c6a3e2f7cc7 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 , =?utf-8?q?Christian_K=C3=B6nig?= , Philipp Stanner , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, linaro-mm-sig@lists.linaro.org, Boris Brezillon , Xianzhong Li X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1796133557; l=2920; i=boris.brezillon@collabora.com; s=20260429; h=from:subject:message-id; bh=iYIoYFqYahOms1w3VDvoe6yrN22EZkz8NPLhm+Z8dbg=; b=9Y/zeGWIfTVHQm5GHcWXKAgbhMc5ufAS19v1fmYhEx5l09X3FLrTPS3VavinSWA1cEG5dxZGN uT7BtReZOTmCRM/EAf0HmobvgziMfpiNoe9RlvGQXnP9ls2Ll1wkou9 X-Developer-Key: i=boris.brezillon@collabora.com; a=ed25519; pk=eN+ORdOgQY7d5U+0kA8h5bf67XdD8bhKbjD/TCHexSY= 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; + } + + 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, -- Boris Brezillon