From: keith.busch@intel.com (Keith Busch)
Subject: [PATCH RFC 2/5] NVMe: Basic NVMe device hotplug support
Date: Mon, 30 Dec 2013 09:06:11 -0700 (MST) [thread overview]
Message-ID: <alpine.LRH.2.03.1312300855460.4958@AMR> (raw)
In-Reply-To: <1388399240-13828-3-git-send-email-santoshsy@gmail.com>
On Mon, 30 Dec 2013, Santosh Y wrote:
> This patch provides basic hotplug support for NVMe.
> For NVMe hotplug to work the PCIe slot must be hotplug capable.
>
> When a NVMe device is surprise removed and inserted back the
> device may need some time to respond to host IO commands, and
> will return NVME_SC_NS_NOT_READY. In this case the requests
> will be requeued until the device responds to the IO commands
> with status response or until the commands timeout.
>
> Signed-off-by: Ravi Kumar <ravi.android at gmail.com>
> Signed-off-by: Santosh Y <santoshsy at gmail.com>
>
> diff --git a/drivers/block/Kconfig b/drivers/block/Kconfig
> index 86b9f37..f92ec96 100644
> --- a/drivers/block/Kconfig
> +++ b/drivers/block/Kconfig
> @@ -319,6 +319,14 @@ config BLK_DEV_NVME
> To compile this driver as a module, choose M here: the
> module will be called nvme.
>
> +config BLK_DEV_NVME_HP
> + bool "Enable hotplug support"
> + depends on BLK_DEV_NVME && HOTPLUG_PCI_PCIE
> + default n
> + help
> + If you say Y here, the driver will support hotplug feature.
> + Hotplug only works if the PCIe slot is hotplug capable.
> +
> config BLK_DEV_SKD
> tristate "STEC S1120 Block Driver"
> depends on PCI
> diff --git a/drivers/block/nvme-core.c b/drivers/block/nvme-core.c
> index a523296..8a02135 100644
> --- a/drivers/block/nvme-core.c
> +++ b/drivers/block/nvme-core.c
> @@ -172,6 +172,13 @@ static int alloc_cmdid(struct nvme_queue *nvmeq, void *ctx,
> return cmdid;
> }
>
> +static inline bool nvme_check_surprise_removal(struct nvme_dev *dev)
> +{
> + if (readl(&dev->bar->csts) == -1)
> + return true;
> + return false;
> +}
> +
> static int alloc_cmdid_killable(struct nvme_queue *nvmeq, void *ctx,
> nvme_completion_fn handler, unsigned timeout)
> {
> @@ -370,6 +377,19 @@ static void nvme_end_io_acct(struct bio *bio, unsigned long start_time)
> part_stat_unlock();
> }
>
> +#ifdef CONFIG_BLK_DEV_NVME_HP
> +static void nvme_requeue_bio(struct nvme_dev *dev, struct bio *bio)
> +{
> + struct nvme_queue *nvmeq = get_nvmeq(dev);
> + if (bio_list_empty(&nvmeq->sq_cong))
> + add_wait_queue(&nvmeq->sq_full, &nvmeq->sq_cong_wait);
> + bio_list_add(&nvmeq->sq_cong, bio);
> + put_nvmeq(nvmeq);
> + wake_up_process(nvme_thread);
> +}
> +#endif
Unless you just so happen to be calling this function on the correct cpu,
you are modifying a bio_list with an unlocked nvme_queue, and that can
totally screw things up. I think we need to change the callbacks to take
'nvme_queue's instead of 'nvme_dev's to allow us to retry failed bios.
next prev parent reply other threads:[~2013-12-30 16:06 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 [this message]
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
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.1312300855460.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