From patchwork Sat Jul 27 15:11:07 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yinghai Lu X-Patchwork-Id: 262461 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 80E602C0111 for ; Sun, 28 Jul 2013 01:11:34 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752014Ab3G0PLd (ORCPT ); Sat, 27 Jul 2013 11:11:33 -0400 Received: from userp1040.oracle.com ([156.151.31.81]:24666 "EHLO userp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752049Ab3G0PLd (ORCPT ); Sat, 27 Jul 2013 11:11:33 -0400 Received: from acsinet21.oracle.com (acsinet21.oracle.com [141.146.126.237]) by userp1040.oracle.com (Sentrion-MTA-4.3.1/Sentrion-MTA-4.3.1) with ESMTP id r6RFBQE1030393 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Sat, 27 Jul 2013 15:11:27 GMT Received: from userz7022.oracle.com (userz7022.oracle.com [156.151.31.86]) by acsinet21.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id r6RFBOfx020239 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sat, 27 Jul 2013 15:11:25 GMT Received: from abhmt116.oracle.com (abhmt116.oracle.com [141.146.116.68]) by userz7022.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id r6RFBOMr001887; Sat, 27 Jul 2013 15:11:24 GMT Received: from linux-siqj.site (/10.159.69.59) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Sat, 27 Jul 2013 08:11:23 -0700 From: Yinghai Lu To: Bjorn Helgaas Cc: linux-pci@vger.kernel.org, Yinghai Lu , Jiang Liu , Alexander Duyck , Donald Dutile , Greg Rose Subject: [PATCH v2 3/3] PCI: Stop sriov after stop PF if PF's driver skip that Date: Sat, 27 Jul 2013 08:11:07 -0700 Message-Id: <1374937868-24437-2-git-send-email-yinghai@kernel.org> X-Mailer: git-send-email 1.8.1.4 In-Reply-To: <1374937868-24437-1-git-send-email-yinghai@kernel.org> References: <1374937868-24437-1-git-send-email-yinghai@kernel.org> X-Source-IP: acsinet21.oracle.com [141.146.126.237] Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org After commit dc087f2f6a2925e81831f3016b9cbb6e470e7423 (PCI: Simplify IOV implementation and fix reference count races) VF need to be removed via virtfn_remove to make sure ref to PF is put back. Some driver (like ixgbe) does not call pci_disable_sriov() if sriov is enabled via /sys/.../sriov_numvfs setting. ixgbe does allow driver for PF get detached, but still have VFs around. But how about PF get removed via /sys or pciehp finally? During hot-remove, VF will still hold one ref to PF and it prevent PF to be removed. That make the next hot-add fails, as old PF dev struct is still around. We need to add pci_disable_sriov() calling during stop PF . Need this one for v3.11 -v2: Accoring to Bjorn, move that calling to pci_stop_dev. Signed-off-by: Yinghai Lu Cc: Jiang Liu Cc: Alexander Duyck Cc: Donald Dutile Cc: Greg Rose --- drivers/pci/remove.c | 2 ++ 1 file changed, 2 insertions(+) -- 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 Index: linux-2.6/drivers/pci/remove.c =================================================================== --- linux-2.6.orig/drivers/pci/remove.c +++ linux-2.6/drivers/pci/remove.c @@ -25,6 +25,8 @@ static void pci_stop_dev(struct pci_dev pci_proc_detach_device(dev); pci_remove_sysfs_dev_files(dev); device_del(&dev->dev); + /* remove VF, if PF driver skip that */ + pci_disable_sriov(dev); dev->is_added = 0; }