dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Haoming Gao" <Naixumogu@whut.edu.cn>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH v5 2/3] accel/rocket: Collect job dependencies before arming
Date: Fri, 28 Aug 2026 06:55:29 +0000	[thread overview]
Message-ID: <20260828065529.F030D1F00A3A@smtp.kernel.org> (raw)
In-Reply-To: <20260828064152.37822-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 implicit synchronization for input BOs causes data corruption.
--

commit 00caeb1bd76ecd4176b74ead738756a7e287a306
Author: Haoming Gao <Naixumogu@whut.edu.cn>

accel/rocket: Collect job dependencies before arming

This commit fixes a job submission bug by collecting implicit dependencies
for input and output buffer objects before taking the scheduler lock and
arming the job. This ensures that dependency collection failures do not
cause an armed job to be aborted.

> 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);

[Severity: High]
This isn't a bug introduced by this patch, but looking at rocket_job_push()
immediately following this hunk:

	scoped_guard(mutex, &rdev->sched_lock) {
		...
		drm_sched_entity_push_job(&job->base);
	}

	rocket_attach_object_fences(job->out_bos, job->out_bo_count,
                                    job->inference_done_fence);

err_unlock:

Does this code also need to attach the completion fence to the input BOs?

While prior dependencies on in_bos are correctly acquired (ensuring we don't
read before prior writers finish), the job's completion fence
(inference_done_fence) is only attached to out_bos.

Because there is no read fence added to the input buffers, could future
writers (from userspace, CPU, or other GPU engines) bypass synchronization
and overwrite these BOs while the NPU is still actively reading them,
causing data corruption?

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

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

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-28  6:41 [PATCH v5 0/3] accel/rocket: Fix job submit error handling Haoming Gao
2026-08-28  6:41 ` [PATCH v5 1/3] accel/rocket: Validate BO handle counts on job submission Haoming Gao
2026-08-28  6:58   ` sashiko-bot
2026-08-28  6:41 ` [PATCH v5 2/3] accel/rocket: Collect job dependencies before arming Haoming Gao
2026-08-28  6:55   ` sashiko-bot [this message]
2026-08-28  6:41 ` [PATCH v5 3/3] accel/rocket: Propagate job submission errors Haoming Gao
2026-08-28  6:59   ` 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=20260828065529.F030D1F00A3A@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox