From patchwork Wed Jul 24 04:00:47 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yijing Wang X-Patchwork-Id: 261266 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 B6ED82C00B6 for ; Wed, 24 Jul 2013 14:01:11 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750707Ab3GXEBK (ORCPT ); Wed, 24 Jul 2013 00:01:10 -0400 Received: from szxga02-in.huawei.com ([119.145.14.65]:23944 "EHLO szxga02-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1749667Ab3GXEBJ (ORCPT ); Wed, 24 Jul 2013 00:01:09 -0400 Received: from 172.24.2.119 (EHLO szxeml213-edg.china.huawei.com) ([172.24.2.119]) by szxrg02-dlp.huawei.com (MOS 4.3.4-GA FastPath queued) with ESMTP id BFA46083; Wed, 24 Jul 2013 12:00:55 +0800 (CST) Received: from SZXEML461-HUB.china.huawei.com (10.82.67.204) by szxeml213-edg.china.huawei.com (172.24.2.30) with Microsoft SMTP Server (TLS) id 14.1.323.7; Wed, 24 Jul 2013 12:00:53 +0800 Received: from [127.0.0.1] (10.135.76.69) by szxeml461-hub.china.huawei.com (10.82.67.204) with Microsoft SMTP Server id 14.1.323.7; Wed, 24 Jul 2013 12:00:49 +0800 Message-ID: <51EF516F.6010102@huawei.com> Date: Wed, 24 Jul 2013 12:00:47 +0800 From: Yijing Wang User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:17.0) Gecko/20130620 Thunderbird/17.0.7 MIME-Version: 1.0 To: Yinghai Lu CC: Bjorn Helgaas , "linux-pci@vger.kernel.org" , Jiang Liu Subject: Re: [PATCH] PCI: Separate stop and remove devices in pciehp References: <1374261258-23036-1-git-send-email-yinghai@kernel.org> <1374261258-23036-2-git-send-email-yinghai@kernel.org> <20130723155645.GA18422@google.com> In-Reply-To: X-Originating-IP: [10.135.76.69] X-CFilter-Loop: Reflected Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org Hi Yinghai, The third patch make pci_stop_dev call pci_disable_sriov(dev). It looks asymmetrical, because pci_enable_sriov(dev, NR_VIRTFN) always be called by device driver. Why not work around this in device driver like ixgbe? I'm not familiar with SRIOV, so I'm just a bit puzzled. Thanks! Yijing. ------------------------------------------------------------ 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; }