All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 1/2] nvmet-rdma: Don't flush system_wq by default during remove_one
@ 2018-02-28 11:12 Max Gurtovoy
  2018-02-28 11:12 ` [PATCH v3 2/2] nvme-rdma: Don't flush delete_wq " Max Gurtovoy
  2018-03-01 11:33 ` [PATCH v3 1/2] nvmet-rdma: Don't flush system_wq " Sagi Grimberg
  0 siblings, 2 replies; 5+ messages in thread
From: Max Gurtovoy @ 2018-02-28 11:12 UTC (permalink / raw)


The .remove_one function is called for any ib_device removal.
In case the removed device has no reference in our driver, there
is no need to flush the system work queue.

Reviewed-by: Israel Rukshin <israelr at mellanox.com>
Signed-off-by: Max Gurtovoy <maxg at mellanox.com>
---

Changes from v2:
 - remove wrong WARNING in case device not found

Changes from v1:
 - check for the ib_device in the device list
---
 drivers/nvme/target/rdma.c | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)

diff --git a/drivers/nvme/target/rdma.c b/drivers/nvme/target/rdma.c
index 978e169..1d873f7 100644
--- a/drivers/nvme/target/rdma.c
+++ b/drivers/nvme/target/rdma.c
@@ -1460,8 +1460,25 @@ static void nvmet_rdma_remove_port(struct nvmet_port *port)
 static void nvmet_rdma_remove_one(struct ib_device *ib_device, void *client_data)
 {
 	struct nvmet_rdma_queue *queue, *tmp;
+	struct nvmet_rdma_device *ndev;
+	bool found = false;
+
+	mutex_lock(&device_list_mutex);
+	list_for_each_entry(ndev, &device_list, entry) {
+		if (ndev->device == ib_device) {
+			found = true;
+			break;
+		}
+	}
+	mutex_unlock(&device_list_mutex);
+
+	if (!found)
+		return;
 
-	/* Device is being removed, delete all queues using this device */
+	/*
+	 * IB Device that is used by nvmet controllers is being removed,
+	 * delete all queues using this device.
+	 */
 	mutex_lock(&nvmet_rdma_queue_mutex);
 	list_for_each_entry_safe(queue, tmp, &nvmet_rdma_queue_list,
 				 queue_list) {
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH v3 2/2] nvme-rdma: Don't flush delete_wq by default during remove_one
  2018-02-28 11:12 [PATCH v3 1/2] nvmet-rdma: Don't flush system_wq by default during remove_one Max Gurtovoy
@ 2018-02-28 11:12 ` Max Gurtovoy
  2018-03-01 11:33   ` Sagi Grimberg
  2018-03-01 11:33 ` [PATCH v3 1/2] nvmet-rdma: Don't flush system_wq " Sagi Grimberg
  1 sibling, 1 reply; 5+ messages in thread
From: Max Gurtovoy @ 2018-02-28 11:12 UTC (permalink / raw)


The .remove_one function is called for any ib_device removal.
In case the removed device has no reference in our driver, there
is no need to flush the work queue.

Reviewed-by: Israel Rukshin <israelr at mellanox.com>
Signed-off-by: Max Gurtovoy <maxg at mellanox.com>
---

Changes from v2:
 - remove wrong WARNING in case device not found

Changes from v1:
 - check for the ib_device in the device list

---
 drivers/nvme/host/rdma.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/drivers/nvme/host/rdma.c b/drivers/nvme/host/rdma.c
index 3a51ed5..40fff53 100644
--- a/drivers/nvme/host/rdma.c
+++ b/drivers/nvme/host/rdma.c
@@ -2025,6 +2025,20 @@ static struct nvme_ctrl *nvme_rdma_create_ctrl(struct device *dev,
 static void nvme_rdma_remove_one(struct ib_device *ib_device, void *client_data)
 {
 	struct nvme_rdma_ctrl *ctrl;
+	struct nvme_rdma_device *ndev;
+	bool found = false;
+
+	mutex_lock(&device_list_mutex);
+	list_for_each_entry(ndev, &device_list, entry) {
+		if (ndev->dev == ib_device) {
+			found = true;
+			break;
+		}
+	}
+	mutex_unlock(&device_list_mutex);
+
+	if (!found)
+		return;
 
 	/* Delete all controllers using this device */
 	mutex_lock(&nvme_rdma_ctrl_mutex);
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH v3 1/2] nvmet-rdma: Don't flush system_wq by default during remove_one
  2018-02-28 11:12 [PATCH v3 1/2] nvmet-rdma: Don't flush system_wq by default during remove_one Max Gurtovoy
  2018-02-28 11:12 ` [PATCH v3 2/2] nvme-rdma: Don't flush delete_wq " Max Gurtovoy
@ 2018-03-01 11:33 ` Sagi Grimberg
  2018-03-15 20:58   ` Keith Busch
  1 sibling, 1 reply; 5+ messages in thread
From: Sagi Grimberg @ 2018-03-01 11:33 UTC (permalink / raw)


Looks fine,

Reviewed-by: Sagi Grimberg <sagi at grimberg.me>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH v3 2/2] nvme-rdma: Don't flush delete_wq by default during remove_one
  2018-02-28 11:12 ` [PATCH v3 2/2] nvme-rdma: Don't flush delete_wq " Max Gurtovoy
@ 2018-03-01 11:33   ` Sagi Grimberg
  0 siblings, 0 replies; 5+ messages in thread
From: Sagi Grimberg @ 2018-03-01 11:33 UTC (permalink / raw)


Looks fine,

Reviewed-by: Sagi Grimberg <sagi at grimberg.me>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH v3 1/2] nvmet-rdma: Don't flush system_wq by default during remove_one
  2018-03-01 11:33 ` [PATCH v3 1/2] nvmet-rdma: Don't flush system_wq " Sagi Grimberg
@ 2018-03-15 20:58   ` Keith Busch
  0 siblings, 0 replies; 5+ messages in thread
From: Keith Busch @ 2018-03-15 20:58 UTC (permalink / raw)


Thanks, series applied for 4.17 with Sagi's review.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2018-03-15 20:58 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-28 11:12 [PATCH v3 1/2] nvmet-rdma: Don't flush system_wq by default during remove_one Max Gurtovoy
2018-02-28 11:12 ` [PATCH v3 2/2] nvme-rdma: Don't flush delete_wq " Max Gurtovoy
2018-03-01 11:33   ` Sagi Grimberg
2018-03-01 11:33 ` [PATCH v3 1/2] nvmet-rdma: Don't flush system_wq " Sagi Grimberg
2018-03-15 20:58   ` Keith Busch

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.