diff mbox

[RFC,net-next,1/4] pci: Add flag indicating device has been assigned by KVM

Message ID 20110729165446.GA6731@dumpdata.com (mailing list archive)
State New, archived
Delegated to: Bjorn Helgaas
Headers show

Commit Message

Konrad Rzeszutek Wilk July 29, 2011, 4:54 p.m. UTC
> > > > On Wed, 2011-07-27 at 15:17 -0700, Greg Rose wrote:
> > > > > Device drivers that create and destroy SR-IOV virtual functions via
> > > > > calls to pci_enable_sriov() and pci_disable_sriov can cause
> > catastrophic
> > > > > failures if they attempt to destroy VFs while they are assigned to
> > > > > guest virtual machines.  By adding a flag for use by the KVM module
> > > > > to indicate that a device is assigned a device driver can check that
> > > > > flag and avoid destroying VFs while they are assigned and avoid
> > system
> > > > > failures.
> OK, but I hope Xen can still use the dev_flag assignment bit.

Yeah, I think the attached patch would do it, but I need to double check it.
Do you have a git tree with this patchset?

Um, so you are fixing up ixgbe only - what about the cxgb4 and be driver?
Shouldn't they also get some of this treatment?



--
To unsubscribe from this list: send the line "unsubscribe linux-pci" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Kirsher, Jeffrey T July 30, 2011, 4 a.m. UTC | #1
On Fri, Jul 29, 2011 at 09:54, Konrad Rzeszutek Wilk
<konrad.wilk@oracle.com> wrote:
>> > > > On Wed, 2011-07-27 at 15:17 -0700, Greg Rose wrote:
>> > > > > Device drivers that create and destroy SR-IOV virtual functions via
>> > > > > calls to pci_enable_sriov() and pci_disable_sriov can cause
>> > catastrophic
>> > > > > failures if they attempt to destroy VFs while they are assigned to
>> > > > > guest virtual machines.  By adding a flag for use by the KVM module
>> > > > > to indicate that a device is assigned a device driver can check that
>> > > > > flag and avoid destroying VFs while they are assigned and avoid
>> > system
>> > > > > failures.
>> OK, but I hope Xen can still use the dev_flag assignment bit.
>
> Yeah, I think the attached patch would do it, but I need to double check it.
> Do you have a git tree with this patchset?

Not yet, Greg was send these patches out as a RFC to make sure this
was the correct direction to go.

>
> Um, so you are fixing up ixgbe only - what about the cxgb4 and be driver?
> Shouldn't they also get some of this treatment?
>

Yes, Greg made changes to ixgbe to give an idea of what changes would
need to be made with the suggested changes.  From the feedback Greg
received, there is definite changes needed.  When Greg gets finished
with the necessary changes to the kernel/ethtool, we will have a
better idea of what changes are needed for the drivers.
diff mbox

Patch

diff --git a/drivers/xen/xen-pciback/xenbus.c b/drivers/xen/xen-pciback/xenbus.c
index 206c4ce0..0d72e84 100644
--- a/drivers/xen/xen-pciback/xenbus.c
+++ b/drivers/xen/xen-pciback/xenbus.c
@@ -250,6 +250,7 @@  static int xen_pcibk_export_device(struct xen_pcibk_device *pdev,
 		goto out;
 
 	dev_dbg(&dev->dev, "registering for %d\n", pdev->xdev->otherend_id);
+	dev->dev_flags |= PCI_DEV_FLAGS_ASSIGNED;
 	if (xen_register_device_domain_owner(dev,
 					     pdev->xdev->otherend_id) != 0) {
 		dev_err(&dev->dev, "device has been assigned to another " \
@@ -289,6 +290,7 @@  static int xen_pcibk_remove_device(struct xen_pcibk_device *pdev,
 	}
 
 	dev_dbg(&dev->dev, "unregistering for %d\n", pdev->xdev->otherend_id);
+	dev->dev_flags &= ~PCI_DEV_FLAGS_ASSIGNED;
 	xen_unregister_device_domain_owner(dev);
 
 	xen_pcibk_release_pci_dev(pdev, dev);