NVIDIA GPU driver infrastructure
 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 1/2] drm/nouveau: add option to leave GSP-capable GPUs to other drivers
Date: Thu, 19 Nov 2026 01:52:13 +0000	[thread overview]
Message-ID: <sashiko-outbox-222304@kernel.org> (raw)
In-Reply-To: <20261119-nova-nouveau-gsp-v1-1-4cde2bc41132@redhat.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [High] drm/nouveau: resource leak and stale list entry in
  nvkm_device_ctor()
--

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

drm/nouveau: add option to leave GSP-capable GPUs to other drivers

This commit adds a DRM_NOUVEAU_BIND_GSP Kconfig option and a bind_gsp
module parameter to let nouveau skip GSP-capable (Turing and later) PCI
GPUs so other drivers such as nova-core can claim them.

> diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/device/base.c b/drivers/gpu/drm/nouveau/nvkm/engine/device/base.c
> index a2ed8c4fe52a0..a027860fa8694 100644
> --- a/drivers/gpu/drm/nouveau/nvkm/engine/device/base.c
> +++ b/drivers/gpu/drm/nouveau/nvkm/engine/device/base.c
[ ... ]
> @@ -3381,6 +3381,20 @@ nvkm_device_ctor(const struct nvkm_device_func *func,
>  		goto done;
>  	}
>  
> +	/* Unless nouveau is the default NVIDIA driver, leave GSP-capable
> +	 * (Turing and later) PCI GPUs to other drivers, such as nova-core.
> +	 * Older GPUs are always bound.
> +	 *
> +	 * Reject before subdevs are constructed, as that would already load
> +	 * GSP firmware for GPUs that are not going to be used.
> +	 */
> +	if (device->func->pci && device->card_type >= TU100 && !bind_gsp) {
> +		nvdev_info(device, "leaving GSP-capable GPU to other drivers "
> +			   "(bind_gsp=0)\n");
> +		ret = -ENODEV;
> +		goto done;
> +	}
> +
>  	/* read strapping information */
>  	strap = nvkm_rd32(device, 0x101000);

[Severity: High]
Does rejecting a GPU here leak pdev, leave pci_dev enabled, and leave a
freed or stale entry on nv_devices?

Before reaching this check, nvkm_device_pci_new() calls
pci_enable_device() and allocates pdev, and nvkm_device_ctor() adds
&device->head to the global nv_devices list:

drivers/gpu/drm/nouveau/nvkm/engine/device/base.c:nvkm_device_ctor() {
    ...
	list_add_tail(&device->head, &nv_devices);
    ...
done:
	if (ret && device->pri) {
		iounmap(device->pri);
		device->pri = NULL;
	}
	mutex_unlock(&nv_devices_mutex);
	return ret;
}

When nvkm_device_ctor() returns -ENODEV, the done label only unmaps
device->pri, and nvkm_device_pci_new() and nouveau_drm_probe() return
ret immediately without unlinking device->head from nv_devices, calling
pci_disable_device(), or freeing pdev.  This leaves the PCI device's
enable_cnt elevated when handing off to another driver and causes any
later nouveau probe of the same device handle to fail with -EEXIST.
(Note that calling nvkm_device_del() directly on this failure path would
also hit an uninitialized device->intr.intr list in nvkm_intr_dtor(),
since nvkm_intr_ctor() has not run yet.)

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261119-nova-nouveau-gsp-v1-0-4cde2bc41132@redhat.com?part=1

  reply	other threads:[~2026-11-19  1:52 UTC|newest]

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

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-222304@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox