Skip to content

Commit 1811977

Browse files
author
Keith Busch
committed
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 <[email protected]> Tested-by: Mikulas Patocka <[email protected]> Signed-off-by: Keith Busch <[email protected]>
1 parent ea48e87 commit 1811977

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

drivers/nvme/host/pci.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
*/
1414

1515
#include <linux/aer.h>
16+
#include <linux/async.h>
1617
#include <linux/blkdev.h>
1718
#include <linux/blk-mq.h>
1819
#include <linux/blk-mq-pci.h>
@@ -2488,6 +2489,13 @@ static unsigned long check_vendor_combination_bug(struct pci_dev *pdev)
24882489
return 0;
24892490
}
24902491

2492+
static void nvme_async_probe(void *data, async_cookie_t cookie)
2493+
{
2494+
struct nvme_dev *dev = data;
2495+
nvme_reset_ctrl_sync(&dev->ctrl);
2496+
flush_work(&dev->ctrl.scan_work);
2497+
}
2498+
24912499
static int nvme_probe(struct pci_dev *pdev, const struct pci_device_id *id)
24922500
{
24932501
int node, result = -ENOMEM;
@@ -2532,7 +2540,7 @@ static int nvme_probe(struct pci_dev *pdev, const struct pci_device_id *id)
25322540

25332541
dev_info(dev->ctrl.device, "pci function %s\n", dev_name(&pdev->dev));
25342542

2535-
nvme_reset_ctrl(&dev->ctrl);
2543+
async_schedule(nvme_async_probe, dev);
25362544

25372545
return 0;
25382546

0 commit comments

Comments
 (0)