From: sashiko-bot@kernel.org
To: MoGGuU <Naixumogu@whut.edu.cn>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH v2 2/3] accel/rocket: Collect job dependencies before arming
Date: Thu, 27 Aug 2026 17:20:24 +0000 [thread overview]
Message-ID: <20260827172025.4C68C1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260827170608.39511-3-Naixumogu@whut.edu.cn>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [High] Missing read-fence attachment on input BOs leaves buffers unprotected from subsequent writers.
--
commit ac74f22db3a0d06711502b6864c7b006136b26f3
Author: MoGGuU <Naixumogu@whut.edu.cn>
accel/rocket: Collect job dependencies before arming
rocket_job_push() arms the scheduler job before collecting its implicit
dependencies. Dependency collection can fail with -ENOMEM, but an armed
job must be pushed and must not be aborted with drm_sched_job_cleanup().
> diff --git a/drivers/accel/rocket/rocket_job.c b/drivers/accel/rocket/rocket_job.c
> index 7e3d123afc5ad..51e8b43c05131 100644
> --- a/drivers/accel/rocket/rocket_job.c
> +++ b/drivers/accel/rocket/rocket_job.c
[ ... ]
> @@ -206,19 +206,21 @@ static int rocket_job_push(struct rocket_job *job)
[ ... ]
> scoped_guard(mutex, &rdev->sched_lock) {
> drm_sched_job_arm(&job->base);
>
> job->inference_done_fence = dma_fence_get(&job->base.s_fence->finished);
>
> - ret = rocket_acquire_object_fences(job->in_bos, job->in_bo_count, &job->base, false);
> - if (ret)
> - goto err_unlock;
> -
> - ret = rocket_acquire_object_fences(job->out_bos, job->out_bo_count, &job->base, true);
> - if (ret)
> - goto err_unlock;
> -
> kref_get(&job->refcount); /* put by scheduler job completion */
>
> drm_sched_entity_push_job(&job->base);
[Severity: High]
This is a pre-existing issue, but does this leave the input buffers
unprotected from subsequent writers?
Looking at rocket_job_push() in drivers/accel/rocket/rocket_job.c, the
completion fence (job->inference_done_fence) is only attached to job->out_bos
just after this scoped_guard block:
rocket_attach_object_fences(job->out_bos, job->out_bo_count,
job->inference_done_fence);
The job->in_bos receive no completion fence.
Furthermore, rocket_attach_object_fences() hardcodes DMA_RESV_USAGE_WRITE:
for (i = 0; i < bo_count; i++)
dma_resv_add_fence(bos[i]->resv, fence, DMA_RESV_USAGE_WRITE);
This hardcoding prevents it from correctly attaching a read-fence for in_bos
even if it were called for them.
If a subsequent job writes to these input BOs, could it begin execution
without waiting for the current job to finish reading them? Since it will
lock the reservations and find no implicit read dependency from this job,
this might lead to hardware data races if unprivileged users submit sequential
jobs where one reads and the next writes to the same BO.
Should we also attach a read-fence to the input BOs and allow
rocket_attach_object_fences() to specify the usage type?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260827170608.39511-1-Naixumogu@whut.edu.cn?part=2
next prev parent reply other threads:[~2026-08-27 17:20 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-27 17:06 [PATCH v2 0/3] accel/rocket: Fix job submit error handling MoGGuU
2026-08-27 17:06 ` [PATCH v2 1/3] accel/rocket: Validate BO handle counts on job submission MoGGuU
2026-08-27 17:20 ` sashiko-bot
2026-08-28 2:03 ` Sidong Yang
2026-08-28 5:32 ` MoGGuU
2026-08-27 17:06 ` [PATCH v2 2/3] accel/rocket: Collect job dependencies before arming MoGGuU
2026-08-27 17:20 ` sashiko-bot [this message]
2026-08-27 17:06 ` [PATCH v2 3/3] accel/rocket: Propagate job submission errors MoGGuU
2026-08-27 17:18 ` 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=20260827172025.4C68C1F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=Naixumogu@whut.edu.cn \
--cc=dri-devel@lists.freedesktop.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.