From patchwork Fri Jul 29 16:54:46 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Rzeszutek Wilk X-Patchwork-Id: 107433 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 761C9B6EE8 for ; Sat, 30 Jul 2011 02:55:20 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752528Ab1G2QzO (ORCPT ); Fri, 29 Jul 2011 12:55:14 -0400 Received: from rcsinet15.oracle.com ([148.87.113.117]:21558 "EHLO rcsinet15.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752450Ab1G2QzN (ORCPT ); Fri, 29 Jul 2011 12:55:13 -0400 Received: from rtcsinet22.oracle.com (rtcsinet22.oracle.com [66.248.204.30]) by rcsinet15.oracle.com (Switch-3.4.4/Switch-3.4.4) with ESMTP id p6TGstnM001274 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 29 Jul 2011 16:54:57 GMT Received: from acsmt358.oracle.com (acsmt358.oracle.com [141.146.40.158]) by rtcsinet22.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id p6TGsraY029956 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 29 Jul 2011 16:54:54 GMT Received: from abhmt107.oracle.com (abhmt107.oracle.com [141.146.116.59]) by acsmt358.oracle.com (8.12.11.20060308/8.12.11) with ESMTP id p6TGslbG026389; Fri, 29 Jul 2011 11:54:48 -0500 Received: from phenom (/209.6.55.207) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Fri, 29 Jul 2011 09:54:47 -0700 Received: by phenom (Postfix, from userid 1000) id 7B824BC65; Fri, 29 Jul 2011 12:54:46 -0400 (EDT) Date: Fri, 29 Jul 2011 12:54:46 -0400 From: Konrad Rzeszutek Wilk To: "Rose, Gregory V" Cc: Ian Campbell , "netdev@vger.kernel.org" , "davem@davemloft.net" , "bhutchings@solarflare.com" , "Kirsher, Jeffrey T" , Jesse Barnes , "linux-pci@vger.kernel.org" Subject: Re: [RFC net-next PATCH 1/4] pci: Add flag indicating device has been assigned by KVM Message-ID: <20110729165446.GA6731@dumpdata.com> References: <20110727221406.8435.44324.stgit@gitlad.jf.intel.com> <20110727221749.8435.19000.stgit@gitlad.jf.intel.com> <1311865877.24408.144.camel@cthulhu.hellion.org.uk> <43F901BD926A4E43B106BF17856F0755019414D525@orsmsx508.amr.corp.intel.com> <1311870459.24408.151.camel@cthulhu.hellion.org.uk> <43F901BD926A4E43B106BF17856F0755019414D59C@orsmsx508.amr.corp.intel.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <43F901BD926A4E43B106BF17856F0755019414D59C@orsmsx508.amr.corp.intel.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-Source-IP: rtcsinet22.oracle.com [66.248.204.30] X-CT-RefId: str=0001.0A090206.4E32E5E2.0022,ss=1,re=0.000,fgs=0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org > > > > 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 netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html 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);