From: "Christian König" <christian.koenig@amd.com>
To: Boris Brezillon <boris.brezillon@collabora.com>,
Tvrtko Ursulin <tursulin@ursulin.net>
Cc: Steven Price <steven.price@arm.com>,
Liviu Dudau <liviu.dudau@arm.com>,
Akash Goel <akash.goel@arm.com>,
Karunika Choo <karunika.choo@arm.com>,
Lukas Zapolskas <lukas.zapolskas@arm.com>,
Chris Diamand <chris.diamand@arm.com>,
Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
Maxime Ripard <mripard@kernel.org>,
Thomas Zimmermann <tzimmermann@suse.de>,
David Airlie <airlied@gmail.com>, Simona Vetter <simona@ffwll.ch>,
Sumit Semwal <sumit.semwal@linaro.org>,
Philipp Stanner <phasta@kernel.org>,
dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
linux-media@vger.kernel.org, linaro-mm-sig@lists.linaro.org,
Xianzhong Li <xianzhong.li@nxp.com>
Subject: Re: [PATCH v3 2/2] drm/sched: Eliminate NOP dependencies at insertion time
Date: Wed, 2 Dec 2026 13:16:17 +0100 [thread overview]
Message-ID: <5a9a6d8f-291d-406f-9f9a-350f375ea47a@amd.com> (raw)
In-Reply-To: <20261202124002.6b38bd91@fedora1.home>
On 12/2/26 12:40, Boris Brezillon wrote:
> On Wed, 2 Dec 2026 09:11:02 +0000
> Tvrtko Ursulin <tursulin@ursulin.net> wrote:
>
>> On 02/12/2026 09:00, Boris Brezillon wrote:
>>> All dependencies get added through drm_sched_job_add_dependency() or
>>> variants that call drm_sched_job_add_dependency() internally. At this
>>> point, the job is already attached an entity, and we can do the
>>> same-entity check there, so we don't insert the fence in the XArray in
>>> the first place.
>>>
>>> Note that we keep the elimination logic in
>>> drm_sched_entity_add_dependency_cb() too, because dependencies returned
>>> by ::prepare_job() could also potentially be coming from the same
>>> entity.
>>>
>>> Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
>>> ---
>>> drivers/gpu/drm/scheduler/sched_entity.c | 8 +-------
>>> drivers/gpu/drm/scheduler/sched_main.c | 5 +++++
>>> include/drm/gpu_scheduler.h | 20 ++++++++++++++++++++
>>> 3 files changed, 26 insertions(+), 7 deletions(-)
>>>
>>> diff --git a/drivers/gpu/drm/scheduler/sched_entity.c b/drivers/gpu/drm/scheduler/sched_entity.c
>>> index 03e68b4102d5..39419b3ac552 100644
>>> --- a/drivers/gpu/drm/scheduler/sched_entity.c
>>> +++ b/drivers/gpu/drm/scheduler/sched_entity.c
>>> @@ -473,13 +473,7 @@ static bool drm_sched_entity_add_dependency_cb(struct drm_sched_entity *entity,
>>> struct dma_fence *fence = entity->dependency;
>>> struct drm_sched_fence *s_fence;
>>>
>>> - if (fence->context == entity->fence_context ||
>>> - fence->context == entity->fence_context + 1) {
>>> - /*
>>> - * Fence is a scheduled/finished fence from a job
>>> - * which belongs to the same entity, we can ignore
>>> - * fences from ourself
>>> - */
>>> + if (drm_sched_entity_can_skip_dependency(entity, fence)) {
>>> dma_fence_put(entity->dependency);
>>> return false;
>>> }
>>> diff --git a/drivers/gpu/drm/scheduler/sched_main.c b/drivers/gpu/drm/scheduler/sched_main.c
>>> index 85a49e219837..5f123a5e39ff 100644
>>> --- a/drivers/gpu/drm/scheduler/sched_main.c
>>> +++ b/drivers/gpu/drm/scheduler/sched_main.c
>>> @@ -678,6 +678,11 @@ int drm_sched_job_add_dependency(struct drm_sched_job *job,
>>> if (!fence)
>>> return 0;
>>>
>>> + if (drm_sched_entity_can_skip_dependency(job->entity, fence)) {
>>> + dma_fence_put(fence);
>>> + return 0;
>>
>> I thought we could be braver and unwrap, snipping at the root much more
>> than just the plain fences. As written it is not super exciting, but I
>> am also not saying the two have to come together. It can be considered
>> as a follow up.
IIRC I tried that once and it caused problems.
The background was that you have cases where you need to have a CPU round trip between submissions to the same engine because the run_job() callback needed the information from the previous submission to correctly stitch together the current one.
I then later cleaned that up by introducing the DRM_SCHED_FENCE_DONT_PIPELINE flag, so it should work now but please keep in mind that this might cause regressions.
Regards,
Christian.
>
> Just sent a new version introducing a
> drm_sched_job_add_dependency_unwrapped() helper so drivers don't have
> to do that manually. Sorry for the fast iteration rate BTW, but I
> oscillate between mesa and kernel a lot these days, and every time I
> leave something unfinished on the kernel side it tends to rot and
> eventually fall through cracks, so I thought this time I'd try to push
> this through as fast as possible, especially since there seems to be no
> controversy on the proposed changes. Please let me know if you want me
> to slow things down a bit.
prev parent reply other threads:[~2026-12-02 12:16 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-02 9:00 [PATCH v3 0/2] drm/panthor: Improve job pipelining Boris Brezillon
2026-12-02 9:00 ` [PATCH v3 1/2] drm/panthor: Explode container fences to optimize pipelining Boris Brezillon
2026-12-02 9:00 ` [PATCH v3 2/2] drm/sched: Eliminate NOP dependencies at insertion time Boris Brezillon
2026-12-02 9:11 ` Tvrtko Ursulin
2026-12-02 9:28 ` Boris Brezillon
2026-12-02 11:40 ` Boris Brezillon
2026-12-02 12:16 ` Christian König [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5a9a6d8f-291d-406f-9f9a-350f375ea47a@amd.com \
--to=christian.koenig@amd.com \
--cc=airlied@gmail.com \
--cc=akash.goel@arm.com \
--cc=boris.brezillon@collabora.com \
--cc=chris.diamand@arm.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=karunika.choo@arm.com \
--cc=linaro-mm-sig@lists.linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=liviu.dudau@arm.com \
--cc=lukas.zapolskas@arm.com \
--cc=maarten.lankhorst@linux.intel.com \
--cc=mripard@kernel.org \
--cc=phasta@kernel.org \
--cc=simona@ffwll.ch \
--cc=steven.price@arm.com \
--cc=sumit.semwal@linaro.org \
--cc=tursulin@ursulin.net \
--cc=tzimmermann@suse.de \
--cc=xianzhong.li@nxp.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®