Linux-NVME Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: ming.lei@redhat.com (Ming Lei)
Subject: [PATCH 4/6] nvme-pci: Sync queues on reset
Date: Thu, 16 May 2019 11:34:00 +0800	[thread overview]
Message-ID: <20190516033358.GD16342@ming.t460p> (raw)
In-Reply-To: <20190515163625.21776-4-keith.busch@intel.com>

On Wed, May 15, 2019@10:36:23AM -0600, Keith Busch wrote:
> A controller with multiple namespaces may have multiple request_queues
> with their own timeout work. If a live controller fails with IO
> outstanding to diffent namespaces, each request queue may attempt to
> disable and reset the controller in different threads. Synchronize each
> queue prior to starting the controller to ensure there no previously
> scheduled timeout work is running.
> 
> Signed-off-by: Keith Busch <keith.busch at intel.com>
> ---
>  drivers/nvme/host/core.c | 12 ++++++++++++
>  drivers/nvme/host/nvme.h |  1 +
>  drivers/nvme/host/pci.c  |  1 +
>  3 files changed, 14 insertions(+)
> 
> diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
> index d7de0642c832..a116ea037f83 100644
> --- a/drivers/nvme/host/core.c
> +++ b/drivers/nvme/host/core.c
> @@ -3880,6 +3880,18 @@ void nvme_start_queues(struct nvme_ctrl *ctrl)
>  }
>  EXPORT_SYMBOL_GPL(nvme_start_queues);
>  
> +
> +void nvme_sync_queues(struct nvme_ctrl *ctrl)
> +{
> +	struct nvme_ns *ns;
> +
> +	down_read(&ctrl->namespaces_rwsem);
> +	list_for_each_entry(ns, &ctrl->namespaces, list)
> +		blk_sync_queue(ns->queue);
> +	up_read(&ctrl->namespaces_rwsem);
> +}
> +EXPORT_SYMBOL_GPL(nvme_sync_queues);
> +
>  /*
>   * Check we didn't inadvertently grow the command structure sizes:
>   */
> diff --git a/drivers/nvme/host/nvme.h b/drivers/nvme/host/nvme.h
> index 5ee75b5ff83f..55553d293a98 100644
> --- a/drivers/nvme/host/nvme.h
> +++ b/drivers/nvme/host/nvme.h
> @@ -441,6 +441,7 @@ void nvme_complete_async_event(struct nvme_ctrl *ctrl, __le16 status,
>  void nvme_stop_queues(struct nvme_ctrl *ctrl);
>  void nvme_start_queues(struct nvme_ctrl *ctrl);
>  void nvme_kill_queues(struct nvme_ctrl *ctrl);
> +void nvme_sync_queues(struct nvme_ctrl *ctrl);
>  void nvme_unfreeze(struct nvme_ctrl *ctrl);
>  void nvme_wait_freeze(struct nvme_ctrl *ctrl);
>  void nvme_wait_freeze_timeout(struct nvme_ctrl *ctrl, long timeout);
> diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
> index 8df176ffcbc1..599065ed6a32 100644
> --- a/drivers/nvme/host/pci.c
> +++ b/drivers/nvme/host/pci.c
> @@ -2492,6 +2492,7 @@ static void nvme_reset_work(struct work_struct *work)
>  	 */
>  	if (dev->ctrl.ctrl_config & NVME_CC_ENABLE)
>  		nvme_dev_disable(dev, false);
> +	nvme_sync_queues(&dev->ctrl);

Looks fine:

Reviewed-by: Ming Lei <ming.lei at redhat.com>

Thanks, 
Ming

  reply	other threads:[~2019-05-16  3:34 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-15 16:36 [PATCH 1/6] nvme-pci: Fix controller freeze wait disabling Keith Busch
2019-05-15 16:36 ` [PATCH 2/6] nvme-pci: Don't disable on timeout in reset state Keith Busch
2019-05-16  3:07   ` Ming Lei
2019-05-16 14:33     ` Keith Busch
2019-05-16  6:27   ` Christoph Hellwig
2019-05-15 16:36 ` [PATCH 3/6] nvme-pci: Unblock reset_work on IO failure Keith Busch
2019-05-16  3:13   ` Ming Lei
2019-05-16 14:14     ` Keith Busch
2019-05-17  2:31       ` Ming Lei
2019-05-16  6:28   ` Christoph Hellwig
2019-05-15 16:36 ` [PATCH 4/6] nvme-pci: Sync queues on reset Keith Busch
2019-05-16  3:34   ` Ming Lei [this message]
2019-05-16  6:29   ` Christoph Hellwig
2019-05-16 14:08     ` Keith Busch
2019-05-16 13:43   ` Minwoo Im
2019-05-15 16:36 ` [PATCH 5/6] nvme: Export get and set features Keith Busch
2019-05-16  6:26   ` Christoph Hellwig
2019-05-16 13:47   ` Minwoo Im
2019-05-15 16:36 ` [PATCHv2 6/6] nvme-pci: Use host managed power state for suspend Keith Busch
2019-05-15 19:33   ` Mario.Limonciello
2019-05-15 19:34     ` Keith Busch
2019-05-15 19:43       ` Mario.Limonciello
2019-05-16  6:25   ` Christoph Hellwig
2019-05-16 14:24     ` Keith Busch
2019-05-17  9:08       ` Christoph Hellwig
2019-05-16  9:29   ` Rafael J. Wysocki
2019-05-16 14:26     ` Keith Busch
2019-05-16 18:27       ` Kai-Heng Feng
2019-05-16 18:33         ` Mario.Limonciello
2019-05-16 19:38           ` Keith Busch
2019-05-16 20:25             ` Rafael J. Wysocki
2019-05-16 20:39               ` Keith Busch
2019-05-16 20:56                 ` Rafael J. Wysocki
2019-05-17  8:39                   ` Rafael J. Wysocki
2019-05-17  9:05                     ` Christoph Hellwig
2019-05-17  9:17                       ` Rafael J. Wysocki
2019-05-17  9:35                         ` Christoph Hellwig
2019-05-17 10:34                           ` Rafael J. Wysocki
2019-05-22  6:47                             ` Kai Heng Feng
2019-05-22 15:52                               ` Christoph Hellwig
2019-05-22 16:02                                 ` Keith Busch
2019-05-22 16:35                                   ` Mario.Limonciello
2019-05-22 16:56                                     ` Keith Busch
2019-05-22 23:08                                     ` Keith Busch
2019-05-23 15:27                                       ` Keith Busch
2019-05-17  9:22                     ` Kai-Heng Feng
2019-05-17  9:32                       ` Rafael J. Wysocki
2019-05-16 20:24         ` Rafael J. Wysocki
2019-05-16  2:43 ` [PATCH 1/6] nvme-pci: Fix controller freeze wait disabling Ming Lei
2019-05-17 18:40   ` Keith Busch
2019-05-16  6:27 ` Christoph Hellwig

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=20190516033358.GD16342@ming.t460p \
    --to=ming.lei@redhat.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