All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alex Williamson <alex.williamson@redhat.com>
To: Christoph Hellwig <hch@infradead.org>
Cc: Keith Busch <keith.busch@intel.com>,
	Bjorn Helgaas <bhelgaas@google.com>,
	linux-pci@vger.kernel.org, Jens Axboe <axboe@fb.com>,
	linux-nvme@lists.infradead.org
Subject: Re: [PATCH 1/2] pci: Error disabling SR-IOV if in VFs assigned
Date: Mon, 23 May 2016 09:07:11 -0600	[thread overview]
Message-ID: <20160523090711.12fa34f9@ul30vt.home> (raw)
In-Reply-To: <20160523105532.GB26331@infradead.org>

On Mon, 23 May 2016 03:55:32 -0700
Christoph Hellwig <hch@infradead.org> wrote:

> On Tue, May 17, 2016 at 04:08:32PM -0600, Alex Williamson wrote:
> > On Tue, 17 May 2016 15:39:58 -0600
> > Keith Busch <keith.busch@intel.com> wrote:
> >   
> > > Every sriov capable driver has to check if any guest is using a virtual
> > > function prior to disabling, so let's make it common code.  
> > 
> > This is not true, the PCI_DEV_FLAGS_ASSIGNED flag is inherently racy,
> > so checking it is really only a courtesy for broken drivers that
> > still make use of it.  I don't object to adding it here, though I
> > wish the entire interface was deprecated, but it's only a minimal amount
> > of insurance as a VF might get assigned immediately following your added
> > test or might not participate in the assigned device flagging at all.  
> 
> Si should we just kill it? As far as I can tell it's only used in these
> kinds of boilerplate checks.

Long term, yes, but perhaps KVM legacy PCI device assignment needs to
be not only deprecated, but removed first.

> > I
> > believe the better way to handle this is with proper host drivers for
> > assigned devices that manage the driver .remove callback properly while
> > devices are in use.  The only reason to handle assigned devices
> > specially in this case is when they don't have proper host drivers
> > managing them, which is a problem that we've fixed.  Thanks,  
> 
> We always use pci-stub now, don't we?

pci-stub's only purpose is to prevent other drivers from binding to a
device, such as while it's in used by legacy KVM device assignment.
pci-stub has no visibility whether a device is in use or not, and will
happily unbind the device at any point in time.  Thus legacy KVM device
assignment with pci-stub makes use of this horrible flag in a vain
attempt to prevent devices from disappearing, littering every possible
remove path with these sorts of checks when really the driver holding
the assigned device should block or maybe allow an error return from
the .remove callback.  Xen pci-back also sets this flag, but I would
hope there's a sensible solution available there and they just adopted
use of this flag without really questioning that it works or makes
sense. Thanks,

Alex

WARNING: multiple messages have this Message-ID (diff)
From: alex.williamson@redhat.com (Alex Williamson)
Subject: [PATCH 1/2] pci: Error disabling SR-IOV if in VFs assigned
Date: Mon, 23 May 2016 09:07:11 -0600	[thread overview]
Message-ID: <20160523090711.12fa34f9@ul30vt.home> (raw)
In-Reply-To: <20160523105532.GB26331@infradead.org>

On Mon, 23 May 2016 03:55:32 -0700
Christoph Hellwig <hch@infradead.org> wrote:

> On Tue, May 17, 2016@04:08:32PM -0600, Alex Williamson wrote:
> > On Tue, 17 May 2016 15:39:58 -0600
> > Keith Busch <keith.busch@intel.com> wrote:
> >   
> > > Every sriov capable driver has to check if any guest is using a virtual
> > > function prior to disabling, so let's make it common code.  
> > 
> > This is not true, the PCI_DEV_FLAGS_ASSIGNED flag is inherently racy,
> > so checking it is really only a courtesy for broken drivers that
> > still make use of it.  I don't object to adding it here, though I
> > wish the entire interface was deprecated, but it's only a minimal amount
> > of insurance as a VF might get assigned immediately following your added
> > test or might not participate in the assigned device flagging at all.  
> 
> Si should we just kill it? As far as I can tell it's only used in these
> kinds of boilerplate checks.

