From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796117770; b=Vts8sLzvNxTruEVAOdXMpY+49ifscsnHVrmnqX+AWnpU44Opk+AOjwqT/HPap21juBdv 2HZ9CQ2eRmBc3Wxx/zhRLd5Gi8cFikivIQyvdhd7nHRiskBISL09HTJCp7HtdcU6YfhDN NoUtvHApxu0te/31MSiTEjOI+pxOp+DA+UjnvIAfVf2sqRy2QzrYOv6qK2XRPnzmey+nm JK7So1CNqPznPbd76wGAqlN/PrIoekgaL46OrvTK+U+tJd7Xf44rBbjM9ZCFCBI7b/JUf dsiRTb7nZqSKxB6Go/P7rg1O5gUpwPR+ghiYLVTWMn7SptEmXxW2S+pVeAwXgQTgIAg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796117770; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: MIME-Version:Content-Transfer-Encoding; bh=X0ukY915MCR1qiMt43ltf2NlCtT+z6EM5X3HRuvWQk0=; b=5sjZZhH4mInNfOolUUWMnq+qR7u4agIUAoTua/m0q7fdce8/0rPRY74Du2aQDPL+yU5x HGY+bNIHg0EjVUZu6S8ClYbVQZ9fu8AN74QKgWJy1mkF8F5ydthjcroJtKu+IltbHoq88 /eI7mRgf17x85wq8Fn42KvqWp3gYYRhrxqIzo3038ZOtjIbaDt/qgz0jNVAyx220ZAIC3 sm3z3dWODluzGEQTue2AnSOkpMHvTmxan8azFcLzzibU+sQWMvsTOikUfVF8dirnWz9dr dX9gNl1UjDZgSPIPio7fJrqjCjY+UYmEH8KafArI9O7OQyskI5hFs6wpooG1pcaj6mg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=W2jYfJzF; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (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 8AA22606A32C; Tue, 1 Dec 2026 09:36:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=W2jYfJzF Received: by smtp.kernel.org (Postfix) with ESMTPSA id 93F231F00898; Tue, 1 Dec 2026 09:36:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796117770; bh=X0ukY915MCR1qiMt43ltf2NlCtT+z6EM5X3HRuvWQk0=; h=From:To:Cc:Subject:Date; b=W2jYfJzF6glvEeCW55SdbDt8DG07eNuiEwum21nuyrHFqkQCSqluwfi7aHSnRco8h bzjzfbqY8zLhsrKJNDy0gL7fM4wtBGZ6S+Ofa59ixexKmuBjuyQSjUKvT+9yFOuZ3s ngyMkZTPilLPvWr2LZYZBgzlo/xjigxAs5IWDLIFrJ0prUUqVEGOQep7tR4LVsGcq7 Qp2RrC3DkFnZI0yBqM9lJyCs5PsLdsI7ls2HhfHYMYiDx3P8PBTAvlMGerLCtdh3V/ 5DvYLyYFqefJuFsKqwOe8z4jkqYQEabhF28FB07p2XzSToUQkjXjb0PlV1+gb+AL41 oVPV8TUTZrOEA== From: Philipp Stanner To: Matthew Brost , Danilo Krummrich , Philipp Stanner , =?UTF-8?q?Christian=20K=C3=B6nig?= , David Airlie , Simona Vetter , Sumit Semwal , Tvrtko Ursulin Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org Subject: [PATCH v2] drm/sched: Document reclaim restrictions for ops->prepare_job() Date: Tue, 1 Dec 2026 10:35:52 +0100 Message-ID: <20261201093551.731091-2-phasta@kernel.org> X-Mailer: git-send-email 2.56.0 X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit drm_sched_backend_ops->prepare_job() gets called from drm_sched_entity_pop_job(). Thus, it's in the fence critical path where a memory reclaim might wait for the job / fence to complete. Sleeping in general seems to be (currently) allowed in prepare_job(), but a sleeping allocation risks deadlock. Document the allocation pitfals for prepare_job(). Signed-off-by: Philipp Stanner --- Changes in v2: - Be more precise about the fence critical section. (Danilo) --- include/drm/gpu_scheduler.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/include/drm/gpu_scheduler.h b/include/drm/gpu_scheduler.h index 3b0978fa8cf0..30f7b2107c73 100644 --- a/include/drm/gpu_scheduler.h +++ b/include/drm/gpu_scheduler.h @@ -447,6 +447,11 @@ struct drm_sched_backend_ops { * * Can be NULL if no additional preparation to the dependencies are * necessary. Skipped when jobs are killed instead of run. + * + * This gets called after the job's dma_fence may have been published, + * thus, it must be considered a dma_fence signaling critical section. + * You must not perform sleeping allocations in your implementation, + * otherwise deadlocks can occur. */ struct dma_fence *(*prepare_job)(struct drm_sched_job *sched_job, struct drm_sched_entity *s_entity); -- 2.56.0