dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
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 v5 2/3] gpu: nova-core: gsp: retain the GSP-RM log buffers after unbind
Date: Wed, 23 Sep 2026 05:05:25 +0000	[thread overview]
Message-ID: <20260923050526.250941F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20260923045551.229259-3-vladazaharova2018@gmail.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] gpu: nova-core: unordered put pointer in log buffer snapshot
--

commit e3a18fe9cea338c661ee3d185d004b01a5ff3d7d
Author: Vladislav Zaharov <vladazaharova2018@gmail.com>

gpu: nova-core: gsp: retain the GSP-RM log buffers after unbind

This commit adds a gsp_keep_logs module parameter to retain GSP-RM log
buffers after GPU unbind or probe failure. It creates copies of the
buffers in memory owned by the module and exposes them through debugfs,
moving the buffer logic to a separate logbuffer.rs file.

> diff --git a/drivers/gpu/nova-core/gsp/logbuffer.rs b/drivers/gpu/nova-core/gsp/logbuffer.rs
> new file mode 100644
> index 0000000000000..b1f912fb3fae1
> --- /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]
Since copy_to_slice() reads the entire buffer, including the put pointer at
offset 0, and has no internal read ordering guarantees, can the read of the
put pointer inside copy_to_slice() be reordered after the data reads?

If the GSP is still appending data concurrently (e.g. after a boot timeout),
the snapshot might capture a newer put pointer but stale log data. This could
cause the log parser to read garbage or fail, defeating the purpose of the
explicit dma_mb(Read) barrier.

> +
> +        Ok(snapshot)
> +    }
> +}

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260923045551.229259-1-vladazaharova2018@gmail.com?part=2

  reply	other threads:[~2026-09-23  5:05 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-23  4:55 [PATCH v5 0/3] gpu: nova-core: retain the GSP-RM log buffers Vladislav Zaharov
2026-09-23  4:55 ` [PATCH v5 1/3] gpu: nova-core: move the debugfs root into the module data Vladislav Zaharov
2026-09-23  4:55 ` [PATCH v5 2/3] gpu: nova-core: gsp: retain the GSP-RM log buffers after unbind Vladislav Zaharov
2026-09-23  5:05   ` sashiko-bot [this message]
2026-09-23  4:55 ` [PATCH v5 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=20260923050526.250941F000FF@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox