All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: MoGGuU <Naixumogu@whut.edu.cn>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH v4 2/3] accel/rocket: Collect job dependencies before arming
Date: Fri, 28 Aug 2026 06:31:29 +0000	[thread overview]
Message-ID: <20260828063129.D8A341F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260828061916.20405-3-Naixumogu@whut.edu.cn>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:

Pre-existing issues:
- [High] Job completion fence is not attached to input BOs, breaking write-after-read implicit synchronization.
--

commit cebaafa7df2deb9058de28738100dc37ff2d7c70
Author: MoGGuU <Naixumogu@whut.edu.cn>

accel/rocket: Collect job dependencies before arming

This commit modifies rocket_job_push() to collect implicit dependencies
before taking the scheduler lock and arming the job. This prevents an armed
job from being incorrectly aborted if dependency collection fails with
-ENOMEM.

Cc: stable@vger.kernel.org

> diff --git a/drivers/accel/rocket/rocket_job.c b/drivers/accel/rocket/rocket_job.c
> index 13f4915c1b07c..1634c30ede456 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);
>  	}
>
> 	rocket_attach_object_fences(job->out_bos, job->out_bo_count, job->inference_done_fence);

[Severity: High]
This is a pre-existing issue, but does this code miss attaching the completion
fence to the input buffers?

If a userspace application submits a job with input buffers, then immediately
submits another job (or performs a CPU write) to modify those same buffers, the
hardware might read corrupted or new data because it is still reading from them.

Because no read fence is explicitly attached to the input buffers (in_bos)
after the job is pushed, the DRM scheduler and CPU wait paths will not see a
dependency and will not wait for the inference job to complete its read
operations.

Should the driver also explicitly attach the completion fence to job->in_bos
(perhaps with DMA_RESV_USAGE_READ) so that subsequent writers wait for this job
to finish reading?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260828061916.20405-1-Naixumogu@whut.edu.cn?part=2

  reply	other threads:[~2026-08-28  6:31 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-28  6:19 [PATCH v4 0/3] accel/rocket: Fix job submit error handling MoGGuU
2026-08-28  6:19 ` [PATCH v4 1/3] accel/rocket: Validate BO handle counts on job submission MoGGuU
2026-08-28  6:33   ` Greg KH
2026-08-28  6:41     ` Haoming Gao
2026-08-28  6:35   ` sashiko-bot
2026-08-28  6:19 ` [PATCH v4 2/3] accel/rocket: Collect job dependencies before arming MoGGuU
2026-08-28  6:31   ` sashiko-bot [this message]
2026-08-28  6:19 ` [PATCH v4 3/3] accel/rocket: Propagate job submission errors MoGGuU
2026-08-28  6:29   ` 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=20260828063129.D8A341F000E9@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.