From: "Danilo Krummrich" <dakr@kernel.org>
To: "Philipp Stanner" <phasta@kernel.org>
Cc: "Matthew Brost" <matthew.brost@intel.com>,
"Christian König" <ckoenig.leichtzumerken@gmail.com>,
"David Airlie" <airlied@gmail.com>,
"Simona Vetter" <simona@ffwll.ch>,
"Sumit Semwal" <sumit.semwal@linaro.org>,
"Tvrtko Ursulin" <tvrtko.ursulin@igalia.com>,
dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
linux-media@vger.kernel.org
Subject: Re: [PATCH] drm/sched: Document reclaim restrictions for ops->prepare_job()
Date: Fri, 27 Nov 2026 15:30:33 +0100 [thread overview]
Message-ID: <DN62D8GGT0NN.1YHSKVVC6M67B@kernel.org> (raw)
In-Reply-To: <20261127142425.2956053-3-phasta@kernel.org>
On Fri Nov 27, 2026 at 3:24 PM CET, Philipp Stanner wrote:
> 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 <phasta@kernel.org>
> ---
> Didn't we recently discuss deprecating this callback for good?
> There's a great many users, though...
> ---
> include/drm/gpu_scheduler.h | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/include/drm/gpu_scheduler.h b/include/drm/gpu_scheduler.h
> index 3b0978fa8cf0..1e4d0399a9b9 100644
> --- a/include/drm/gpu_scheduler.h
> +++ b/include/drm/gpu_scheduler.h
> @@ -447,6 +447,10 @@ 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 in the job submission path (dma_fence critical path).
I think "job submission path" is slightly misleading. Not all of the operations
a driver performs on job submission are within the DMA fence signaling critical
path.
Maybe something like "This is called after the job's fence may have been
published and hence must be considered a DMA fence sginaling critical section."
> + * You must not perform sleeping allocations in your implementation, or
> + * deadlock can occur.
> */
> struct dma_fence *(*prepare_job)(struct drm_sched_job *sched_job,
> struct drm_sched_entity *s_entity);
> --
> 2.56.0
prev parent reply other threads:[~2026-11-27 14:30 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-27 14:24 Philipp Stanner
2026-11-27 14:30 ` Danilo Krummrich [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=DN62D8GGT0NN.1YHSKVVC6M67B@kernel.org \
--to=dakr@kernel.org \
--cc=airlied@gmail.com \
--cc=ckoenig.leichtzumerken@gmail.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=matthew.brost@intel.com \
--cc=phasta@kernel.org \
--cc=simona@ffwll.ch \
--cc=sumit.semwal@linaro.org \
--cc=tvrtko.ursulin@igalia.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®