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=1796211609; b=xS/biOJe4MvqCHzNtCloqf3fUyWbqZADIzHH+NKeW9HPn9a2u0wEsrWXnJhiqoooMhQi FK0iCGzg4V137dgs/N3B4yNP87YN9la4YSu+SehG/uZ77/RwmmuWskCaFJAzIw9x7+Ix8 sOcT5Mgk7hktiwCVIGC3uxG8/Uh6BLWkKzdhlpaawBVoQh0pJY9B7ONNJ02p6j8tTXT8O W2tzSdYtbgGuj9TKN3ooIlPJYFqKAODx7+ZSMif9QY1KVVgefFhiKZyLEw65ARO/odnYk mpcTSvmQBHuZuehhrIS3Uv/ahXFafuLLWeAdFTNLg6lNjcdmivrJIu4SXu3DqvqetHA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796211609; 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=OLWrgbrRS2X0XZDUobYSH/pRZss8JV96u5Q3xBf1NOs=; b=uopAC/7urEcJbj4j1FGda1TeP4OhniHdzPy/57JTnjAAzy5ZXbzM+RddQ8n0pu7nF6St 9/zx6jn8/EKiyMUCiOt0A6Ee3NQO5Dhd4KR37w7lCErf29ug0iPvsnOUt+0qIwyfe6yi8 Kutly6tpSEH7Oqja4G2c9af8yTGljKdoaL8UjPY9+EzcKphZ59uyX/43zc+nJTqg+qasv K/hAMxnJXOvW6GZD2dHSlAjc0it3te9yns2ka2NN2OIOy+N0uqaD65CdHdriA1TjlyFyY 50DblxIxXLrFaO6rPibiCTy+yCjHcu4tLFQhsN5KyZyvXf5e0SkbWqkxvOthdKaZM7g== 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=EYOw4SgS; 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 5582E606A31A; Wed, 2 Dec 2026 11:40:09 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 5582E606A31A 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=EYOw4SgS DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1796211607; bh=D4CSAVvSkD7VPRfVMeeKcdFUfvl6j7HAy4oIGTAfnns=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=EYOw4SgSyeuwJIo0eiISU9qVfAoOtC29Otwa0iPqL3F/tge/7ToXmXALcjzl0sA60 6bwKPe5+fJ0YsgnPdMz6VKl3dGiXc+cDdSPh3pxrt7uj78sbGAP9KNAxsn1awqik/m EXcsoF2GfFz3uB/oG0bdrH7gN+ubZCblZh8rVID8OPZWngF4sC9sgBTKo9JQc0WvFf zl4t1n7tGjTk45bQ0h/2VS1Gtd7rMFxTkpohcSKs6uE9diM0V7wt5ofFgg/rFrav0G 1Dt9+fRAG/BWNpo9WwcNunJLycnRa2zMVf8Jsu7MR6WJ8JEbGpD0dd3yejWzt7Ubm3 tcqbsEv9+zaLQ== 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 787B917E0967; Wed, 02 Dec 2026 12:40:06 +0100 (CET) Date: Wed, 2 Dec 2026 12:40:02 +0100 From: Boris Brezillon To: Tvrtko Ursulin 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 , 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 v3 2/2] drm/sched: Eliminate NOP dependencies at insertion time Message-ID: <20261202124002.6b38bd91@fedora1.home> In-Reply-To: <0efbca00-a2d6-4602-9e97-ee3d1573cb73@ursulin.net> References: <20261202-panhtor-dep-skip-v3-0-81c141ee0461@collabora.com> <20261202-panhtor-dep-skip-v3-2-81c141ee0461@collabora.com> <0efbca00-a2d6-4602-9e97-ee3d1573cb73@ursulin.net> 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 Wed, 2 Dec 2026 09:11:02 +0000 Tvrtko Ursulin 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 > > --- > > 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. 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.