From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=80.241.56.161 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796134195; b=r5lPRVHfOOX5qcXwdkrHC/OMAPb4dRAdkSEiXSJWC3PYH9cK2Y2WXq0NE6bUf3EcwwkB NSqw1dgUzMeTzIq2a6HGkemJ8RFn2bRRGc7rFo4aa9x3KSCNZcm4Z2iqdGYAuZSV+pMTN 2sud1JHsUzZHVT0OYp1JwnIVLNIDYsT4ZKoI1RCGMgdqI2eOXbECFaBa1NSfqF6yZbc3p uPUFUuCosmWL+DPPaj/2Aeaqb88R4OS8mJXt0brkR8rMa8KD2gr/tQBC+0dfELeXcBCIm UAR/vs6X08KEWnuCG6gDjwJMFficxih+/dzmCO3iCAiu4VBjLcstUiccW6Aarjd6NAQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796134195; h=DMARC-Filter:Received:DKIM-Signature:Message-ID:Subject:From: Reply-To:To:Cc:Date:In-Reply-To:References:Content-Type: Content-Transfer-Encoding:User-Agent:MIME-Version:X-MBO-RS-META: X-MBO-RS-ID; bh=ZSRvOi8An0KjhqZYFDagBS4VuWgRSH3hs1oZU/1uOU4=; b=AGFny2rfbGyq1JYcY0Phk7rG88R2hhlQ4n/lKHSI3kvKMGxL7eHTR+/nSXI2mLIJbvSr WSMrE46GL3b/QL6eRclF7jah2EcH5udmy3lXvlgtH7pZp6vogb4a48NTQxrKB1Lg219C4 DqhU/rrTgca5bwiVtLlK3wJ4Mg6ak2uzOzDEgsAs/53isKDdV6GngHileUJUCdFIrkWAK YDcAsjz/15w9bwatlo2Z+RwiCyI/4s9Hr70Og7u/zcgSIfQCLGRA0wFruYPisXa/YOIJc w2g7U76TsuDXhJ3aaAAYOhh9ZBJraV2Q2pB6RMf4Hm4CzolqKaI2K9PM6KIxi/yBmow== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=mailbox.org; spf=pass smtp.mailfrom=mailbox.org; dkim=pass header.d=mailbox.org header.i=@mailbox.org header.a=rsa-sha256 header.s=mail20150812 header.b=nWHoxto8; arc=none smtp.remote-ip=80.241.56.161 Received: from mout-p-103.mailbox.org (mout-p-103.mailbox.org [80.241.56.161]) (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 16366606A325; Tue, 1 Dec 2026 14:09:54 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 16366606A325 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=mailbox.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=mailbox.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=mailbox.org header.i=@mailbox.org header.a=rsa-sha256 header.s=mail20150812 header.b=nWHoxto8 Received: from smtp202.mailbox.org (smtp202.mailbox.org [IPv6:2001:67c:2050:b231:465::202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519MLKEM768 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-103.mailbox.org (Postfix) with ESMTPS id 4jf2p65fjgzKp21; Tue, 01 Dec 2026 15:09:50 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mailbox.org; s=mail20150812; t=1796134190; h=from:from:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ZSRvOi8An0KjhqZYFDagBS4VuWgRSH3hs1oZU/1uOU4=; b=nWHoxto8NlqgyfCZEW6OFHacHkZv8kOj98GZxH+s2jUncbxKPofyzyWXoZri5w0dcqfP1v yFZDAl0hq6HcMzR7h6VJ1eNtEMUO+u5mJizdFoogSUkBshvCdm8GdMGM2O+ue6By9lk/s+ SNylnw51ooId+EH2kfCH3+NmDdSMIIn4HO+Tz9Vb3L3I2cX5vH7xo72NkjOGII1icxLdeN 57FnwcrqLfsH5tMSnjrXAlcdpOMHLj68Zl/oKtLqI6jhKlqgogmFbGPjEzKBGqMWz2YdqT dqjz9QgV04LAUTIoGzQuhntjMzHsBD70nr7rWszeOlSVtKTnXFLSuZ0gTnCD/g== Message-ID: Subject: Re: [PATCH] drm/panthor: Skip job dependencies when we can From: Philipp Stanner Reply-To: phasta@kernel.org To: Boris Brezillon , 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 =?ISO-8859-1?Q?K=F6nig?= , 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 Date: Tue, 01 Dec 2026 15:09:47 +0100 In-Reply-To: <20261201-panhtor-dep-skip-v1-1-432f313dea0f@collabora.com> References: <20261201-panhtor-dep-skip-v1-1-432f313dea0f@collabora.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.60.2 (3.60.2-3.fc44) 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 X-MBO-RS-META: 9ku77tejch3grnunwr59bkdmcfehybor X-MBO-RS-ID: 0915840fcf3d518d752 On Tue, 2026-12-01 at 14:58 +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. Shouldn't drm_sched be doing that already? See below. Am I understanding correctly that someone sets a dependency for something on the same userspace context, not merely relying on FIFO behavior? JobQueue currently is not deadlock-resistant against that because I expected drivers to ignore such deps. >=20 >=20 [=E2=80=A6] > =C2=A0 > +static bool can_skip_dep(const struct drm_sched_job *job, struct dma_fen= ce *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 =3D=3D job->entity->fence_context || > + =C2=A0=C2=A0=C2=A0 fence->context =3D=3D job->entity->fence_context + 1= ) > + return true; > + [=E2=80=A6] > + if (can_skip_dep(job, fence)) { > + dma_fence_put(fence); drm_sched does: static bool drm_sched_entity_add_dependency_cb(struct drm_sched_entity *ent= ity, struct drm_sched_job *sched_job) { struct drm_gpu_scheduler *sched =3D entity->rq->sched; struct dma_fence *fence =3D entity->dependency; struct drm_sched_fence *s_fence; if (fence->context =3D=3D entity->fence_context || fence->context =3D=3D 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 */ dma_fence_put(entity->dependency); return false; } I seem to be missing something, because at first glance drm_sched should ignore your added dependencies. P.