summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorKeith Busch <keith.busch@intel.com>2018-04-27 13:42:52 -0600
committerKeith Busch <keith.busch@intel.com>2018-05-02 08:32:24 -0600
commit1811977568e0f59d145da087e45f3dca09dab1c3 (patch)
treea89d3e62d9336a8a3f728883c47e8ea7c4f889fc /drivers
parentea48e877994f086af481427bac110aa63686c3ce (diff)
downloadlinux-stable-1811977568e0f59d145da087e45f3dca09dab1c3.tar.gz
linux-stable-1811977568e0f59d145da087e45f3dca09dab1c3.tar.bz2
linux-stable-1811977568e0f59d145da087e45f3dca09dab1c3.zip
nvme/pci: Use async_schedule for initial reset work
This patch schedules the initial controller reset in an async_domain so that it can be synchronized from wait_for_device_probe(). This way the kernel waits for the initial nvme controller scan to complete for all devices before proceeding with the boot sequence, which may have nvme dependencies. Reported-by: Mikulas Patocka <mpatocka@redhat.com> Tested-by: Mikulas Patocka <mpatocka@redhat.com> Signed-off-by: Keith Busch <keith.busch@intel.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/nvme/host/pci.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
index 8a86dbb0583d..dcd1be005eef 100644
--- a/drivers/nvme/host/pci.c
+++ b/drivers/nvme/host/pci.c
@@ -13,6 +13,7 @@
*/
#include <linux/aer.h>
+#include <linux/async.h>
#include <linux/blkdev.h>
#include <linux/blk-mq.h>
#include <linux/blk-mq-pci.h>
@@ -2488,6 +2489,13 @@ static unsigned long check_vendor_combination_bug(struct pci_dev *pdev)
return 0;
}
+static void nvme_async_probe(void *data, async_cookie_t cookie)
+{
+ struct nvme_dev *dev = data;
+ nvme_reset_ctrl_sync(&dev->ctrl);
+ flush_work(&dev->ctrl.scan_work);
+}
+
static int nvme_probe(struct pci_dev *pdev, const struct pci_device_id *id)
{
int node, result = -ENOMEM;
@@ -2532,7 +2540,7 @@ static int nvme_probe(struct pci_dev *pdev, const struct pci_device_id *id)
dev_info(dev->ctrl.device, "pci function %s\n", dev_name(&pdev->dev));
- nvme_reset_ctrl(&dev->ctrl);
+ async_schedule(nvme_async_probe, dev);
return 0;