From patchwork Fri Feb 14 22:57:57 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Brown, Aaron F" X-Patchwork-Id: 320584 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 1BC3F2C00A0 for ; Sat, 15 Feb 2014 10:02:06 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753189AbaBNXBW (ORCPT ); Fri, 14 Feb 2014 18:01:22 -0500 Received: from mga11.intel.com ([192.55.52.93]:61878 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753173AbaBNXBU (ORCPT ); Fri, 14 Feb 2014 18:01:20 -0500 Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga102.fm.intel.com with ESMTP; 14 Feb 2014 15:01:19 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.95,847,1384329600"; d="scan'208";a="481883104" Received: from s252.jf.intel.com ([10.23.155.219]) by fmsmga002.fm.intel.com with ESMTP; 14 Feb 2014 15:00:32 -0800 From: Aaron Brown To: davem@davemloft.net Cc: Mitch Williams , netdev@vger.kernel.org, gospo@redhat.com, sassmann@redhat.com, Jesse Brandeburg , Aaron Brown Subject: [net-next 03/14] i40evf: fix multiple crashes on remove Date: Fri, 14 Feb 2014 14:57:57 -0800 Message-Id: <1392418688-23895-4-git-send-email-aaron.f.brown@intel.com> X-Mailer: git-send-email 1.8.5.GIT In-Reply-To: <1392418688-23895-1-git-send-email-aaron.f.brown@intel.com> References: <1392418688-23895-1-git-send-email-aaron.f.brown@intel.com> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Mitch Williams Depending upon the state of the driver, there are several potential pitfalls on remove. Kill the watchdog task so rmmod doesn't hang. Check the adapter->msix_entries field, not the num_msix_vectors field, which is never cleared. Change-ID: I0546048477f09fc19e481bd37efa30daae4faa88 Signed-off-by: Mitch Williams Signed-off-by: Jesse Brandeburg Tested-by: Sibai Li Signed-off-by: Aaron Brown --- drivers/net/ethernet/intel/i40evf/i40evf_main.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/drivers/net/ethernet/intel/i40evf/i40evf_main.c b/drivers/net/ethernet/intel/i40evf/i40evf_main.c index 75a2c6f..e0eb27d 100644 --- a/drivers/net/ethernet/intel/i40evf/i40evf_main.c +++ b/drivers/net/ethernet/intel/i40evf/i40evf_main.c @@ -215,6 +215,9 @@ static void i40evf_irq_disable(struct i40evf_adapter *adapter) int i; struct i40e_hw *hw = &adapter->hw; + if (!adapter->msix_entries) + return; + for (i = 1; i < adapter->num_msix_vectors; i++) { wr32(hw, I40E_VFINT_DYN_CTLN1(i - 1), 0); synchronize_irq(adapter->msix_entries[i].vector); @@ -2372,17 +2375,15 @@ static void i40evf_remove(struct pci_dev *pdev) } adapter->state = __I40EVF_REMOVE; - if (adapter->num_msix_vectors) { + if (adapter->msix_entries) { i40evf_misc_irq_disable(adapter); - del_timer_sync(&adapter->watchdog_timer); - - flush_scheduled_work(); - i40evf_free_misc_irq(adapter); - i40evf_reset_interrupt_capability(adapter); } + del_timer_sync(&adapter->watchdog_timer); + flush_scheduled_work(); + if (hw->aq.asq.count) i40evf_shutdown_adminq(hw);