linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Keith Busch <keith.busch@intel.com>
To: linux-pci@vger.kernel.org, linux-scsi@vger.kernel.org
Cc: Keith Busch <keith.busch@intel.com>,
	Nagalakshmi Nandigama <Nagalakshmi.Nandigama@lsi.com>,
	Sreekanth Reddy <Sreekanth.Reddy@lsi.com>,
	Bjorn Helgaas <bhelgaas@google.com>
Subject: [RFC PATCH] Let device drivers disable msi on shutdown
Date: Tue, 24 Jun 2014 10:48:57 -0600	[thread overview]
Message-ID: <1403628537-16367-1-git-send-email-keith.busch@intel.com> (raw)

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 <yhlu.kernel.send@gmail.com>
| 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 <keith.busch@intel.com>
Cc: Nagalakshmi Nandigama <Nagalakshmi.Nandigama@lsi.com>
Cc: Sreekanth Reddy <Sreekanth.Reddy@lsi.com>
Cc: Bjorn Helgaas <bhelgaas@google.com>
---
 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
 	/*
-- 
1.7.10.4


             reply	other threads:[~2014-06-24 16:53 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-24 16:48 Keith Busch [this message]
2014-06-24 21:21 ` [RFC PATCH] Let device drivers disable msi on shutdown Elliott, Robert (Server Storage)
2014-06-24 22:25   ` Keith Busch
2014-07-10 18:38 ` Bjorn Helgaas
2014-07-10 18:53   ` Keith Busch
2014-07-10 19:53     ` Bjorn Helgaas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1403628537-16367-1-git-send-email-keith.busch@intel.com \
    --to=keith.busch@intel.com \
    --cc=Nagalakshmi.Nandigama@lsi.com \
    --cc=Sreekanth.Reddy@lsi.com \
    --cc=bhelgaas@google.com \
    --cc=linux-pci@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).