Linux PCI subsystem development
 help / color / mirror / Atom feed
From: Alex Williamson <alex.williamson@redhat.com>
To: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
Cc: "Jakub Kicinski" <kuba@kernel.org>,
	"Alexander Duyck" <alexanderduyck@fb.com>,
	"Michał Winiarski" <michal.winiarski@intel.com>,
	"Bjorn Helgaas" <bhelgaas@google.com>,
	"Christian König" <christian.koenig@amd.com>,
	linux-pci@vger.kernel.org, LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2 1/1] PCI: Fix BAR resizing when VF BARs are assigned
Date: Tue, 18 Mar 2025 09:23:52 -0600	[thread overview]
Message-ID: <20250318092352.1bf43af4.alex.williamson@redhat.com> (raw)
In-Reply-To: <20250318090157.525949f9.alex.williamson@redhat.com>

On Tue, 18 Mar 2025 09:01:57 -0600
Alex Williamson <alex.williamson@redhat.com> wrote:

> On Tue, 18 Mar 2025 13:42:57 +0200 (EET)
> Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> wrote:
> 
> > + Jakub
> > + Alexander
> > 
> > On Mon, 17 Mar 2025, Alex Williamson wrote:  
> > > On Mon, 17 Mar 2025 19:18:03 +0100
> > > Michał Winiarski <michal.winiarski@intel.com> wrote:    
> > > > On Fri, Mar 14, 2025 at 08:56:49AM -0600, Alex Williamson wrote:    
> > > > > On Fri,  7 Mar 2025 16:03:49 +0200
> > > > > Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> wrote:
> > > > >       
> > > > > > __resource_resize_store() attempts to release all resources of the
> > > > > > device before attempting the resize. The loop, however, only covers
> > > > > > standard BARs (< PCI_STD_NUM_BARS). If a device has VF BARs that are
> > > > > > assigned, pci_reassign_bridge_resources() finds the bridge window still
> > > > > > has some assigned child resources and returns -NOENT which makes
> > > > > > pci_resize_resource() to detect an error and abort the resize.
> > > > > > 
> > > > > > Change the release loop to cover all resources up to VF BARs which
> > > > > > allows the resize operation to release the bridge windows and attempt
> > > > > > to assigned them again with the different size.
> > > > > > 
> > > > > > As __resource_resize_store() checks first that no driver is bound to
> > > > > > the PCI device before resizing is allowed, SR-IOV cannot be enabled
> > > > > > during resize so it is safe to release also the IOV resources.      
> > > > > 
> > > > > Is this true?  pci-pf-stub doesn't teardown SR-IOV on release, which I
> > > > > understand is done intentionally.  Thanks,      
> > 
> > Thanks for reviewing. I'm sorry I just took Michał's word on this for 
> > granted so I didn't check it myself.
> > 
> > I could amend __resource_resize_store() to return -EBUSY if SR-IOV is 
> > there despite no driver being present  
> 
> I probably never really considered resizing BARs for an SR-IOV capable
> device when adding this support originally, but it seems valid to me
> that if we extend releasing resources to the SR-IOV BARs that we simply
> need to assert that SR-IOV is disabled and fail otherwise.  Thanks,

Also, I've never seen it, but I'm under the impression that it's
possible for pre-boot to hand-off a device with SR-IOV already enabled.
Therefore I think this would be a worthwhile addition, regardless of the
behavior of any given in-kernel driver.  Thanks,

Alex


  reply	other threads:[~2025-03-18 15:24 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-07 14:03 [PATCH v2 1/1] PCI: Fix BAR resizing when VF BARs are assigned Ilpo Järvinen
2025-03-14 14:56 ` Alex Williamson
2025-03-17 18:18   ` Michał Winiarski
2025-03-17 22:38     ` Alex Williamson
2025-03-18 11:42       ` Ilpo Järvinen
2025-03-18 15:01         ` Alex Williamson
2025-03-18 15:23           ` Alex Williamson [this message]
2025-03-18 12:21 ` Philipp Stanner

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=20250318092352.1bf43af4.alex.williamson@redhat.com \
    --to=alex.williamson@redhat.com \
    --cc=alexanderduyck@fb.com \
    --cc=bhelgaas@google.com \
    --cc=christian.koenig@amd.com \
    --cc=ilpo.jarvinen@linux.intel.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=michal.winiarski@intel.com \
    /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