From: "Danilo Krummrich" <dakr@kernel.org>
To: "Vladislav Zaharov" <vladazaharova2018@gmail.com>
Cc: <jhubbard@nvidia.com>, <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>
Subject: Re: [PATCH v7 3/4] gpu: nova-core: gsp: retain the GSP-RM log buffers after unbind
Date: Fri, 13 Nov 2026 21:34:31 +0100 [thread overview]
Message-ID: <DMUDCA92VZHT.2SU4452MMGWL@kernel.org> (raw)
In-Reply-To: <20261113075317.934264-4-vladazaharova2018@gmail.com>
On Fri Nov 13, 2026 at 8:53 AM CET, Vladislav Zaharov wrote:
> + /// Returns the copies of the GSP-RM log buffers of GPUs that are no longer bound.
> + pub(crate) fn retained_logs(&self) -> &Mutex<RetainedLogs> {
> + &self.retained_logs
> + }
NIT: Should be #[inline].
> + /// Exposes copies of the buffers in their place, if `gsp_keep_logs` is set.
> + fn retain(&self) -> Result {
> + if !crate::module_parameters::gsp_keep_logs.value() || !cfg!(CONFIG_DEBUG_FS) {
> + return Ok(());
> + }
This misses debugfs being disabled through the kernel command line with
debugfs=off.
Usually, drivers should treat debugfs availability as opaque. The Rust
abstraction keeps its backing data alive regardless of whether the entries were
created.
Here, the copies serve no purpose without debugfs, so checking availability
would have a concrete benefit. However, I don't think this case warrants
exposing debugfs::initialized(), which could be abused easily and encourage
unnecessary checks elsewhere.
Let's check only gsp_keep_logs.
> +
> + let logs = RetainedLogBuffers {
> + name: CString::try_from_fmt(fmt!("{}", self.dev.name()))?,
> + loginit: self.loginit.snapshot()?,
> + logintr: self.logintr.snapshot()?,
> + logrm: self.logrm.snapshot()?,
> + };
> +
> + if logs.loginit.is_empty() && logs.logintr.is_empty() && logs.logrm.is_empty() {
> + return Ok(());
> + }
> +
> + // Allocate before an earlier copy is dropped, so that a failure leaves that copy in place.
> + let scope = KBox::<debugfs::Scope<RetainedLogBuffers>>::new_uninit(GFP_KERNEL)?;
> + let data = NovaCoreModule::debugfs_data(self.dev);
> + let root = data.root();
> + let mut retained = data.retained_logs().lock();
> + retained.0.reserve(1, GFP_KERNEL)?;
This shouldn't be necessary.
> +
> + retained.remove(self.dev.name());
> +
> + let scope = scope.write_pin_init(root.scope(logs, self.dev.name(), |logs, dir| {
> + if !logs.loginit.is_empty() {
> + dir.read_binary_file(c"loginit", &logs.loginit);
> + }
> + if !logs.logintr.is_empty() {
> + dir.read_binary_file(c"logintr", &logs.logintr);
> + }
> + if !logs.logrm.is_empty() {
> + dir.read_binary_file(c"logrm", &logs.logrm);
> + }
> + }))?;
> +
> + retained.0.push(scope, GFP_KERNEL)?;
Please add a forwarding method for this.
next prev parent reply other threads:[~2026-11-13 20:34 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-13 7:53 [PATCH v7 0/4] gpu: nova-core: retain the GSP-RM log buffers Vladislav Zaharov
2026-11-13 7:53 ` [PATCH v7 1/4] gpu: nova-core: move the debugfs root into the module data Vladislav Zaharov
2026-11-13 7:53 ` [PATCH v7 2/4] gpu: nova-core: gsp: move the log buffers into their own file Vladislav Zaharov
2026-11-13 7:53 ` [PATCH v7 3/4] gpu: nova-core: gsp: retain the GSP-RM log buffers after unbind Vladislav Zaharov
2026-11-13 20:34 ` Danilo Krummrich [this message]
2026-11-13 7:53 ` [PATCH v7 4/4] 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=DMUDCA92VZHT.2SU4452MMGWL@kernel.org \
--to=dakr@kernel.org \
--cc=acourbot@nvidia.com \
--cc=aliceryhl@google.com \
--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 \
--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
all inboxes | Powered by JetHome®