From: Vladislav Zaharov <vladazaharova2018@gmail.com>
To: dakr@kernel.org, jhubbard@nvidia.com
Cc: acourbot@nvidia.com, aliceryhl@google.com, ttabi@nvidia.com,
gary@garyguo.net, nova-gpu@lists.linux.dev,
dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
linux-doc@vger.kernel.org,
Vladislav Zaharov <vladazaharova2018@gmail.com>
Subject: [PATCH v3 0/3] gpu: nova-core: retain the GSP-RM log buffers
Date: Sat, 12 Sep 2026 14:18:39 +0700 [thread overview]
Message-ID: <20260912071842.622696-1-vladazaharova2018@gmail.com> (raw)
The GSP-RM log buffers are exposed through debugfs, but the entries are
owned by the Gpu that probe() builds, and the buffers themselves are DMA
allocations that cannot outlive the device. They are therefore gone as
soon as the GPU is unbound, and in particular as soon as probe() fails -
which is the case todo.rst singled out, and the one where a GSP log is
worth having.
Patch 1 is a fix this series needs: init() builds the Registration before
the guard that clears the debugfs root, so a registration that fails
leaves the root behind with nothing left to remove it, and the next load
finds the name taken. Patch 2 adds a gsp_keep_logs module parameter: when
it is set, whatever the GSP wrote is copied into memory owned by the
module and exposed under a "retained" directory until the module is
unloaded. Patch 3 drops the now completed task from todo.rst.
Changes since v2:
- rebase onto current drm-rust-next, where Coherent carries the lifetime
of the bound device; the live log buffers borrow the device rather
than holding a reference to it, and only the copies keep one
- make gsp_keep_logs a bool, now that module parameters support it
- add the dma_rmb() discussed on v1, as dma_mb(Read), between reading
the "put" pointer and copying the buffer
- build the debugfs guard before the Registration (patch 1), so that a
failed module init cannot leave either directory behind
- keep nothing when CONFIG_DEBUG_FS is off, where a Dir is a zero-sized
type and the copies could never be read back
- take the snapshots before acquiring the global lock, rather than
holding it across three 64 KiB allocations
Testing was done on top of drm-rust-next with the TLV firmware images
installed. On a GB203:
- with gsp_keep_logs unset, no "retained" directory is created and the
entries disappear on unbind, as before;
- with gsp_keep_logs=1, retained/<BDF>/{loginit,logintr,logrm} hold
the contents the live entries had, all 64 KiB of each readable;
- binding the GPU again recreates the live entries without disturbing
the copies, and unbinding it a second time replaces them, leaving
exactly one set behind;
- with a failure injected after the GSP has booted, probe() fails with
-EINVAL, the driver stays unbound, and the logs of that attempt are
still readable;
- with a failure injected into the Registration instead, the module
fails to load and leaves no debugfs directory behind, where before
patch 1 the next load would have found the name taken;
- the copies are released on module unload, and three load/unload
cycles leave nothing behind;
- 1, Y and y turn it on, 0 and N turn it off, and a value that is
neither is refused at load time.
The parameter does need a value: the Rust bool param ops do not set
KERNEL_PARAM_OPS_FL_NOARG, so a bare gsp_keep_logs is refused, where the
C bool would have taken it.
No warnings, oopses or refcount complaints in dmesg throughout. Built and
checked with CLIPPY=1 and rustfmtcheck. checkpatch --strict is clean
apart from the MAINTAINERS note for the new file, which is already
covered by the existing "F: drivers/gpu/nova-core/" pattern.
John Hubbard's r000 series adds three more log buffers in gsp.rs.
Whichever of the two lands second needs a small rebase; the retained
copies extend to the new buffers by adding them to RetainedLogBuffers.
v2: https://lore.kernel.org/nova-gpu/20260815050826.306717-1-vladazaharova2018@gmail.com/
v1: https://lore.kernel.org/nova-gpu/20260812113752.532537-1-vladazaharova2018@gmail.com/
Vladislav Zaharov (3):
gpu: nova-core: build the debugfs guard before registering the driver
gpu: nova-core: gsp: retain the GSP-RM log buffers after unbind
Documentation: nova: remove completed GSP log buffer task
Documentation/gpu/nova/core/todo.rst | 12 --
drivers/gpu/nova-core/gsp.rs | 100 ++-------
drivers/gpu/nova-core/gsp/logbuffer.rs | 267 +++++++++++++++++++++++++
drivers/gpu/nova-core/nova_core.rs | 36 +++-
4 files changed, 320 insertions(+), 95 deletions(-)
create mode 100644 drivers/gpu/nova-core/gsp/logbuffer.rs
base-commit: 73e5616f3d197c1af5a04a481fe0f13aa3913bd1
--
2.55.0
next reply other threads:[~2026-09-12 7:18 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-12 7:18 Vladislav Zaharov [this message]
2026-09-12 7:18 ` [PATCH v3 1/3] gpu: nova-core: build the debugfs guard before registering the driver Vladislav Zaharov
2026-09-12 7:18 ` [PATCH v3 2/3] gpu: nova-core: gsp: retain the GSP-RM log buffers after unbind Vladislav Zaharov
2026-09-12 17:55 ` Gary Guo
2026-09-12 7:18 ` [PATCH v3 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=20260912071842.622696-1-vladazaharova2018@gmail.com \
--to=vladazaharova2018@gmail.com \
--cc=acourbot@nvidia.com \
--cc=aliceryhl@google.com \
--cc=dakr@kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=gary@garyguo.net \
--cc=jhubbard@nvidia.com \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nova-gpu@lists.linux.dev \
--cc=ttabi@nvidia.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