From: keith.busch@intel.com (Keith Busch)
Subject: [PATCH RFC 3/5] NVMe: Asynchronous device scan support
Date: Mon, 30 Dec 2013 08:55:30 -0700 (MST) [thread overview]
Message-ID: <alpine.LRH.2.03.1312300757360.4958@AMR> (raw)
In-Reply-To: <20131230135025.GI4945@linux.intel.com>
On Mon, 30 Dec 2013, Matthew Wilcox wrote:
> On Mon, Dec 30, 2013@03:57:18PM +0530, Santosh Y wrote:
>> This patch provides asynchronous device enumeration
>> capability. The 'probe' need not wait until the namespace scanning is
>> complete.
>
> I'm very interested in having something like this, except I don't think
> it's complete. You don't seem to handle the cases where the device
> is shut down in the middle of an async scan. Also, the only piece you
> seem to make async is the calls to add_disk(), which are surely not the
> timeconsuming parts of the scan. I would think the time consuming parts
> are sending the IDENTIFY commands, which you don't make async.
Surprisingly, add_disk is the by far longest part. It does several dozen
blocking reads to check for a known partitions. The identifies don't
become measurable until you have several hundred namespaces but that
time is just noise compared to 'add_disk'.
I started on a generic block patch that makes 'add_disk' non-blocking. I
can see about cleaning that up and posting to the block mailing list
for consideration.
>> Signed-off-by: Ravi Kumar <ravi.android at gmail.com>
>> Signed-off-by: Santosh Y <santoshsy at gmail.com>
>>
>> diff --git a/drivers/block/nvme-core.c b/drivers/block/nvme-core.c
>> index 8a02135..cd37335 100644
>> --- a/drivers/block/nvme-core.c
>> +++ b/drivers/block/nvme-core.c
>> @@ -17,6 +17,9 @@
>> */
>>
>> #include <linux/nvme.h>
>> +#ifdef CONFIG_BLK_DEV_NVME_HP
>> +#include <linux/async.h>
>> +#endif
>> #include <linux/bio.h>
>> #include <linux/bitops.h>
>> #include <linux/blkdev.h>
>> @@ -2115,8 +2118,10 @@ static int nvme_dev_add(struct nvme_dev *dev)
>> if (ns)
>> list_add_tail(&ns->list, &dev->namespaces);
>> }
>> +#ifndef CONFIG_BLK_DEV_NVME_HP
>> list_for_each_entry(ns, &dev->namespaces, list)
>> add_disk(ns->disk);
>> +#endif
>> res = 0;
>>
>> out:
>> @@ -2546,6 +2551,19 @@ static void nvme_reset_failed_dev(struct work_struct *ws)
>> nvme_dev_reset(dev);
>> }
>>
>> +#ifdef CONFIG_BLK_DEV_NVME_HP
>> +static void nvme_async_add(void *data, async_cookie_t cookie)
>> +{
>> + struct nvme_dev *dev = (struct nvme_dev *)data;
>> + struct nvme_ns *ns;
>> +
>> + list_for_each_entry(ns, &dev->namespaces, list)
>> + add_disk(ns->disk);
>> + if (!test_bit(NVME_HOT_REM, &dev->hp_flag))
>> + dev->initialized = 1;
>> +}
>> +#endif
>> +
>> static int nvme_probe(struct pci_dev *pdev, const struct pci_device_id *id)
>> {
>> int result = -ENOMEM;
>> @@ -2595,14 +2613,16 @@ static int nvme_probe(struct pci_dev *pdev, const struct pci_device_id *id)
>> if (result)
>> goto remove;
>>
>> - dev->initialized = 1;
>> - kref_init(&dev->kref);
>> -
>> #ifdef CONFIG_BLK_DEV_NVME_HP
>> + async_schedule(nvme_async_add, dev);
>> if (!pdev->is_added)
>> dev_info(&pdev->dev,
>> "Device 0x%x is on-line\n", pdev->device);
>> +#else
>> + dev->initialized = 1;
>> #endif
>> + kref_init(&dev->kref);
>> +
>> return 0;
>>
>> remove:
>> --
>> 1.8.3.2
>
> _______________________________________________
> Linux-nvme mailing list
> Linux-nvme at lists.infradead.org
> http://merlin.infradead.org/mailman/listinfo/linux-nvme
>
next prev parent reply other threads:[~2013-12-30 15:55 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-30 10:27 [PATCH RFC 0/5] NVMe: Hotplug support Santosh Y
2013-12-30 10:27 ` [PATCH RFC 1/5] NVMe: Code cleanup and minor checkpatch correction Santosh Y
2013-12-30 13:32 ` Matthew Wilcox
2013-12-30 14:52 ` Keith Busch
2013-12-30 10:27 ` [PATCH RFC 2/5] NVMe: Basic NVMe device hotplug support Santosh Y
2013-12-30 13:46 ` Matthew Wilcox
2013-12-30 13:48 ` Matias Bjorling
2013-12-30 14:09 ` Matias Bjorling
2013-12-30 16:06 ` Keith Busch
2013-12-30 17:21 ` Keith Busch
2013-12-31 8:48 ` Ravi Kumar
2013-12-31 13:35 ` Matthew Wilcox
2013-12-31 17:17 ` Matthew Wilcox
2013-12-30 10:27 ` [PATCH RFC 3/5] NVMe: Asynchronous device scan support Santosh Y
2013-12-30 13:50 ` Matthew Wilcox
2013-12-30 15:55 ` Keith Busch [this message]
2014-03-28 14:02 ` Santosh Y
2014-03-28 16:29 ` Keith Busch
2014-04-11 13:59 ` Matthew Wilcox
2014-04-13 17:42 ` Matthew Wilcox
2013-12-30 10:27 ` [PATCH RFC 4/5] NVMe: Stale node cleanup based on reference count Santosh Y
2013-12-30 14:00 ` Matthew Wilcox
2013-12-30 10:27 ` [PATCH RFC 5/5] NVMe: Hotplug support during hibernate/sleep states Santosh Y
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=alpine.LRH.2.03.1312300757360.4958@AMR \
--to=keith.busch@intel.com \
/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