From: "Eliot Courtney" <ecourtney@nvidia.com>
To: "Gary Guo" <gary@garyguo.net>,
"Eliot Courtney" <ecourtney@nvidia.com>,
"Danilo Krummrich" <dakr@kernel.org>,
"Alexandre Courbot" <acourbot@nvidia.com>,
"Alice Ryhl" <aliceryhl@google.com>,
"David Airlie" <airlied@gmail.com>,
"Simona Vetter" <simona@ffwll.ch>,
"Benno Lossin" <lossin@kernel.org>
Cc: "John Hubbard" <jhubbard@nvidia.com>,
"Alistair Popple" <apopple@nvidia.com>,
"Timur Tabi" <ttabi@nvidia.com>, <nova-gpu@lists.linux.dev>,
<dri-devel@lists.freedesktop.org>, <linux-kernel@vger.kernel.org>,
<rust-for-linux@vger.kernel.org>,
"dri-devel" <dri-devel-bounces@lists.freedesktop.org>
Subject: Re: [PATCH 05/13] gpu: nova-core: gsp: keep FMC boot params DMA region alive during error
Date: Wed, 17 Jun 2026 14:27:21 +0900 [thread overview]
Message-ID: <DJB2QJAXEDVF.2KUIUQ90Q818W@nvidia.com> (raw)
In-Reply-To: <DJ9SQ12O99GR.3TDJ2L39P03GQ@garyguo.net>
On Tue Jun 16, 2026 at 2:23 AM JST, Gary Guo wrote:
> On Mon Jun 15, 2026 at 3:40 PM BST, Eliot Courtney wrote:
>> Currently, if, for example `boot_fmc` fails, `FmcBootArgs` will be
>> dropped before the boot unload guard. But until everything is unloaded,
>> GSP may access this memory, so make sure it doesn't get deallocated.
>
> Hmm, this looks very weirld. `boot_fmc` only needs `&args` but it actually need
> it for much longer?
>
> This is hinting to me that the signature is wrong of the `boot_fmc` function is
> wrong..
>
> What is the exact lifetime requirement for GSP?
Once `wait_for_gsp_lockdown_release` returns, it no longer needs the
allocation. In the case that we get an error in this function, GSP may
be (asychronously to the CPU) accessing the DMA memory we gave it. So
FmcBootArgs should stay alive until FspUnloadBundle finishes (GSP is
reset) if there is an error, or, until `wait_for_gsp_lockdown_release`
returns successfully.
So for `boot_fmc` to cover the actual lifetime it would need to be
responsible for waiting until GSP is reset, which it doesn't feel like
it should be responsible for (even as some unload bundle that it
returns).
An alternative could be making another local guard holding the
reference:
```
let unload_guard = FmcBootGuard::new(
BootUnloadGuard::new(gsp, dev, bar, gsp_falcon, sec2_falcon, Some(unload_bundle)),
&args,
);
```
WDYT?
>
>>
>> Signed-off-by: Eliot Courtney <ecourtney@nvidia.com>
>> ---
>> drivers/gpu/nova-core/gsp/hal/gh100.rs | 20 ++++++++++----------
>> 1 file changed, 10 insertions(+), 10 deletions(-)
>>
>> diff --git a/drivers/gpu/nova-core/gsp/hal/gh100.rs b/drivers/gpu/nova-core/gsp/hal/gh100.rs
>> index 98f5ce197d13..b08761af89d3 100644
>> --- a/drivers/gpu/nova-core/gsp/hal/gh100.rs
>> +++ b/drivers/gpu/nova-core/gsp/hal/gh100.rs
>> @@ -162,16 +162,6 @@ fn boot<'a>(
>> ) -> Result<BootUnloadGuard<'a>> {
>> let fsp_fw = FspFirmware::new(dev, chipset, FIRMWARE_VERSION)?;
>>
>> - let unload_bundle = crate::gsp::UnloadBundle(
>> - KBox::new(FspUnloadBundle, GFP_KERNEL)? as KBox<dyn UnloadBundle>
>> - );
>> -
>> - // Wrap the unload bundle into a drop guard so it is automatically run upon failure.
>> - let unload_guard =
>> - BootUnloadGuard::new(gsp, dev, bar, gsp_falcon, sec2_falcon, Some(unload_bundle));
>> -
>> - let mut fsp = Fsp::wait_secure_boot(dev, bar, chipset, fsp_fw)?;
>> -
>> let args = FmcBootArgs::new(
>> dev,
>> chipset,
>> @@ -180,6 +170,16 @@ fn boot<'a>(
>> false,
>> )?;
>>
>> + let mut fsp = Fsp::wait_secure_boot(dev, bar, chipset, fsp_fw)?;
>> +
>> + let unload_bundle = crate::gsp::UnloadBundle(
>> + KBox::new(FspUnloadBundle, GFP_KERNEL)? as KBox<dyn UnloadBundle>
>> + );
>> +
>> + // Wrap the unload bundle into a drop guard so it is automatically run upon failure.
>> + let unload_guard =
>> + BootUnloadGuard::new(gsp, dev, bar, gsp_falcon, sec2_falcon, Some(unload_bundle));
>> +
>
> This usual "usage beyond reference lifetime" needs to be at least explicitly
> mentioned here.
>
> Best,
> Gary
>
>> fsp.boot_fmc(dev, bar, fb_layout, &args)?;
>>
>> wait_for_gsp_lockdown_release(dev, bar, gsp_falcon, args.boot_params_dma_handle())?;
next prev parent reply other threads:[~2026-06-17 5:27 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-15 14:40 [PATCH 00/13] gpu: nova-core: blackwell follow-ups and fixes Eliot Courtney
2026-06-15 14:40 ` [PATCH 01/13] gpu: nova-core: fsp: limit FSP receive message allocation size Eliot Courtney
2026-06-15 17:11 ` Gary Guo
2026-06-16 7:33 ` Alistair Popple
2026-06-15 14:40 ` [PATCH 02/13] gpu: nova-core: fsp: catch bogus queue pointer issues Eliot Courtney
2026-06-15 17:15 ` Gary Guo
2026-06-16 7:57 ` Alistair Popple
2026-06-16 10:57 ` Gary Guo
2026-06-17 3:51 ` Eliot Courtney
2026-06-17 4:31 ` Alistair Popple
2026-06-15 14:40 ` [PATCH 03/13] gpu: nova-core: fsp: try to enforce exclusive access to FSP channel Eliot Courtney
2026-06-15 17:16 ` Gary Guo
2026-06-17 2:55 ` Eliot Courtney
2026-06-17 3:12 ` John Hubbard
2026-06-15 14:40 ` [PATCH 04/13] gpu: nova-core: falcon: gsp: move PRIV target mask constants Eliot Courtney
2026-06-15 17:17 ` Gary Guo
2026-06-16 8:02 ` Alistair Popple
2026-06-15 14:40 ` [PATCH 05/13] gpu: nova-core: gsp: keep FMC boot params DMA region alive during error Eliot Courtney
2026-06-15 17:23 ` Gary Guo
2026-06-17 5:27 ` Eliot Courtney [this message]
2026-06-17 13:52 ` Gary Guo
2026-06-15 14:40 ` [PATCH 06/13] gpu: nova-core: fsp: move FMC firmware loading into wait_secure_boot Eliot Courtney
2026-06-15 17:24 ` Gary Guo
2026-06-15 14:40 ` [PATCH 07/13] gpu: nova-core: gsp: ensure lifetime for FMC boot DMA allocations Eliot Courtney
2026-06-15 14:40 ` [PATCH 08/13] gpu: nova-core: gsp: ensure LibOS DMA allocation lives long enough Eliot Courtney
2026-06-17 6:11 ` Alistair Popple
2026-06-15 14:40 ` [PATCH 09/13] gpu: nova-core: wait for FSP boot earlier Eliot Courtney
2026-06-17 14:27 ` Alexandre Courbot
2026-06-15 14:40 ` [PATCH 10/13] gpu: nova-core: split FbLayout into FSP and non-FSP versions Eliot Courtney
2026-06-15 14:40 ` [PATCH 11/13] gpu: nova-core: correct FRTS vidmem offset calculation Eliot Courtney
2026-06-15 14:40 ` [PATCH 12/13] gpu: nova-core: rename heap size field Eliot Courtney
2026-06-15 14:40 ` [PATCH 13/13] gpu: nova-core: return non-WPR heap size as u64 from HALs Eliot Courtney
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=DJB2QJAXEDVF.2KUIUQ90Q818W@nvidia.com \
--to=ecourtney@nvidia.com \
--cc=acourbot@nvidia.com \
--cc=airlied@gmail.com \
--cc=aliceryhl@google.com \
--cc=apopple@nvidia.com \
--cc=dakr@kernel.org \
--cc=dri-devel-bounces@lists.freedesktop.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=gary@garyguo.net \
--cc=jhubbard@nvidia.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lossin@kernel.org \
--cc=nova-gpu@lists.linux.dev \
--cc=rust-for-linux@vger.kernel.org \
--cc=simona@ffwll.ch \
--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