All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Dave Airlie" <airlied@redhat.com>,
	"Lyude Paul" <lyude@redhat.com>,
	"Danilo Krummrich" <dakr@kernel.org>,
	"Alexandre Courbot" <acourbot@nvidia.com>
Cc: dri-devel@lists.freedesktop.org, nova-gpu@lists.linux.dev
Subject: Re: [PATCH v4 2/2] nova-core: only bind to GPUs when explicitly requested
Date: Thu, 03 Dec 2026 04:37:15 +0000	[thread overview]
Message-ID: <sashiko-outbox-247156@kernel.org> (raw)
In-Reply-To: <20261203-nova-nouveau-gsp-v4-2-eb3e5e111968@redhat.com>

Thank you for your contribution! Sashiko AI review found 4 potential
issues to consider:
- [Medium] nova-core: single-parameter bind_gsp override leaves drivers
  competing
- [Medium] nova-core: NOVA_CORE_BIND_GSP omits DRM_NOUVEAU dependency
- [Medium] nova-core: bool NOVA_CORE_BIND_GSP auto-enabled by
  allmodconfig/allyesconfig
- [Low] nova-core: check_bind_allowed() logs wrong advice on pre-Turing
  GPUs
--

commit f2eb3485ce9fa1c56177d400d79136d6dcbb2d41
Author: Dave Airlie <airlied@redhat.com>

nova-core: only bind to GPUs when explicitly requested

This commit adds the NOVA_CORE_BIND_GSP Kconfig option and bind_gsp module
parameter so nova-core only binds to NVIDIA GPUs when explicitly requested,
returning -ENODEV from probe() otherwise.

> diff --git a/drivers/gpu/nova-core/Kconfig b/drivers/gpu/nova-core/Kconfig
> index 2e11e46c99c76..a6d8797d245ce 100644
> --- a/drivers/gpu/nova-core/Kconfig
> +++ b/drivers/gpu/nova-core/Kconfig
> @@ -30,3 +30,24 @@ config NOVA_CORE_SELFTESTS
>  	  logs its failure and lets the probe continue.
>  
>  	  If unsure, say N.
> +
> +config NOVA_CORE_BIND_GSP
> +	bool "Make nova-core the default driver for GSP-capable GPUs"
> +	depends on NOVA_CORE
> +	default n

[Severity: Medium]
As reported by Danilo Krummrich on v2 [1], should NOVA_CORE_BIND_GSP depend
on DRM_NOUVEAU != n && NOVA_CORE != n instead of only NOVA_CORE?

When CONFIG_DRM_NOUVEAU=n, Kconfig still exposes this nouveau-vs-nova-core
switch, and bind_gsp defaults to cfg!(CONFIG_NOVA_CORE_BIND_GSP) in
nova_core.rs.  A standalone nova-core build therefore rejects every GPU
probe with -ENODEV by default even though it is the only NVIDIA driver.

Gating NOVA_CORE_BIND_GSP on both drivers and defaulting bind_gsp to
!cfg!(CONFIG_DRM_NOUVEAU) || cfg!(CONFIG_NOVA_CORE_BIND_GSP) avoids both
problems.

[Severity: Medium]
As reported by Gary Guo on v3 [2], won't allmodconfig, allyesconfig, and
automated distro config scripts that select y on new booleans force
NOVA_CORE_BIND_GSP=y despite default n?

Because this option only flips the runtime binding defaults, enabling it
automatically makes work-in-progress nova-core claim Turing and later GPUs
while nouveau rejects them with -ENODEV.  Using a Kconfig choice block
(whose default allmodconfig and allyesconfig preserve) or inverting the
boolean polarity to default y for nouveau avoids this.

[ ... ]

> +	  By default nova-core does not bind to any GPU and leaves NVIDIA
> +	  GPUs to other drivers, such as nouveau. Say Y here, or boot with
> +	  nova-core.bind_gsp=1, to make nova-core claim GSP-capable GPUs
> +	  instead. For a single boot, nouveau.bind_gsp=1 makes nouveau
> +	  claim them again.

[Severity: Medium]
Does booting with only nova-core.bind_gsp=1 or only nouveau.bind_gsp=1
actually switch drivers when both nouveau and nova-core are enabled?

Neither driver checks the other's runtime bind_gsp parameter.  With both
built-in and CONFIG_NOVA_CORE_BIND_GSP=n, passing only nova-core.bind_gsp=1
leaves nouveau_bind_gsp enabled, and drm/ links before nova-core.o so nouveau
still probes first and claims the GPU (when both are modules, they race).

Switching drivers for a single boot requires setting both parameters, e.g.
nova-core.bind_gsp=1 nouveau.bind_gsp=0.  The dev_info!() message in
check_bind_allowed() has the same omission, and the bind_gsp parameter
description inaccurately says it makes nova-core the default NVIDIA driver.

[ ... ]

> diff --git a/drivers/gpu/nova-core/nova_core.rs b/drivers/gpu/nova-core/nova_core.rs
> index 84f7778445926..0aaf4f6c07f83 100644
> --- a/drivers/gpu/nova-core/nova_core.rs
> +++ b/drivers/gpu/nova-core/nova_core.rs

[ ... ]

> +    pub(crate) fn check_bind_allowed(pdev: &pci::Device<Core<'_>>) -> Result {
> +        if crate::module_parameters::bind_gsp.value() {
> +            return Ok(());
> +        }
> +
> +        dev_info!(
> +            pdev,
> +            "Not binding to GPU; enable with CONFIG_NOVA_CORE_BIND_GSP=y or nova-core.bind_gsp=1\n"
> +        );
> +        Err(ENODEV)
> +    }

[Severity: Low]
As reported by John Hubbard on v3 [3], isn't this advice misleading on
pre-Turing GPUs?

PCI_TABLE matches all NVIDIA VGA and 3D devices, and NovaCoreDriver::probe()
calls check_bind_allowed() before identifying the chipset.  On pre-Turing
GPUs, enabling bind_gsp still fails later with -ENODEV; a shorter message
like "Not binding to GPU (bind_gsp=0)" avoids misleading users.

[1] https://lore.kernel.org/r/DN2OVF03FAL6.2EKLEYINW79YO@kernel.org
[2] https://lore.kernel.org/r/DN3IDZ94G4NN.1FUTSE7B4G1ZK@garyguo.net
[3] https://lore.kernel.org/r/95e63e66-1143-4c81-9206-68149ce00071@nvidia.com

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261203-nova-nouveau-gsp-v4-0-eb3e5e111968@redhat.com?part=2

      reply	other threads:[~2026-12-03  4:37 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-03  4:21 [PATCH v4 0/2] nova/nouveau: add configs/module options to control binding behaviour Dave Airlie via B4 Relay
2026-12-03  4:21 ` Dave Airlie
2026-12-03  4:21 ` [PATCH v4 1/2] drm/nouveau: leave GSP-capable GPUs to nova-core when requested Dave Airlie via B4 Relay
2026-12-03  4:21   ` Dave Airlie
2026-12-03  4:41   ` sashiko-bot
2026-12-03  4:21 ` [PATCH v4 2/2] nova-core: only bind to GPUs when explicitly requested Dave Airlie via B4 Relay
2026-12-03  4:21   ` Dave Airlie
2026-12-03  4:37   ` sashiko-bot [this message]

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-247156@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=acourbot@nvidia.com \
    --cc=airlied@redhat.com \
    --cc=dakr@kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=lyude@redhat.com \
    --cc=nova-gpu@lists.linux.dev \
    --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.