From: sashiko-bot@kernel.org
To: "Vladislav Zaharov" <vladazaharova2018@gmail.com>
Cc: "Alexandre Courbot" <acourbot@nvidia.com>,
dri-devel@lists.freedesktop.org,
"Danilo Krummrich" <dakr@kernel.org>
Subject: Re: [PATCH v4 2/3] gpu: nova-core: gsp: retain the GSP-RM log buffers after unbind
Date: Sun, 13 Sep 2026 18:47:59 +0000 [thread overview]
Message-ID: <20260913184759.E13A51F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20260913183734.134307-3-vladazaharova2018@gmail.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] The `dma_mb(Read)` memory barrier does not protect against data races because the snapshot relies on the `put` pointer re-read by the unordered `copy_to_slice()`.
--
commit cb68e0aae9b03cb04a10d2043892acfc8a1fe581
Author: Vladislav Zaharov <vladazaharova2018@gmail.com>
gpu: nova-core: gsp: retain the GSP-RM log buffers after unbind
Adds a module parameter to retain GSP-RM log buffers after unbind, making
them available through debugfs. This copies the contents into module-owned
memory since the original buffers are DMA allocations that do not outlive
the device.
> diff --git a/drivers/gpu/nova-core/gsp/logbuffer.rs b/drivers/gpu/nova-core/gsp/logbuffer.rs
> new file mode 100644
> index 0000000000000..890aa2f9e38e7
> --- /dev/null
> +++ b/drivers/gpu/nova-core/gsp/logbuffer.rs
[ ... ]
> + fn snapshot(&self) -> Result<VVec<u8>> {
> + // Offset 0 holds the "put" pointer, which the GSP advances as it appends entries. It is
> + // still zero if nothing was ever logged, which is all that is tested here: a buffer that
> + // was written to is copied whole, and making sense of "put" is left to the decoder.
> + let put = io_project!(self.0, [build: ..size_of::<u64>()]).try_cast::<u64>()?;
> + if put.read_val() == 0 {
> + return Ok(VVec::new());
> + }
> +
> + // ORDERING: LOAD->LOAD ordering needed to order the "put" read before the data read. The
> + // GSP has normally been stopped by the time this runs, but a boot that timed out can leave
> + // it still appending.
> + dma_mb(Read);
> +
> + let mut snapshot = VVec::zeroed(LOG_BUFFER_SIZE, GFP_KERNEL)?;
> + io_project!(self.0, [build: ..]).copy_to_slice(&mut snapshot);
[Severity: Medium]
Does the unordered copy_to_slice() at the end of this function negate the
effect of dma_mb(Read)?
If a boot times out, the GSP may still be appending logs when
LogBuffer::snapshot() is called. The safely ordered "put" value is dropped
here, and the snapshot relies on the "put" pointer being re-read by the
unordered copy_to_slice() operation.
This means copy_to_slice() can read the log payload before reading the "put"
pointer at offset 0. If the GSP concurrently writes new logs and updates the
"put" pointer, the snapshot could capture the updated "put" pointer but stale
log payload data, causing the user-space decoder to parse garbage data.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260913183734.134307-1-vladazaharova2018@gmail.com?part=2
next prev parent reply other threads:[~2026-09-13 18:48 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-13 18:37 [PATCH v4 0/3] gpu: nova-core: retain the GSP-RM log buffers Vladislav Zaharov
2026-09-13 18:37 ` [PATCH v4 1/3] gpu: nova-core: move the debugfs root into the module data Vladislav Zaharov
2026-09-13 18:47 ` sashiko-bot
2026-09-13 18:37 ` [PATCH v4 2/3] gpu: nova-core: gsp: retain the GSP-RM log buffers after unbind Vladislav Zaharov
2026-09-13 18:47 ` sashiko-bot [this message]
2026-09-13 18:37 ` [PATCH v4 3/3] Documentation: nova: remove completed GSP log buffer task Vladislav Zaharov
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=20260913184759.E13A51F000FF@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=acourbot@nvidia.com \
--cc=dakr@kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=vladazaharova2018@gmail.com \
/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.