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=1796143948; b=YvHJMHFhU9erLgBHNOMdq4fcSddjv23J9tftQGZrgjFvwncqUrRt1rpzZ5LioMu0UHtP it5dpwy1gh/ons5I4ZvuDSuV3IfuFoqSuX5oQQNWTiLHA/QYhRijxhldajyVI5LRYcMSm 4c0yYchCegGF7ShVelolfv4q7hGVgO7P28miniKoJMZVSWXh8v+ZPtQ80uJAH2TayJljZ FwHzJTtBOg9bFeK7foGibv8WB0eU3AVU5Mq/vAt/Jyk/shy+IgkL0YwIE0N4tEdoICnFE XievfT6zcJRRX6WpiI07VNbLpv708jaZegMqo6bwnpAbtheOjiw2AyoaXogmjFVvpsA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796143948; 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=451/I5B4Dqob9T9G0HQjeC9iG/i38IYgfAdBJyjgXNI=; b=a3gYPKauP+cU2/Cphd2WZys/KVyeepqH1ba6RJFnxohKIk+6mHCEJmj5YTa6BvayIg3e EsVIdbxJk596j1aOz2405GS30qHyEUzczzbS8umcihPYBKSAqDb2/s+TdW0neZtva3ZSI wULX8TMzCw3rYV2wvnlb9EwfQ/t76eebAyyhYbGHuRVvHAlnmHaNFP5EA6eOqPnXw31gt sgx/OT/fI24lPYGJaySvQN87NSY0eZ34T9iDYLnBcAfUw7lx/ZV31DLBSPvUnqmiKDYle rvuxmECgyW3P/e59IBPJjpqZTB2BTPI7QZjBdNSkO2eULlZyVIdYcAgnKLYFPUoDUUQ== 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=UfZmeaDe; 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 88D72606A330; Tue, 1 Dec 2026 16:52:27 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 88D72606A330 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=UfZmeaDe DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1796143945; bh=TOVZWLUtnO1u0fOgw0uEDrliPyRciyE092Xk0eRyNcg=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=UfZmeaDeiVzteSzFBD++XhXRm8al2P9E2KNSjr4QHtMnzm8mvX9lRfQHv2sEpQilg 0HitI1f66qb02Zwnau7iTxC6RyHg3zt4w4JIc2XXFmmCQ6fmf2cKmye0Iy2WfngKYx ss9bsKfQNjwoNomjMp9iFs+4/Aa0jd39f+Ih/PKsjp8vNr98/ql/qUCbxUoTpv3gXE /QAoDoQ4vURWTUmW/ybSxWvZ9l2/UK7y853bB+kUSAGE32cFHntorJBKuqp26R9AO1 igBWW/CmLhXQk3TMKkye+b5PjKR2XCspgKzs8sFZ1eBAHnBKkcDnsdV3M/a9MnMXOn jw+gFAwdXWYFw== 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 7C6BA17E0390; Tue, 01 Dec 2026 17:52:24 +0100 (CET) Date: Tue, 1 Dec 2026 17:52:19 +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 v2] drm/panthor: Explode container fences to optimize pipelining Message-ID: <20261201175219.0ac7186d@fedora1.home> In-Reply-To: <20261201-panhtor-dep-skip-v2-1-1b38efda8a0d@collabora.com> References: <20261201-panhtor-dep-skip-v2-1-1b38efda8a0d@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 17:35:28 +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 > benefit from the pipelining provided by the ring buffer (no extra > MCU <-> CPU round-trip to have the job pushed to the ring buffer). > > drm_sched_entity_add_dependency_cb() already has this optimization in > place, all we need to do is explode the chain/array containers with a > dma_fence_unwrap_for_each() when we add job dependencies. > > 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 > --- > Changes in v2: > - Explode container fences with dma_fence_unwrap_for_each() instead of > and rely on drm_sched_entity_add_dependency_cb() elimination instead > of open-coding it > --- > drivers/gpu/drm/panthor/panthor_drv.c | 17 +++++++++++++---- > 1 file changed, 13 insertions(+), 4 deletions(-) > > diff --git a/drivers/gpu/drm/panthor/panthor_drv.c b/drivers/gpu/drm/panthor/panthor_drv.c > index dc8d0191aef4..a527ce86a113 100644 > --- a/drivers/gpu/drm/panthor/panthor_drv.c > +++ b/drivers/gpu/drm/panthor/panthor_drv.c > @@ -7,6 +7,7 @@ > #include > #endif > > +#include > #include > #include > #include > @@ -612,8 +613,9 @@ panthor_submit_ctx_add_sync_deps_to_job(struct panthor_submit_ctx *ctx, > int ret = 0; > > for (u32 i = 0; i < sync_op_count; i++) { > + struct dma_fence *fence, *inner_fence; > struct panthor_sync_signal *sig_sync; > - struct dma_fence *fence; > + struct dma_fence_unwrap iter; > > if (!sync_op_is_wait(&sync_ops[i])) > continue; > @@ -637,9 +639,16 @@ panthor_submit_ctx_add_sync_deps_to_job(struct panthor_submit_ctx *ctx, > return ret; > } > > - ret = drm_sched_job_add_dependency(job, fence); > - if (ret) > - return ret; > + /* Explode containers so that drm_sched_entity_add_dependency_cb() can > + * eliminate fences that are coming from the same queue. > + */ > + dma_fence_unwrap_for_each(inner_fence, &iter, fence) { > + ret = drm_sched_job_add_dependency(job, inner_fence); Missing dma_fence_get(inner_fence) here, as reported by Sashiko. > + if (ret) { > + dma_fence_put(iter.chain); > + return ret; > + } > + } > } > > return 0; > > --- > base-commit: 28f286b0dfa9610d4ee2447415e964e8bc603056 > change-id: 20261201-panhtor-dep-skip-9c6a3e2f7cc7 > > Best regards,