From: sashiko-bot@kernel.org
To: "Simon Song" <xinmengs@nvidia.com>,
dakr@kernel.org, acourbot@nvidia.com, kvm@vger.kernel.org,
nova-gpu@lists.linux.dev, linux-pci@vger.kernel.org
Cc: "Zhi Wang" <zhiw@nvidia.com>,
alex@shazbot.org, jgg@nvidia.com, yishaih@nvidia.com,
skolothumtho@nvidia.com, kevin.tian@intel.com, airlied@gmail.com,
simona@ffwll.ch, ojeda@kernel.org, alex.gaynor@gmail.com,
boqun.feng@gmail.com, gary@garyguo.net, bjorn3_gh@protonmail.com,
lossin@kernel.org, a.hindborg@kernel.org, aliceryhl@google.com,
tmgross@umich.edu, jhubbard@nvidia.com, ecourtney@nvidia.com,
cjia@nvidia.com, smitra@nvidia.com, kjaju@nvidia.com,
alkumar@nvidia.com, ankita@nvidia.com, aniketa@nvidia.com,
kwankhede@nvidia.com, targupta@nvidia.com, zhiwang@kernel.org,
boqun@kernel.org, daniel.almeida@collabora.com,
tamird@kernel.org, work@onurozkan.dev, jgg@ziepe.ca,
bhelgaas@google.com, kwilczynski@kernel.org,
dri-devel@lists.freedesktop.org, peter@colberg.org,
"Liam R. Howlett" <liam@infradead.org>,
linux-mm@kvack.org, "Lorenzo Stoakes" <ljs@kernel.org>
Subject: Re: [PATCH v5 1/2] gpu: nova-core: publish typed SR-IOV PF APIs
Date: Sat, 05 Dec 2026 14:50:09 +0000 [thread overview]
Message-ID: <sashiko-outbox-251657@kernel.org> (raw)
In-Reply-To: <20261204144900.286240-2-xinmengs@nvidia.com>
Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [Medium] gpu: nova-core: sriov_enable() enables VFs when vGPU is
disabled
- [Low] gpu: nova-core: unnecessary pin_data and existential lifetime on
NovaCoreVfApi
--
commit 173e704bc431988bf97e2a84f11723ac19f1a271
Author: Zhi Wang <zhiw@nvidia.com>
gpu: nova-core: publish typed SR-IOV PF APIs
This commit registers NovaCoreVfApi as typed SR-IOV PF data during probe,
implements the sriov_enable() and sriov_disable() callbacks, and exposes a
VF-side handle and instance guard for managing vGPU instances.
> diff --git a/drivers/gpu/nova-core/driver.rs b/drivers/gpu/nova-core/driver.rs
> index bea1b1b0844c9..34c35b5e648fc 100644
> --- a/drivers/gpu/nova-core/driver.rs
> +++ b/drivers/gpu/nova-core/driver.rs
[ ... ]
> @@ -154,4 +169,21 @@ fn probe<'bound>(
> },
> })
> }
> +
> + fn sriov_enable<'a>(
> + _dev: &'a pci::Device<Core<'_>>,
> + _this: Pin<&Self::Data<'a>>,
> + token: pci::SriovEnable<'a>,
> + ) -> Result<pci::SriovEnabled<'a>> {
> + token.enable_all()
> + }
[Severity: Medium]
Can sriov_enable() enable hardware VFs on a PF that booted with vGPU
disabled?
probe() unconditionally installs _vf_registration even when
VgpuState::Disabled leaves gpu.vgpu_manager() as None (for example on
non-vGPU architectures or when FSP disables vGPU), so SriovEnable::enable()
sees a non-null registration pointer and calls pci_enable_sriov().
Writing to sriov_numvfs then creates PCIe VFs on a GPU whose GSP firmware
booted in bare-metal mode without SR-IOV mode or WPR2 VF partitions, leaving
unconfigured VFs that NovaCoreVfApi::handle() rejects with ENODEV.
Should sriov_enable() check _this.gpu.vgpu_manager().is_some() and return
Err(ENODEV) when vGPU is disabled?
[ ... ]
> diff --git a/drivers/gpu/nova-core/vgpu/vgpu_api.rs b/drivers/gpu/nova-core/vgpu/vgpu_api.rs
> index b263e96098a80..1064e461cd269 100644
> --- a/drivers/gpu/nova-core/vgpu/vgpu_api.rs
> +++ b/drivers/gpu/nova-core/vgpu/vgpu_api.rs
[ ... ]
> @@ -51,27 +52,38 @@ fn from(vgpu_properties: &VgpuProperties) -> Self {
> }
>
> /// PF-owned operations available while a VF driver is bound.
> -pub struct NovaCoreVfApi<'gpu> {
> +#[pin_data]
> +pub struct NovaCoreVfApi<'gpu>
> +where
> + // The GPU resources are invariant in their lifetime, which outlives this API borrow.
> + exists<'gpu_resources>: 'gpu,
> +{
> pdev: &'gpu pci::Device<device::Bound>,
> - cmdq: &'gpu Cmdq<'gpu>,
> - vgpu: Option<&'gpu VgpuManager<'gpu>>,
> + #[uses('gpu_resources: invariant)]
> + cmdq: &'gpu Cmdq<'gpu_resources>,
> + #[uses('gpu_resources: invariant)]
> + vgpu: Option<&'gpu VgpuManager<'gpu_resources>>,
> total_vfs: Option<NonZero<u16>>,
> }
[Severity: Low]
Does NovaCoreVfApi need #[pin_data] and exists<'gpu_resources>: 'gpu?
Both Cmdq and VgpuManager already hide their internal invariant lifetimes
behind their own existential clauses so they remain covariant, and Gpu itself
is covariant as relied on by NovaCoreApi::new(). The comment claiming the
borrowed GPU resources are invariant is therefore inaccurate.
Because any T implements PinInit<T, Infallible>, NovaCoreVfApi can remain a
plain struct returned directly from NovaCoreVfApi::new(), avoiding the
with_vgpu() and with_project_ref() closures and letting open_instance() take
&self like close_instance(), reset_instance(), and is_available().
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261204144900.286240-1-xinmengs@nvidia.com?part=1
next prev parent reply other threads:[~2026-12-05 14:50 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-04 14:48 [PATCH v5 0/2] vfio/nova-vgpu: add the NVIDIA VFIO variant driver Simon Song
2026-12-04 14:48 ` [PATCH v5 1/2] gpu: nova-core: publish typed SR-IOV PF APIs Simon Song
2026-12-05 14:50 ` sashiko-bot [this message]
2026-12-04 14:48 ` [PATCH v5 2/2] vfio/nova-vgpu: add the Rust VFIO variant driver Simon Song
2026-12-04 23:12 ` Alex Williamson
2026-12-04 23:28 ` Danilo Krummrich
2026-12-04 23:37 ` Alex Williamson
2026-12-05 0:09 ` Danilo Krummrich
2026-12-05 14:50 ` sashiko-bot
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-251657@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=a.hindborg@kernel.org \
--cc=acourbot@nvidia.com \
--cc=airlied@gmail.com \
--cc=alex.gaynor@gmail.com \
--cc=alex@shazbot.org \
--cc=aliceryhl@google.com \
--cc=alkumar@nvidia.com \
--cc=aniketa@nvidia.com \
--cc=ankita@nvidia.com \
--cc=bhelgaas@google.com \
--cc=bjorn3_gh@protonmail.com \
--cc=boqun.feng@gmail.com \
--cc=boqun@kernel.org \
--cc=cjia@nvidia.com \
--cc=dakr@kernel.org \
--cc=daniel.almeida@collabora.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=ecourtney@nvidia.com \
--cc=gary@garyguo.net \
--cc=jgg@nvidia.com \
--cc=jgg@ziepe.ca \
--cc=jhubbard@nvidia.com \
--cc=kevin.tian@intel.com \
--cc=kjaju@nvidia.com \
--cc=kvm@vger.kernel.org \
--cc=kwankhede@nvidia.com \
--cc=kwilczynski@kernel.org \
--cc=liam@infradead.org \
--cc=linux-mm@kvack.org \
--cc=linux-pci@vger.kernel.org \
--cc=ljs@kernel.org \
--cc=lossin@kernel.org \
--cc=nova-gpu@lists.linux.dev \
--cc=ojeda@kernel.org \
--cc=peter@colberg.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=simona@ffwll.ch \
--cc=skolothumtho@nvidia.com \
--cc=smitra@nvidia.com \
--cc=tamird@kernel.org \
--cc=targupta@nvidia.com \
--cc=tmgross@umich.edu \
--cc=work@onurozkan.dev \
--cc=xinmengs@nvidia.com \
--cc=yishaih@nvidia.com \
--cc=zhiw@nvidia.com \
--cc=zhiwang@kernel.org \
/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.