NVIDIA GPU driver infrastructure
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Danilo Krummrich" <dakr@kernel.org>,
	acourbot@nvidia.com, aliceryhl@google.com, airlied@gmail.com,
	simona@ffwll.ch, lossin@kernel.org, gary@garyguo.net
Cc: nova-gpu@lists.linux.dev, dri-devel@lists.freedesktop.org,
	ojeda@kernel.org
Subject: Re: [PATCH] gpu: nova-core: use pin-init self-referential support
Date: Tue, 10 Nov 2026 15:37:39 +0000	[thread overview]
Message-ID: <sashiko-outbox-207273@kernel.org> (raw)
In-Reply-To: <20261110152746.140351-1-dakr@kernel.org>

Thank you for your contribution! Sashiko AI review found no new issues
in this patch, but noticed 1 related pre-existing issue it does not
introduce:
- [Medium] gpu: nova-core: missing PCI device cleanup in probe() [1]
--

commit 29c3fdaf952e7762e87f691bed7be2d19d9871ac
Author: Danilo Krummrich <dakr@kernel.org>

gpu: nova-core: use pin-init self-referential support

This commit replaces unsafely derived self-referential borrows in nova-core
with pin-init's self-referential support.

Link: https://lore.kernel.org/all/20261008-dev-selfref-v2-0-e280b3c8fba5@garyguo.net/ [1]

> diff --git a/drivers/gpu/nova-core/driver.rs b/drivers/gpu/nova-core/driver.rs
> index 560a70c4f5a7d..ac5a9d9f83313 100644
> --- a/drivers/gpu/nova-core/driver.rs
> +++ b/drivers/gpu/nova-core/driver.rs

[ ... ]

> @@ -129,44 +131,25 @@ fn probe<'bound>(
>                  crate::irq::doorbell_test::run_selftest(pdev, bar, spec.chipset)?;
>              },
>  
> -            // TODO: Use self-referential pin-init syntax once available.
> -            gpu <- Gpu::new(
> -                pdev,
> -                // SAFETY: `bar` is initialized above, pinned, and outlives `gpu`.
> -                unsafe { &*core::ptr::from_ref(bar) },
> -                // SAFETY: `bar1` is initialized above, pinned, and outlives `gpu`.
> -                unsafe { &*core::ptr::from_ref(bar1) },
> -            ).pin_chain(|_gpu| {
> +            gpu <- Gpu::new(pdev, bar, bar1).pin_chain(|_gpu| {
>                  #[cfg(CONFIG_NOVA_CORE_SELFTESTS)]
>                  _gpu.run_selftests(pdev);
>                  Ok(())
>              }),

[Severity: Medium]
This problem wasn't introduced by this patch, but does NovaCoreDriver::probe()
leak the PCI device enable count and leave bus mastering active [1] if a
later step in try_pin_init!() fails or when the driver is unbound?

Earlier in the initializer block, probe() enables the device and bus mastering
without a cleanup guard or devres management:

drivers/gpu/nova-core/driver.rs:NovaCoreDriver::probe() {
    ...
        try_pin_init!(NovaCore {
            _: {
                pdev.enable_device_mem()?;
                pdev.set_master();
            },

            bar: pdev.iomap_region_sized::<BAR0_SIZE>(0, c"nova-core/bar0")?,
    ...
}

If bar mapping, Gpu::new(), or auxiliary registration fails, or when NovaCore
is dropped on unbind, nothing reverses enable_device_mem() or clears bus
mastering.

[1] https://sashiko.dev/#/bug/linux-c8fbc048-c40f-4093-b156-461f41a6e9fe

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261110152746.140351-1-dakr@kernel.org?part=1

  reply	other threads:[~2026-11-10 15:37 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-10 15:27 [PATCH] gpu: nova-core: use pin-init self-referential support Danilo Krummrich
2026-11-10 15:37 ` sashiko-bot [this message]
2026-11-11  5:00 ` Eliot Courtney
2026-11-11  8:49 ` Gary Guo
2026-11-11 11:14   ` Danilo Krummrich
2026-11-11 11:30 ` Gary Guo
2026-11-11 15:43   ` Danilo Krummrich

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=sashiko-outbox-207273@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=acourbot@nvidia.com \
    --cc=airlied@gmail.com \
    --cc=aliceryhl@google.com \
    --cc=dakr@kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=gary@garyguo.net \
    --cc=lossin@kernel.org \
    --cc=nova-gpu@lists.linux.dev \
    --cc=ojeda@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=simona@ffwll.ch \
    /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