From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.subspace.kernel.org (Postfix) with ESMTP id EBF1C606A322 for ; Sat, 5 Dec 2026 14:50:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=fyRaCfnH Received: by kanga.kvack.org (Postfix) id E2C366B00EF; Sat, 5 Dec 2026 09:50:15 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id DDD0D6B05B1; Sat, 5 Dec 2026 09:50:15 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CCED86B05B2; Sat, 5 Dec 2026 09:50:15 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 589AA6B00EF for ; Sat, 5 Dec 2026 09:50:15 -0500 (EST) Received: from smtpin18.hostedemail.com (lb01a-stub [10.200.18.249]) by unirelay09.hostedemail.com (Postfix) with ESMTP id CA60E8063E for ; Sat, 5 Dec 2026 14:50:14 +0000 (UTC) X-FDA: 85510214748.18.2126765 Received: from sea.source.kernel.org (sea.source.kernel.org [172.234.252.31]) by imf26.hostedemail.com (Postfix) with ESMTP id 09C79140006 for ; Sat, 5 Dec 2026 14:50:12 +0000 (UTC) Authentication-Results: imf26.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20260515 header.b=fyRaCfnH; dmarc=pass (policy=quarantine) header.from=kernel.org; spf=pass (imf26.hostedemail.com: domain of sashiko-bot@kernel.org designates 172.234.252.31 as permitted sender) smtp.mailfrom=sashiko-bot@kernel.org ARC-Seal: i=1; a=rsa-sha256; d=hostedemail.com; s=arc-20220608; cv=none; t=1796482213; b=emzdyKfTZWokGUQJvXnC0jY7QUo/VXl7naiVCjjg/Q6l4CehuSFc3K/6/V1i25jLCXOMhW S6MkYVQWJnQHCeYgnH7X0PLRiGf590p78qXQmaNylUEJvCeuGxRUNCFiVyghEmIYdrScD3 1bMLYkYSx8rL4/ncoprYPApho161r68= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1796482213; h=from:from:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=OzFDBWeBQ967fPEIGVFgqBvENwigXB9MhhEgk6dQjJ0=; b=1bnfxrwJsF4LFTNvMNn4wCkEUOYJnl2N91QyKIyVPY3cs3qaBNueVPcWOjM2yiiGChJZdA wMOxwERQkPfBtnHdQRR0+PeVKDldUGZ6MQnC2taLKO7UKZIdHEwQmSEpjGzee+3u4tf3E/ rdb9MnEOdleOLxSFejNYDS3ICPpa3o0= ARC-Authentication-Results: i=1; imf26.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20260515 header.b=fyRaCfnH; dmarc=pass (policy=quarantine) header.from=kernel.org; spf=pass (imf26.hostedemail.com: domain of sashiko-bot@kernel.org designates 172.234.252.31 as permitted sender) smtp.mailfrom=sashiko-bot@kernel.org Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by sea.source.kernel.org (Postfix) with ESMTP id 5415E4440A; Sat, 5 Dec 2026 14:50:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AC31E1F0092B; Sat, 5 Dec 2026 14:50:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796482211; bh=OzFDBWeBQ967fPEIGVFgqBvENwigXB9MhhEgk6dQjJ0=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=fyRaCfnHvEnM1Tu055blO0yN6e/dqUmuCjYPReZLG+6FafNBqYU75w/8dh0rr/urm myEXauAGAIJBk2vWwTYowOLRaHzVj8/T+jdF+HWDIjaHR6V6Z75juOvqFeXazriS/8 SZddqcjmUqKzvaBwq/nvvock1Dqoj0fnyh1Sfrs8M6C+cEurkIJ6/16ORSvqkPmu4l 5wZWZcRxatfb8OJZgWtkGXq2zqvTW6OqqGdptuPJdu5rOCfi5Lv3XZmnSmk06to6Ek fKIYx4rRHkZZq38PdsSDfviyYChKNH2b0bsDTV3LhPxRSz4uHlwBYGT11KMqmH8Tn6 vOUY98YWH2kGw== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH v5 1/2] gpu: nova-core: publish typed SR-IOV PF APIs Reply-To: sashiko-reviews@lists.linux.dev To: "Simon Song" , dakr@kernel.org, acourbot@nvidia.com, kvm@vger.kernel.org, nova-gpu@lists.linux.dev, linux-pci@vger.kernel.org Cc: "Zhi Wang" , 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" , linux-mm@kvack.org, "Lorenzo Stoakes" In-Reply-To: <20261204144900.286240-2-xinmengs@nvidia.com> References: <20261204144900.286240-1-xinmengs@nvidia.com> <20261204144900.286240-2-xinmengs@nvidia.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Sat, 05 Dec 2026 14:50:09 +0000 X-Rspamd-Server: rspam11 X-Rspam-User: X-Stat-Signature: a3xqqoyan6eeaa9ozirjw419ptsufkfz X-Spam-Status: No, score=-11.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=4.0.1 X-Rspamd-Queue-Id: 09C79140006 X-HE-Tag: 1796482212-777716 X-HE-Meta: U2FsdGVkX18Bv6C/eka8xB5zn4RMi8S3d2NDefZUqBq1gOktjihjiAUyBSEKrUTpPgWNYCHF9gyKMjASGM5F1S7gmWZHQWC7ClaA2XBfN8xDTvvkqRR0P2RSSlbvugE8n/NdQvlAu+6enpsHtH/ttN7wRH6cDuhMW7v3tQR0bQMF3B4ZodJCfPTM5Ob6wnSHTet95M9gnxPdkNlT3QY4gYyTtct68hdHwifSk2ZnnbGWoiB+uili8GXXwmbqoZd0ZtIEuHBh7VcvMMs0pxDsdA1cCP7p+K/cUUFywi6P/7wF6a/srOmPGCawivirs4n4oSG8eg8mkryaZbFTwbd1MqI8zfVsKODP/YSgdlO2ONTYUwsm9wy7Ctk6H/mLP3EtwWDb24ZqxY1hiohFGOgAj+zHIigevpO6qDkH4OuQ+lM2bJAYZy6Z927eXsNxnPfW/GvPzwF1ydQxe+Iz80OBzuTIG8ZIVVyIa6TFUCUV4JVx6MQ3R1bVxBz8zlU9tDc1Axe9X6BZYBqDOc2gSHR7wJgKCyob4nCXpnGn4l5VyYLgbT8/PGzWn9pv8HJjVbL7vNKVpc49gVmTPI/RLaUssO+0+TvleQgB2UVqEl+J/AsDb7PyaSbQ+4FTgtgYPRbTwIu54Prqg0swZN0aNNY2ur++QrEeL1/P57xnELewa4NlKWdrtiLlSyqbQNwtalzrYy2glJOszD4Qr6finzYfQEM2W4FqAod+eFmZgxUE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pRPvoTm8sG+2ZSPkUDcbpBHy/wVfsqi34StxblNGEvpyB1vOoUjNzDcJhj7K4GWV+mJf5ib3jpIs8SPS4L0xYcCMa/OesXZRQ= Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 X-Archived-By: 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 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/driv= er.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>, > + _this: Pin<&Self::Data<'a>>, > + token: pci::SriovEnable<'a>, > + ) -> Result> { > + 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-co= re/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 { > } > =20 > /// 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, > - 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>, > } [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 itse= lf 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, 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(). --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261204144900.2862= 40-1-xinmengs@nvidia.com?part=3D1