From: Bart Van Assche <bvanassche@acm.org>
To: Keith Busch <keith.busch@intel.com>, Sagi Grimberg <sagi@grimberg.me>
Cc: Greg KH <gregkh@linuxfoundation.org>,
Mikulas Patocka <mpatocka@redhat.com>,
Christoph Hellwig <hch@lst.de>,
linux-nvme@lists.infradead.org,
Bart Van Assche <bvanassche@acm.org>
Subject: [PATCH] nvme: Boot as soon as the boot controller has been probed
Date: Sat, 7 Nov 2020 20:09:03 -0800 [thread overview]
Message-ID: <20201108040903.8185-1-bvanassche@acm.org> (raw)
The following two issues have been introduced by commit 1811977568e0
("nvme/pci: Use async_schedule for initial reset work"):
- The boot process waits until all NVMe controllers have been probed
instead of only waiting until the boot controller has been probed.
This slows down the boot process.
- Some of the controller probing work happens asynchronously without
the device core being aware of this.
Hence this patch that makes all probing work happen from nvme_probe()
and that tells the device core to probe multiple NVMe controllers
concurrently by setting PROBE_PREFER_ASYNCHRONOUS.
Cc: Mikulas Patocka <mpatocka@redhat.com>
Cc: Keith Busch <keith.busch@intel.com>
Cc: Greg KH <gregkh@linuxfoundation.org>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
drivers/nvme/host/pci.c | 27 +++++++++++++--------------
1 file changed, 13 insertions(+), 14 deletions(-)
diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
index 0578ff253c47..703bb3aee817 100644
--- a/drivers/nvme/host/pci.c
+++ b/drivers/nvme/host/pci.c
@@ -6,7 +6,6 @@
#include <linux/acpi.h>
#include <linux/aer.h>
-#include <linux/async.h>
#include <linux/blkdev.h>
#include <linux/blk-mq.h>
#include <linux/blk-mq-pci.h>
@@ -2821,15 +2820,6 @@ static inline bool nvme_acpi_storage_d3(struct pci_dev *dev)
}
#endif /* CONFIG_ACPI */
-static void nvme_async_probe(void *data, async_cookie_t cookie)
-{
- struct nvme_dev *dev = data;
-
- flush_work(&dev->ctrl.reset_work);
- flush_work(&dev->ctrl.scan_work);
- nvme_put_ctrl(&dev->ctrl);
-}
-
static int nvme_probe(struct pci_dev *pdev, const struct pci_device_id *id)
{
int node, result = -ENOMEM;
@@ -2903,8 +2893,16 @@ 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);
+ if (nvme_reset_ctrl(&dev->ctrl) == 0) {
+ /*
+ * Since reset_work is scheduled on the context of
+ * nvme_reset_wq and since that workqueue is not used for
+ * probing devices, waiting until reset_work from nvme_probe()
+ * is fine.
+ */
+ flush_work(&dev->ctrl.reset_work);
+ }
+ nvme_put_ctrl(&dev->ctrl);
return 0;
@@ -3221,11 +3219,12 @@ static struct pci_driver nvme_driver = {
.probe = nvme_probe,
.remove = nvme_remove,
.shutdown = nvme_shutdown,
-#ifdef CONFIG_PM_SLEEP
.driver = {
+#ifdef CONFIG_PM_SLEEP
.pm = &nvme_dev_pm_ops,
- },
#endif
+ .probe_type = PROBE_PREFER_ASYNCHRONOUS,
+ },
.sriov_configure = pci_sriov_configure_simple,
.err_handler = &nvme_err_handler,
};
_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme
next reply other threads:[~2020-11-08 4:09 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-08 4:09 Bart Van Assche [this message]
2020-11-08 8:24 ` [PATCH] nvme: Boot as soon as the boot controller has been probed Greg KH
2020-11-08 22:31 ` Keith Busch
2020-11-08 23:35 ` Bart Van Assche
2020-11-09 2:35 ` Keith Busch
2020-11-09 4:00 ` Bart Van Assche
2020-11-09 15:05 ` Keith Busch
2020-11-10 2:51 ` Bart Van Assche
2020-11-10 3:12 ` Keith Busch
2020-11-08 19:13 ` Sagi Grimberg
2020-11-08 19:18 ` Greg KH
2020-11-08 23:00 ` Bart Van Assche
2020-11-09 3:04 ` Keith Busch
2020-11-11 19:19 ` Keith Busch
2020-11-12 4:26 ` Bart Van Assche
2020-11-12 14:20 ` Keith Busch
2020-11-19 3:08 ` Bart Van Assche
2020-11-19 20:18 ` Keith Busch
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=20201108040903.8185-1-bvanassche@acm.org \
--to=bvanassche@acm.org \
--cc=gregkh@linuxfoundation.org \
--cc=hch@lst.de \
--cc=keith.busch@intel.com \
--cc=linux-nvme@lists.infradead.org \
--cc=mpatocka@redhat.com \
--cc=sagi@grimberg.me \
/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