Linux-NVME Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: hch@infradead.org (Christoph Hellwig)
Subject: [PATCH 4.15-rc 1/3] nvme-core: Don't set nvme_wq as MEM_RECLAIM
Date: Thu, 21 Dec 2017 05:54:02 -0800	[thread overview]
Message-ID: <20171221135402.GA12323@infradead.org> (raw)
In-Reply-To: <f8cc93b5-a32a-f418-a65b-193ee530c481@grimberg.me>

On Thu, Dec 21, 2017@03:17:10PM +0200, Sagi Grimberg wrote:
> Note that the we need to make sure to not flush workqueue !MEM_RECLAIM
> from a workqueue that is MEM_RECLAIM and vice-versa (if we do we will
> can trigger deadlocks in severe memory pressure.

Yes.

> We cannot place the delete_work on the same workqueue as the reset_work
> because we flush reset_work from nvme_delete_ctrl (this is what this
> patch is trying to prevent).

Ok..

Seems like we should instead have a single-thread MEM_RECLAIM
workqueue per nvme controller for reset and remove as that would
implicitly serialize remove and delete.

Alternatively we could use the reset_work for removal as well.
In fact it already has the removal and we'd just need to add
a goto for that case if we are in deleting state, e.g. something
like the patch below, just for rdma without the core and other
transport bits:

diff --git a/drivers/nvme/host/rdma.c b/drivers/nvme/host/rdma.c
index 37af56596be6..ac09d5c4465f 100644
--- a/drivers/nvme/host/rdma.c
+++ b/drivers/nvme/host/rdma.c
@@ -1753,6 +1753,9 @@ static void nvme_rdma_reset_ctrl_work(struct work_struct *work)
 	nvme_stop_ctrl(&ctrl->ctrl);
 	nvme_rdma_shutdown_ctrl(ctrl, false);
 
+	if (ctrl->state == NVME_CTRL_DELETING)
+		goto out_remove;
+
 	ret = nvme_rdma_configure_admin_queue(ctrl, false);
 	if (ret)
 		goto out_fail;
@@ -1760,7 +1763,7 @@ static void nvme_rdma_reset_ctrl_work(struct work_struct *work)
 	if (ctrl->ctrl.queue_count > 1) {
 		ret = nvme_rdma_configure_io_queues(ctrl, false);
 		if (ret)
-			goto out_fail;
+			goto out_remove;
 	}
 
 	changed = nvme_change_ctrl_state(&ctrl->ctrl, NVME_CTRL_LIVE);
@@ -1774,7 +1777,7 @@ static void nvme_rdma_reset_ctrl_work(struct work_struct *work)
 
 	return;
 
-out_fail:
+out_remove:
 	dev_warn(ctrl->ctrl.device, "Removing after reset failure\n");
 	nvme_remove_namespaces(&ctrl->ctrl);
 	nvme_rdma_shutdown_ctrl(ctrl, true);

  reply	other threads:[~2017-12-21 13:54 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-21 10:07 [PATCH 4.15-rc 0/3] few fabrics fixes targeted to 4.15 Sagi Grimberg
2017-12-21 10:07 ` [PATCH 4.15-rc 1/3] nvme-core: Don't set nvme_wq as MEM_RECLAIM Sagi Grimberg
2017-12-21 10:17   ` Christoph Hellwig
2017-12-21 10:41     ` Sagi Grimberg
2017-12-21 13:00       ` Christoph Hellwig
2017-12-21 13:17         ` Sagi Grimberg
2017-12-21 13:54           ` Christoph Hellwig [this message]
2017-12-21 14:17             ` Sagi Grimberg
2017-12-29  9:35               ` Christoph Hellwig
2017-12-31  9:51                 ` Sagi Grimberg
2017-12-21 10:07 ` [PATCH 4.15-rc 2/3] nvme-core/loop/rdma: Host delete_work and reset_work on system workqueues Sagi Grimberg
2017-12-21 10:25   ` Christoph Hellwig
2017-12-21 10:43     ` Sagi Grimberg
2017-12-21 13:00       ` Christoph Hellwig
2017-12-22 17:39   ` James Smart
2017-12-24  8:55     ` Sagi Grimberg
2017-12-21 10:07 ` [PATCH 4.15-rc 3/3] nvme-fabrics: Protect against module unload during create_ctrl Sagi Grimberg
2017-12-21 10:25   ` Christoph Hellwig
2017-12-21 18:31     ` Sagi Grimberg

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=20171221135402.GA12323@infradead.org \
    --to=hch@infradead.org \
    /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