From patchwork Wed Apr 25 20:31:21 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Mauro S. M. Rodrigues" X-Patchwork-Id: 904747 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=osuosl.org (client-ip=140.211.166.133; helo=hemlock.osuosl.org; envelope-from=intel-wired-lan-bounces@osuosl.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.vnet.ibm.com Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 40WX0x5HZ9z9s02 for ; Thu, 26 Apr 2018 06:31:44 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 5202489F8D; Wed, 25 Apr 2018 20:31:43 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id s6FYsV6whKCh; Wed, 25 Apr 2018 20:31:41 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by hemlock.osuosl.org (Postfix) with ESMTP id 01C2484085; Wed, 25 Apr 2018 20:31:41 +0000 (UTC) X-Original-To: intel-wired-lan@lists.osuosl.org Delivered-To: intel-wired-lan@lists.osuosl.org Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) by ash.osuosl.org (Postfix) with ESMTP id 7F1841CF0E2 for ; Wed, 25 Apr 2018 20:31:39 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 7B46988224 for ; Wed, 25 Apr 2018 20:31:39 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id VTh8pDqc7Srr for ; Wed, 25 Apr 2018 20:31:38 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by fraxinus.osuosl.org (Postfix) with ESMTPS id 43EC187FC7 for ; Wed, 25 Apr 2018 20:31:38 +0000 (UTC) Received: from pps.filterd (m0098399.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w3PKQZog145451 for ; Wed, 25 Apr 2018 16:31:37 -0400 Received: from e11.ny.us.ibm.com (e11.ny.us.ibm.com [129.33.205.201]) by mx0a-001b2d01.pphosted.com with ESMTP id 2hjv0acw53-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 25 Apr 2018 16:31:36 -0400 Received: from localhost by e11.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 25 Apr 2018 16:31:35 -0400 Received: from b01cxnp22034.gho.pok.ibm.com (9.57.198.24) by e11.ny.us.ibm.com (146.89.104.198) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Wed, 25 Apr 2018 16:31:31 -0400 Received: from b01ledav004.gho.pok.ibm.com (b01ledav004.gho.pok.ibm.com [9.57.199.109]) by b01cxnp22034.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w3PKVUxJ47906920; Wed, 25 Apr 2018 20:31:30 GMT Received: from b01ledav004.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 9E4FD112040; Wed, 25 Apr 2018 16:31:06 -0400 (EDT) Received: from localhost (unknown [9.18.239.64]) by b01ledav004.gho.pok.ibm.com (Postfix) with ESMTP id 71994112047; Wed, 25 Apr 2018 16:31:06 -0400 (EDT) From: "Mauro S. M. Rodrigues" To: jeffrey.t.kirsher@intel.com, intel-wired-lan@lists.osuosl.org Date: Wed, 25 Apr 2018 17:31:21 -0300 X-Mailer: git-send-email 2.7.4 X-TM-AS-GCONF: 00 x-cbid: 18042520-2213-0000-0000-0000029920C4 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00008920; HX=3.00000241; KW=3.00000007; PH=3.00000004; SC=3.00000257; SDB=6.01023207; UDB=6.00522324; IPR=6.00802441; MB=3.00020781; MTD=3.00000008; XFM=3.00000015; UTC=2018-04-25 20:31:33 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18042520-2214-0000-0000-000059E4AA3B Message-Id: <1524688281-12930-1-git-send-email-maurosr@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2018-04-25_06:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=2 phishscore=0 bulkscore=0 spamscore=0 clxscore=1011 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1804250186 Subject: [Intel-wired-lan] [PATCH v2] ixgbe/ixgbevf: Fix free irq process when removing device due to PCI Errors X-BeenThere: intel-wired-lan@osuosl.org X-Mailman-Version: 2.1.24 Precedence: list List-Id: Intel Wired Ethernet Linux Kernel Driver Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: abdhalee@in.ibm.com, nbannoth@in.ibm.com MIME-Version: 1.0 Errors-To: intel-wired-lan-bounces@osuosl.org Sender: "Intel-wired-lan" When a PCI error is detected ixgbe's pci error handler ixgbe_io_error_detected detaches the network device. In general the PCI error recovery mechanism may try to recover the device from the error or eventually remove it completely from the system. Since commit f7f37e7ff2b9 ("ixgbe: handle close/suspend race with netif_device_detach/present") we only follow to ixgbe_close_suspend if the device is preset, i.e. if it wasn't detached, and then the irqs are freed. That prevents to free irqs when the PCI error recovery system decides to remove the device and hitting a BUG_ON free_msi_irqs when it search for non freed irqs associated with the device being removed: BUG_ON(irq_has_action(entry->irq + i)); This is fixed allowing the ixgbe_close_suspend, and thus ixgbe_free_irq, to be called also when the PCI error recovery mechanism sets the device channel to permanent failure state. Reported-by: Naresh Bannoth Reported-by: Abdul Haleem Signed-off-by: Mauro S. M. Rodrigues --- v2: Extended the fix to ixgbevf driver. --- drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 3 ++- drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c index afadba9..d170de8 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c @@ -6679,7 +6679,8 @@ int ixgbe_close(struct net_device *netdev) ixgbe_ptp_stop(adapter); - if (netif_device_present(netdev)) + if (netif_device_present(netdev) || + adapter->pdev->error_state == pci_channel_io_perm_failure) ixgbe_close_suspend(adapter); ixgbe_fdir_filter_exit(adapter); diff --git a/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c b/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c index 3d9033f..f916dc5 100644 --- a/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c +++ b/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c @@ -3661,7 +3661,8 @@ int ixgbevf_close(struct net_device *netdev) { struct ixgbevf_adapter *adapter = netdev_priv(netdev); - if (netif_device_present(netdev)) + if (netif_device_present(netdev) || + adapter->pdev->error_state == pci_channel_io_perm_failure) ixgbevf_close_suspend(adapter); return 0;