From: sashiko-bot@kernel.org
To: "Brajesh Gupta" <brajesh.gupta@imgtec.com>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH] drm/imagination: Update the trace point pvr_job_submit_fw()
Date: Wed, 22 Jul 2026 11:42:46 +0000 [thread overview]
Message-ID: <20260722114246.A7ACB1F00A3A@smtp.kernel.org> (raw)
In-Reply-To: <20260722-b4-tracepoint-fix-v1-1-f75747fa591a@imgtec.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Moving `trace_pvr_job_submit_fw(frag_job)` after the hardware kick introduces a race condition that can result in a Use-After-Free on `frag_job`.
--
--- Patch [1]: [PATCH] drm/imagination: Update the trace point pvr_job_submit_fw() ---
commit 290fb87e4c730ddd81be1c9d52004f26f109de14
Author: Brajesh Gupta <brajesh.gupta@imgtec.com>
drm/imagination: Update the trace point pvr_job_submit_fw()
This commit moves the pvr_job_submit_fw() trace point after writing the command
to the Kernel circular buffer to better represent submission to the firmware.
> diff --git a/drivers/gpu/drm/imagination/pvr_queue.c b/drivers/gpu/drm/imagination/pvr_queue.c
> --- a/drivers/gpu/drm/imagination/pvr_queue.c
> +++ b/drivers/gpu/drm/imagination/pvr_queue.c
[ ... ]
> @@ -802,6 +800,9 @@ static struct dma_fence *pvr_queue_run_job(struct drm_sched_job *sched_job)
> job->hwrt,
> frag_job->fw_ccb_cmd_type ==
> ROGUE_FWIF_CCB_CMD_TYPE_FRAG_PR);
> +
> + trace_pvr_job_submit_fw(geom_job);
> + trace_pvr_job_submit_fw(frag_job);
[Severity: High]
Could this lead to a use-after-free on frag_job if the GPU finishes the
combined kick quickly?
If pvr_queue_run_job() issues the combined hardware kick via
pvr_cccb_send_kccb_combined_kick(), the GPU begins execution immediately.
If the thread gets preempted or the GPU simply completes the jobs very quickly,
the done_fence could be signaled via interrupts before the tracepoint is
reached.
If the fragment queue's scheduler thread wakes up, processes the completion,
and frees frag_job, then geom_job's scheduler thread would resume and call
trace_pvr_job_submit_fw(frag_job) on freed memory, because geom_job doesn't
appear to hold a reference on frag_job.
Should we take an extra reference to frag_job before the hardware kick, or
perhaps move the tracepoint back before the kick?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260722-b4-tracepoint-fix-v1-1-f75747fa591a@imgtec.com?part=1
prev parent reply other threads:[~2026-07-22 11:42 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-22 11:25 [PATCH] drm/imagination: Update the trace point pvr_job_submit_fw() Brajesh Gupta
2026-07-22 11:42 ` sashiko-bot [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=20260722114246.A7ACB1F00A3A@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=brajesh.gupta@imgtec.com \
--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.