mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Alex Williamson <alex@shazbot.org>
To: Simon Song <xinmengs@nvidia.com>
Cc: dakr@kernel.org, acourbot@nvidia.com, kvm@vger.kernel.org,
	rust-for-linux@vger.kernel.org, nova-gpu@lists.linux.dev,
	linux-pci@vger.kernel.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,
	linux-kernel@vger.kernel.org, zhiwang@kernel.org,
	zhiw@nvidia.com, 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,
	alex@shazbot.org
Subject: Re: [PATCH v3 9/9] vfio/nova-vgpu: add the Rust VFIO variant driver
Date: Fri, 27 Nov 2026 15:04:52 -0700	[thread overview]
Message-ID: <20261127150452.03a1c163@shazbot.org> (raw)
In-Reply-To: <ad773f07-bf03-4042-b79b-f82cc2d64579@nvidia.com>

On Fri, 27 Nov 2026 16:35:10 -0500
Simon Song <xinmengs@nvidia.com> wrote:

> On 11/26/2026 1:08 AM, Alex Williamson wrote:
> > On Wed, 25 Nov 2026 21:45:13 -0500
> > Simon Song <xinmengs@nvidia.com> wrote:
> >   
> >> On 11/24/2026 7:19 PM, Alex Williamson wrote:
> >>>> +
> >>>> +    fn reset_prepare(rd: &NovaVgpuRegData<'_>) {
> >>>> +        // PCI holds the device lock, and VFIO may hold its memory lock. Open and
> >>>> +        // close release this mutex before entering the VFIO core.
> >>>> +        let mut state = rd.state.lock();
> >>>> +        state.resetting = true;
> >>>> +        if state.active {
> >>>> +            if let Some(vgpu) = &rd.vgpu {
> >>>> +                if let Err(error) = vgpu.api.reset(vgpu.gfid) {
> >>>> +                    state.reset_error.get_or_insert(error);
> >>>> +                }
> >>>> +            }
> >>>> +        }
> >>>> +    }    
> >>>
> >>> This seems very wrong, why are we calling the PF driver reset in
> >>> reset_prepare()?  Isn't there still an FLR happening between prepare
> >>> and done?  Does it do anything?
> >>>     
> >> It will not reset the PF, vgpu.api.reset will reset this vgpu instance behind this VF,
> >> the PF driver would ask firmware to reset the instance and scrub its memory, then FLR
> >> follows  
> > 
> > PF reset is not the question.  We're calling into the PF driver to reset
> > the VF, but we should not be doing that from reset_prepare().  This
> > also still doesn't explain what the FLR that follows the PF initiated
> > VF reset actually does.  Why can't we just use FLR?  Do we need a
> > device specific reset quirk?
> >   
> FLR resets the VF itself, and firmware stops VF channels and reset registers,
> but doesn't reset vGPU state inside the firmware, and only PF driver can ask firmware to do that
> 
> I agree it doesn't belong in reset_prepare, in next respin, I moved it to reset_done(), so it runs
> after FLR

Both seem like an abuse of the setup/cleanup wrappers.  Is this a gap
in FLR support?  If so, this is why we have device specific reset
support in PCI-core.  Depending on the PF driver is going to be a
challenge though.  When and where specifically do we need this firmware
state reset?  Isn't the firmware already involved in the FLR?  Thanks,

Alex

  reply	other threads:[~2026-11-27 22:05 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-19 21:50 [PATCH v3 0/9] Rust VFIO PCI support and NVIDIA vGPU driver Simon Song
2026-11-19 21:50 ` [PATCH v3 1/9] rust: pci: add VFIO override device IDs Simon Song
2026-11-19 21:50 ` [PATCH v3 2/9] rust: pci: expose the VF index within its PF Simon Song
2026-11-19 21:50 ` [PATCH v3 3/9] rust: pci: allow drivers to manage DMA ownership Simon Song
2026-11-19 21:50 ` [PATCH v3 4/9] rust: pci: add reset callbacks Simon Song
2026-11-19 21:50 ` [PATCH v3 5/9] rust: pci: add an error_detected callback Simon Song
2026-11-19 21:50 ` [PATCH v3 6/9] rust: vfio: add common VFIO device handling Simon Song
2026-11-25 17:57   ` Danilo Krummrich
2026-11-26 15:45     ` Simon Song
2026-11-19 21:50 ` [PATCH v3 7/9] rust: vfio: add PCI variant driver abstractions Simon Song
2026-11-25 23:51   ` Danilo Krummrich
2026-11-26 15:01     ` Simon Song
2026-11-26 23:12       ` Danilo Krummrich
2026-11-26 15:15     ` Alice Ryhl
2026-11-19 21:50 ` [PATCH v3 8/9] gpu: nova-core: publish typed SR-IOV PF APIs Simon Song
2026-11-19 21:50 ` [PATCH v3 9/9] vfio/nova-vgpu: add the Rust VFIO variant driver Simon Song
2026-11-25  3:19   ` Alex Williamson
2026-11-26  2:45     ` Simon Song
2026-11-26  6:08       ` Alex Williamson
2026-11-27 21:35         ` Simon Song
2026-11-27 22:04           ` Alex Williamson [this message]
2026-11-24 22:21 ` (subset) [PATCH v3 0/9] Rust VFIO PCI support and NVIDIA vGPU driver 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=20261127150452.03a1c163@shazbot.org \
    --to=alex@shazbot.org \
    --cc=a.hindborg@kernel.org \
    --cc=acourbot@nvidia.com \
    --cc=airlied@gmail.com \
    --cc=alex.gaynor@gmail.com \
    --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=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=lossin@kernel.org \
    --cc=nova-gpu@lists.linux.dev \
    --cc=ojeda@kernel.org \
    --cc=peter@colberg.org \
    --cc=rust-for-linux@vger.kernel.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®