From patchwork Tue Jun 24 16:48:57 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Keith Busch X-Patchwork-Id: 363551 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 581101400B8 for ; Wed, 25 Jun 2014 03:05:08 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755975AbaFXQxS (ORCPT ); Tue, 24 Jun 2014 12:53:18 -0400 Received: from mga09.intel.com ([134.134.136.24]:24236 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756041AbaFXQxP (ORCPT ); Tue, 24 Jun 2014 12:53:15 -0400 Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga102.jf.intel.com with ESMTP; 24 Jun 2014 09:47:50 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.01,539,1400050800"; d="scan'208";a="562613148" Received: from dcgshare.lm.intel.com ([10.232.118.254]) by orsmga002.jf.intel.com with ESMTP; 24 Jun 2014 09:49:25 -0700 Received: by dcgshare.lm.intel.com (Postfix, from userid 1017) id 0DF47E00F2; Tue, 24 Jun 2014 10:49:24 -0600 (MDT) From: Keith Busch To: linux-pci@vger.kernel.org, linux-scsi@vger.kernel.org Cc: Keith Busch , Nagalakshmi Nandigama , Sreekanth Reddy , Bjorn Helgaas Subject: [RFC PATCH] Let device drivers disable msi on shutdown Date: Tue, 24 Jun 2014 10:48:57 -0600 Message-Id: <1403628537-16367-1-git-send-email-keith.busch@intel.com> X-Mailer: git-send-email 1.7.1 Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org I'd like to do shutdowns asynchronously so I can shutdown multiple devices in parallel, but the pci-driver disables interrupts after my driver returns from its '.shutdown', though it needs to rely on these interrupts in its asynchronously scheduled shutdown. I tracked the reason for pci disabling msi to ... | commit d52877c7b1afb8c37ebe17e2005040b79cb618b0 | Author: Yinghai Lu | Date: Wed Apr 23 14:58:09 2008 -0700 | | pci/irq: let pci_device_shutdown to call pci_msi_shutdown v2 ... because mptfusion doesn't disable msi in its shutdown path. Any reason we can't let the drivers do this instead? To provide context why I want to do this asynchronously, NVM-Express has one PCI device per controller, of which there could be dozens in a system, and each one may take many seconds (I've heard over ten in some cases) to safely shutdown. In this patch, mptfusion was compile tested only; I didn't observe any adverse affects from running the pci portion. Signed-off-by: Keith Busch Cc: Nagalakshmi Nandigama Cc: Sreekanth Reddy Cc: Bjorn Helgaas --- drivers/message/fusion/mptscsih.c | 3 +++ drivers/pci/pci-driver.c | 2 -- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/message/fusion/mptscsih.c b/drivers/message/fusion/mptscsih.c index 2a1c6f2..3186e17 100644 --- a/drivers/message/fusion/mptscsih.c +++ b/drivers/message/fusion/mptscsih.c @@ -1215,6 +1215,9 @@ mptscsih_remove(struct pci_dev *pdev) void mptscsih_shutdown(struct pci_dev *pdev) { + MPT_ADAPTER *ioc = pci_get_drvdata(pdev); + if (ioc->msi_enable) + pci_disable_msi(pdev); } #ifdef CONFIG_PM diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c index 3f8e3db..8079d98 100644 --- a/drivers/pci/pci-driver.c +++ b/drivers/pci/pci-driver.c @@ -453,8 +453,6 @@ static void pci_device_shutdown(struct device *dev) if (drv && drv->shutdown) drv->shutdown(pci_dev); - pci_msi_shutdown(pci_dev); - pci_msix_shutdown(pci_dev); #ifdef CONFIG_KEXEC /*