From: sashiko-bot@kernel.org
To: "Arun Iyengar" <aiyengar1990@gmail.com>
Cc: dri-devel@lists.freedesktop.org, media-ci@linuxtv.org
Subject: Re: [PATCH v2 1/4] accel/rocket: Wait for in-flight jobs before releasing the file's BOs
Date: Fri, 04 Dec 2026 07:05:08 +0000 [thread overview]
Message-ID: <sashiko-outbox-249287@kernel.org> (raw)
In-Reply-To: <20261204-rocket-fixes-v2-1-e9f9bb6f1304@gmail.com>
Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [Medium] accel/rocket: rocket_job_close() stalls on killed jobs and
external fences
- [Medium] accel/rocket: rocket_job_close() uninterruptible wait can
hang on unbind
--
commit 7ea18d68a1c152e194461eacbc0e694b3f497db9
Author: Arun Iyengar <aiyengar1990@gmail.com>
accel/rocket: Wait for in-flight jobs before releasing the file's BOs
This commit moves rocket_job_close() from rocket_postclose() into a custom
release file operation so the scheduler entity is torn down before
drm_release() drops GEM handles. It also records the last pushed job's
finished fence in rocket_file_priv and waits on it in rocket_job_close().
[ ... ]
> diff --git a/drivers/accel/rocket/rocket_job.c b/drivers/accel/rocket/rocket_job.c
> index 454d465a39e37..32926afb0144c 100644
> --- a/drivers/accel/rocket/rocket_job.c
> +++ b/drivers/accel/rocket/rocket_job.c
[ ... ]
> @@ -246,6 +247,9 @@ static int rocket_job_push(struct rocket_job *job)
>
> kref_get(&job->refcount); /* put by scheduler job completion */
>
> + dma_fence_put(file_priv->last_job_fence);
> + file_priv->last_job_fence = dma_fence_get(job->inference_done_fence);
> +
> drm_sched_entity_push_job(&job->base);
> }
[Severity: Medium]
Can storing every pushed job's finished fence in file_priv->last_job_fence
cause rocket_job_close() to stall on killed queued jobs and external fences?
When a process with queued jobs closes the fd or is killed,
drm_sched_entity_kill() chains every unexecuted job one by one through
system_wq. In drm_sched_entity_kill_jobs_work(), each killed job also
waits on all job->dependencies before signaling s_fence->finished.
Because rocket_job_close() waits uninterruptibly on last_job_fence,
teardown blocks until those never-executed jobs drain and any external
dma_resv fences on PRIME-shared BOs signal. Updating last_job_fence only
for jobs scheduled in rocket_job_run() would avoid this stall.
[ ... ]
> @@ -585,6 +589,12 @@ void rocket_job_close(struct rocket_file_priv *rocket_priv)
> struct drm_sched_entity *entity = &rocket_priv->sched_entity;
>
> drm_sched_entity_destroy(entity);
> +
> + if (rocket_priv->last_job_fence) {
> + dma_fence_wait(rocket_priv->last_job_fence, false);
> + dma_fence_put(rocket_priv->last_job_fence);
> + }
> +
> kfree(rocket_priv->scheds);
> }
[Severity: Medium]
Does this uninterruptible dma_fence_wait() hang forever if a core is unbound
while a hung job is in flight?
rocket_remove() -> rocket_core_fini() -> rocket_job_fini() calls
drm_sched_fini() without a .cancel_job callback or core reset.
drm_sched_fini() cancels work_tdr while leaving the in-flight job's
s_fence->finished unsignaled, so a later close blocks permanently here.
Commit "accel/rocket: Reset the core at unbind" does not fully close this
race: a concurrent rocket_job_timedout() -> rocket_reset() can clear
core->reset.pending and restart work_run_job without ordering against
core->removing, letting rocket_job_run() submit a job before unbind.
In that case rocket_reset_work() returns early and drm_sched_fini() still
cancels work_tdr with the job in flight. That commit also calls
drm_sched_fini() without draining work_free_job or implementing
.cancel_job, leaking pending rocket_job objects and their references.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261204-rocket-fixes-v2-0-e9f9bb6f1304@gmail.com?part=1
next prev parent reply other threads:[~2026-12-04 7:05 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-04 6:35 [PATCH v2 0/4] accel/rocket: Fix teardown with a job on the NPU Arun Iyengar via B4 Relay
2026-12-04 6:35 ` Arun Iyengar via B4 Relay
2026-12-04 6:35 ` Arun Iyengar
2026-12-04 6:35 ` [PATCH v2 1/4] accel/rocket: Wait for in-flight jobs before releasing the file's BOs Arun Iyengar via B4 Relay
2026-12-04 6:35 ` Arun Iyengar via B4 Relay
2026-12-04 6:35 ` Arun Iyengar
2026-12-04 7:05 ` sashiko-bot [this message]
2026-12-04 6:35 ` [PATCH v2 2/4] accel/rocket: Reset the core before detaching its IOMMU Arun Iyengar via B4 Relay
2026-12-04 6:35 ` Arun Iyengar via B4 Relay
2026-12-04 6:35 ` Arun Iyengar
2026-12-04 6:35 ` [PATCH v2 3/4] accel/rocket: Stop the scheduler before releasing the IOMMU group Arun Iyengar via B4 Relay
2026-12-04 6:35 ` Arun Iyengar via B4 Relay
2026-12-04 6:35 ` Arun Iyengar
2026-12-04 7:03 ` sashiko-bot
2026-12-04 6:35 ` [PATCH v2 4/4] accel/rocket: Reset the core at unbind Arun Iyengar via B4 Relay
2026-12-04 6:35 ` Arun Iyengar via B4 Relay
2026-12-04 6:35 ` Arun Iyengar
2026-12-04 7:02 ` sashiko-bot
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=sashiko-outbox-249287@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=aiyengar1990@gmail.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=media-ci@linuxtv.org \
--cc=sashiko-reviews@lists.linux.dev \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.