All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Alexandre Courbot" <acourbot@nvidia.com>
Cc: dri-devel@lists.freedesktop.org,
	"Danilo Krummrich" <dakr@kernel.org>,
	ojeda@kernel.org
Subject: Re: [PATCH 1/4] gpu: nova-core: move GSP unload state to a pinned Gpu subobject
Date: Tue, 09 Jun 2026 08:16:12 +0000	[thread overview]
Message-ID: <20260609081612.C1C401F00898@smtp.kernel.org> (raw)
In-Reply-To: <20260609-boot-vram-v1-1-d9382610507a@nvidia.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Moving the GSP unload logic into `GspResources` while leaving `sysmem_flush` declared before `gsp_resources` in `Gpu` causes the sysmem flush memory page to be unregistered before the GSP is shut down, leading to hardware faults or DMA use-after-free.
--

commit 77c9cd387aef2d5054c5d4097053c58f9a0d5c45
Author: Alexandre Courbot <acourbot@nvidia.com>

gpu: nova-core: move GSP unload state to a pinned Gpu subobject

This commit moves the GSP state and unload bundle into a dedicated pinned
GspResources object to ensure that the GSP unload sequence is executed even
if a later Gpu field initialization fails.

> diff --git a/drivers/gpu/nova-core/gpu.rs b/drivers/gpu/nova-core/gpu.rs
> index b3c91731db45d..6b3e02c71dee1 100644
> --- a/drivers/gpu/nova-core/gpu.rs
> +++ b/drivers/gpu/nova-core/gpu.rs

[ ... ]

> +/// Structure holding the resources required to operate the GPU.
> +#[pin_data]
> +pub(crate) struct Gpu<'gpu> {
> +    spec: Spec,
> +    /// System memory page required for flushing all pending GPU-side memory writes done through
> +    /// PCIE into system memory, via sysmembar (A GPU-initiated HW memory-barrier operation).
> +    sysmem_flush: SysmemFlush<'gpu>,
> +    /// GSP and its resources.
> +    #[pin]
> +    gsp_resources: GspResources<'gpu>,
> +}

[Severity: High]
Since Rust drops struct fields in their declaration order, will sysmem_flush
be dropped before gsp_resources here?

If sysmem_flush drops first, it will unregister the system memory DMA page
by writing 0 to the hardware register. Next, when gsp_resources drops, its
PinnedDrop implementation will execute this.gsp.unload(...) which resets the
falcons.

Since the unload sequence strictly relies on the sysmembar flush page to
acknowledge resets and flush writes, won't this cause the hardware to attempt
to write to physical address 0 after the page has already been unregistered,
resulting in an IOMMU fault or driver timeout?

Should gsp_resources be declared before sysmem_flush to ensure the GSP is
shut down fully before the flush page is unregistered?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260609-boot-vram-v1-0-d9382610507a@nvidia.com?part=1

  reply	other threads:[~2026-06-09  8:16 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-09  8:03 [PATCH 0/4] gpu: nova-core: obtain and display VRAM amount Alexandre Courbot
2026-06-09  8:03 ` [PATCH 1/4] gpu: nova-core: move GSP unload state to a pinned Gpu subobject Alexandre Courbot
2026-06-09  8:16   ` sashiko-bot [this message]
2026-06-10  3:52   ` Eliot Courtney
2026-06-10 11:18     ` Alexandre Courbot
2026-06-10 12:30       ` Eliot Courtney
2026-06-10 10:14   ` Gary Guo
2026-06-10 11:21     ` Alexandre Courbot
2026-06-09  8:04 ` [PATCH 2/4] gpu: nova-core: move GPU static information acquisition to a GSP method Alexandre Courbot
2026-06-09  8:15   ` sashiko-bot
2026-06-10  3:39   ` Eliot Courtney
2026-06-10 10:16   ` Gary Guo
2026-06-09  8:04 ` [PATCH 3/4] gpu: nova-core: gsp: Extract usable FB region from GSP Alexandre Courbot
2026-06-10  3:35   ` Eliot Courtney
2026-06-10 10:23   ` Gary Guo
2026-06-10 10:27     ` Gary Guo
2026-06-10 15:38       ` Timur Tabi
2026-06-09  8:04 ` [PATCH 4/4] gpu: nova-core: gsp: Expose total physical VRAM end from FB region info Alexandre Courbot
2026-06-10  3:37   ` 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=20260609081612.C1C401F00898@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=acourbot@nvidia.com \
    --cc=dakr@kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=ojeda@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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.