Long term, yes, but perhaps KVM legacy PCI device assignment needs to
be not only deprecated, but removed first.

> > I
> > believe the better way to handle this is with proper host drivers for
> > assigned devices that manage the driver .remove callback properly while
> > devices are in use.  The only reason to handle assigned devices
> > specially in this case is when they don't have proper host drivers
> > managing them, which is a problem that we've fixed.  Thanks,  
> 
> We always use pci-stub now, don't we?

pci-stub's only purpose is to prevent other drivers from binding to a
device, such as while it's in used by legacy KVM device assignment.
pci-stub has no visibility whether a device is in use or not, and will
happily unbind the device at any point in time.  Thus legacy KVM device
assignment with pci-stub makes use of this horrible flag in a vain
attempt to prevent devices from disappearing, littering every possible
remove path with these sorts of checks when really the driver holding
the assigned device should block or maybe allow an error return from
the .remove callback.  Xen pci-back also sets this flag, but I would
hope there's a sensible solution available there and they just adopted
use of this flag without really questioning that it works or makes
sense. Thanks,

Alex

  reply	other threads:[~2016-05-23 15:07 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-17 21:39 [PATCH 1/2] pci: Error disabling SR-IOV if in VFs assigned Keith Busch
2016-05-17 21:39 ` Keith Busch
2016-05-17 21:39 ` [PATCH 2/2] nvme/pci: Enable SR-IOV capabilities Keith Busch
2016-05-17 21:39   ` Keith Busch
2016-05-23 10:52   ` Christoph Hellwig
2016-05-23 10:52     ` Christoph Hellwig
2016-05-23 17:06   ` Bjorn Helgaas
2016-05-23 17:06     ` Bjorn Helgaas
2016-05-23 17:09     ` Christoph Hellwig
2016-05-23 17:09       ` Christoph Hellwig
2016-05-23 17:21     ` Keith Busch
2016-05-23 17:21       ` Keith Busch
2016-05-23 21:51       ` Bjorn Helgaas
2016-05-23 21:51         ` Bjorn Helgaas
2016-05-17 22:08 ` [PATCH 1/2] pci: Error disabling SR-IOV if in VFs assigned Alex Williamson
2016-05-17 22:08   ` Alex Williamson
2016-05-23 10:55   ` Christoph Hellwig
2016-05-23 10:55     ` Christoph Hellwig
2016-05-23 15:07     ` Alex Williamson [this message]
2016-05-23 15:07       ` Alex Williamson
2016-05-23 15:10       ` Christoph Hellwig
2016-05-23 15:10         ` Christoph Hellwig
2016-06-13 21:14 ` Bjorn Helgaas
2016-06-13 21:14   ` Bjorn Helgaas
2016-06-13 21:28   ` Keith Busch
2016-06-13 21:28     ` Keith Busch
2016-06-13 21:57     ` Keith Busch
2016-06-13 21:57       ` Keith Busch
2016-06-13 22:26       ` Bjorn Helgaas
2016-06-13 22:26         ` Bjorn Helgaas
2016-06-13 22:35         ` Keith Busch
2016-06-13 22:35           ` Keith Busch
2016-06-15 10:26           ` Christoph Hellwig
2016-06-15 10:26             ` Christoph Hellwig
2016-06-15 15:38             ` Bjorn Helgaas
2016-06-15 15:38               ` Bjorn Helgaas

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=20160523090711.12fa34f9@ul30vt.home \
    --to=alex.williamson@redhat.com \
    --cc=axboe@fb.com \
    --cc=bhelgaas@google.com \
    --cc=hch@infradead.org \
    --cc=keith.busch@intel.com \
    --cc=linux-nvme@lists.infradead.org \
    --cc=linux-pci@vger.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.