Skip to contentSkip to conversation

RDMA/hns: Bugfix for flush cqe in case softirq and multi-process

PATCH In review Weihang Li 3 participants 14 messages Sep 5, 2019 – Nov 6, 2019

Subsystems (2)
lore
Share & tools
lore

Weihang Li

author
#0 lore raw

PATCH 1/1 RDMA/hns: Bugfix for flush cqe in case softirq and multi-process

From: Yixian Liu <[email protected]>

Hip08 has the feature flush cqe, which help to flush wqe in workqueue (sq and rq) when error happened by transmitting producer index with mailbox to hardware. Flush cqe is emplemented in post send and recv verbs. However, under NVMe cases, these verbs will be called under softirq context, and it will lead to following calltrace with current driver as mailbox used by flush cqe can go to sleep.

This patch solves this problem by using workqueue to do flush cqe, then hip08 can support NVMe case.

[ 5343.812237] Call trace:
[ 5343.815448] [<ffff00000808ab38>] dump_backtrace+0x0/0x280
[ 5343.821115] [<ffff00000808addc>] show_stack+0x24/0x30
[ 5343.826605] [<ffff000008d84cb4>] dump_stack+0x98/0xb8
[ 5343.831966] [<ffff0000080fda44>] __schedule_bug+0x64/0x80
[ 5343.837605] [<ffff000008d9b1ec>] __schedule+0x6bc/0x7fc
[ 5343.843010] [<ffff000008d9b360>] schedule+0x34/0x8c
[ 5343.848133] [<ffff000008d9ee80>] schedule_timeout+0x1d8/0x3cc
[ 5343.854087] [<ffff000008d9d72c>] __down+0x84/0xdc
[ 5343.859114] [<ffff000008124250>] down+0x54/0x6c
[ 5343.866446] [<ffff000001025bd4>] hns_roce_cmd_mbox+0x68/0x2cc [hns_roce]
[ 5343.874439] [<ffff000001063f70>] hns_roce_v2_modify_qp+0x4f4/0x1024
[hns_roce_pci]
[ 5343.882594] [<ffff00000106570c>] hns_roce_v2_post_recv+0x2a4/0x330
[hns_roce_pci]
[ 5343.890872] [<ffff0000010aa138>] nvme_rdma_post_recv+0x88/0xf8 [nvme_rdma]
[ 5343.898156] [<ffff0000010ab3a8>] __nvme_rdma_recv_done.isra.40+0x110/0x1f0
[nvme_rdma]
[ 5343.906453] [<ffff0000010ab4b4>] nvme_rdma_recv_done+0x2c/0x38 [nvme_rdma]
[ 5343.918428] [<ffff000000e34e04>] __ib_process_cq+0x7c/0xf0 [ib_core]
[ 5343.927135] [<ffff000000e34fb8>] ib_poll_handler+0x30/0x90 [ib_core]
[ 5343.933900] [<ffff00000859db94>] irq_poll_softirq+0xf8/0x150
[ 5343.939825] [<ffff0000080818d0>] __do_softirq+0x140/0x2ec
[ 5343.945573] [<ffff0000080d6f10>] run_ksoftirqd+0x48/0x5c
[ 5343.951258] [<ffff0000080f9064>] smpboot_thread_fn+0x190/0x1d4
[ 5343.957311] [<ffff0000080f441c>] kthread+0x10c/0x138
[ 5343.962518] [<ffff0000080855dc>] ret_from_fork+0x10/0x18
Fixes 0425e3e6e0c7 ("RDMA/hns: Support flush cqe for hip08 in kernel space")
---
 drivers/infiniband/hw/hns/hns_roce_device.h |  11 +++
 drivers/infiniband/hw/hns/hns_roce_hw_v2.c  | 124 ++++++++++------------------
 drivers/infiniband/hw/hns/hns_roce_main.c   |  12 +++
 drivers/infiniband/hw/hns/hns_roce_qp.c     |  41 +++++++++
 4 files changed, 107 insertions(+), 81 deletions(-)
drivers/infiniband/hw/hns/hns_roce_device.h +11 -0
index 96d1302..84fd70b 100644
@@ -91,6 +91,7 @@
 #define HNS_ROCE_MAX_PORTS			6
 #define HNS_ROCE_MAX_GID_NUM			16
 #define HNS_ROCE_GID_SIZE			16
+#define HNS_ROCE_WORKQ_NAME_LEN			32
 #define HNS_ROCE_SGE_SIZE			16
 
 #define HNS_ROCE_HOP_NUM_0			0xff
@@ -921,6 +922,12 @@ struct hns_roce_work {
 	int sub_type;
 };
 
+struct hns_roce_flush_work {
+	struct hns_roce_dev *hr_dev;
+	struct work_struct work;
+	struct hns_roce_qp *hr_qp;
+};
+
 struct hns_roce_dfx_hw {
 	int (*query_cqc_info)(struct hns_roce_dev *hr_dev, u32 cqn,
 			      int *buffer);
@@ -979,6 +986,8 @@ struct hns_roce_hw {
 	int (*modify_cq)(struct ib_cq *cq, u16 cq_count, u16 cq_period);
 	int (*init_eq)(struct hns_roce_dev *hr_dev);
 	void (*cleanup_eq)(struct hns_roce_dev *hr_dev);
+	int (*create_workq)(struct hns_roce_dev *hr_dev);
+	void (*destroy_workq)(struct hns_roce_dev *hr_dev);
 	void (*write_srqc)(struct hns_roce_dev *hr_dev,
 			   struct hns_roce_srq *srq, u32 pdn, u16 xrcd, u32 cqn,
 			   void *mb_buf, u64 *mtts_wqe, u64 *mtts_idx,
@@ -1043,6 +1052,7 @@ struct hns_roce_dev {
 	const struct hns_roce_hw *hw;
 	void			*priv;
 	struct workqueue_struct *irq_workq;
+	struct workqueue_struct *flush_workq;
 	const struct hns_roce_dfx_hw *dfx;
 };
 
@@ -1240,6 +1250,7 @@ struct ib_qp *hns_roce_create_qp(struct ib_pd *ib_pd,
 				 struct ib_udata *udata);
 int hns_roce_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr,
 		       int attr_mask, struct ib_udata *udata);
+void init_flush_work(struct hns_roce_dev *hr_dev, struct hns_roce_qp *hr_qp);
 void *get_recv_wqe(struct hns_roce_qp *hr_qp, int n);
 void *get_send_wqe(struct hns_roce_qp *hr_qp, int n);
 void *get_send_extend_sge(struct hns_roce_qp *hr_qp, int n);
drivers/infiniband/hw/hns/hns_roce_hw_v2.c +43 -81

241 lines not on this page · raw message

drivers/infiniband/hw/hns/hns_roce_main.c +12 -0
index b5d196c..2dd5ee2 100644
@@ -942,8 +942,17 @@ int hns_roce_init(struct hns_roce_dev *hr_dev)
 	if (ret)
 		goto error_failed_register_device;
 
+	if (hr_dev->hw->create_workq) {
+		ret = hr_dev->hw->create_workq(hr_dev);
+		if (ret)
+			goto error_failed_create_workq;
+	}
+
 	return 0;
 
+error_failed_create_workq:
+	hns_roce_unregister_device(hr_dev);
+
 error_failed_register_device:
 	if (hr_dev->hw->hw_exit)
 		hr_dev->hw->hw_exit(hr_dev);
@@ -979,6 +988,9 @@ void hns_roce_exit(struct hns_roce_dev *hr_dev)
 {
 	hns_roce_unregister_device(hr_dev);
 
+	if (hr_dev->hw->destroy_workq)
+		hr_dev->hw->destroy_workq(hr_dev);
+
 	if (hr_dev->hw->hw_exit)
 		hr_dev->hw->hw_exit(hr_dev);
 	hns_roce_cleanup_bitmap(hr_dev);
drivers/infiniband/hw/hns/hns_roce_qp.c +41 -0

53 lines not on this page · raw message

Signature · 1 line
2.8.1
#1 lore raw
Quoted 10 lines · Weihang Li

From: Yixian Liu <[email protected]>

Hip08 has the feature flush cqe, which help to flush wqe in workqueue (sq and rq) when error happened by transmitting producer index with mailbox to hardware. Flush cqe is emplemented in post send and recv verbs. However, under NVMe cases, these verbs will be called under softirq context, and it will lead to following calltrace with current driver as mailbox used by flush cqe can go to sleep.

This patch solves this problem by using workqueue to do flush cqe,

Unbelievable, almost every bug in this driver is solved by introducing workqueue. You should fix "sleep in flush path" issue and not by adding new workqueue.

Thanks

#2 lore raw
Quoted 10 lines · Leon Romanovsky
Quoted 9 lines · Weihang Li

From: Yixian Liu <[email protected]>

Hip08 has the feature flush cqe, which help to flush wqe in workqueue (sq and rq) when error happened by transmitting producer index with mailbox to hardware. Flush cqe is emplemented in post send and recv verbs. However, under NVMe cases, these verbs will be called under softirq context, and it will lead to following calltrace with current driver as mailbox used by flush cqe can go to sleep.

Quoted 6 lines
Quoted 1 line

This patch solves this problem by using workqueue to do flush cqe,

Unbelievable, almost every bug in this driver is solved by introducing workqueue. You should fix "sleep in flush path" issue and not by adding new workqueue.

Hi Leon,

Thanks for the comment.
Up to now, for hip08, only one place use workqueue in hns_roce_hw_v2.c where for irq prints.

The solution for flush cqe in this patch is as follow:
While flush cqe should be implement, the driver should modify qp to error state through mailbox with the newest product index of sq and rq, the hardware then can flush all outstanding wqes in sq and rq.

That's the whole mechanism of flush cqe, also is the flush path. We can't change neither mailbox sleep attribute or flush cqe occurred in post send/recv. To avoid the calltrace of flush cqe in post verbs under NVMe softirq, use workqueue for flush cqe seems reasonable.

As far as I know, there is no other alternative solution for this situation. I will be very grateful if you reminder me more information.

Thanks

Quoted 6 lines

_______________________________________________
Linuxarm mailing list
[email protected]
http://hulk.huawei.com/mailman/listinfo/linuxarm

#3 lore raw
Quoted 19 lines · Liuyixian (Eason)
Quoted 10 lines · Leon Romanovsky
Quoted 9 lines · Weihang Li

From: Yixian Liu <[email protected]>

Hip08 has the feature flush cqe, which help to flush wqe in workqueue (sq and rq) when error happened by transmitting producer index with mailbox to hardware. Flush cqe is emplemented in post send and recv verbs. However, under NVMe cases, these verbs will be called under softirq context, and it will lead to following calltrace with current driver as mailbox used by flush cqe can go to sleep.

Quoted 6 lines
Quoted 1 line

This patch solves this problem by using workqueue to do flush cqe,

Unbelievable, almost every bug in this driver is solved by introducing workqueue. You should fix "sleep in flush path" issue and not by adding new workqueue.

Quoted 5 lines

Hi Leon,

Thanks for the comment.
Up to now, for hip08, only one place use workqueue in hns_roce_hw_v2.c where for irq prints.

Thanks to our lack of desire to add more workqueues and previous patches which removed extra workqueues from the driver.

Quoted 6 lines

The solution for flush cqe in this patch is as follow:
While flush cqe should be implement, the driver should modify qp to error state through mailbox with the newest product index of sq and rq, the hardware then can flush all outstanding wqes in sq and rq.

Quoted 7 lines

That's the whole mechanism of flush cqe, also is the flush path. We can't change neither mailbox sleep attribute or flush cqe occurred in post send/recv. To avoid the calltrace of flush cqe in post verbs under NVMe softirq, use workqueue for flush cqe seems reasonable.

As far as I know, there is no other alternative solution for this situation. I will be very grateful if you reminder me more information.

ib_drain_rq/ib_drain_sq/ib_drain_qp????

Quoted 10 lines

Thanks

Quoted 6 lines

_______________________________________________
Linuxarm mailing list
[email protected]
http://hulk.huawei.com/mailman/listinfo/linuxarm

#4 lore raw
Quoted 20 lines · Leon Romanovsky
Quoted 19 lines · Liuyixian (Eason)
Quoted 16 lines · Leon Romanovsky
Quoted 10 lines · Weihang Li

From: Yixian Liu <[email protected]>

Hip08 has the feature flush cqe, which help to flush wqe in workqueue (sq and rq) when error happened by transmitting producer index with mailbox to hardware. Flush cqe is emplemented in post send and recv verbs. However, under NVMe cases, these verbs will be called under softirq context, and it will lead to following calltrace with current driver as mailbox used by flush cqe can go to sleep.

This patch solves this problem by using workqueue to do flush cqe,

Unbelievable, almost every bug in this driver is solved by introducing workqueue. You should fix "sleep in flush path" issue and not by adding new workqueue.

Quoted 9 lines
Quoted 5 lines

Hi Leon,

Thanks for the comment.
Up to now, for hip08, only one place use workqueue in hns_roce_hw_v2.c where for irq prints.

Thanks to our lack of desire to add more workqueues and previous patches which removed extra workqueues from the driver.

Thanks, I see.

Quoted 11 lines
Quoted 11 lines

The solution for flush cqe in this patch is as follow:
While flush cqe should be implement, the driver should modify qp to error state through mailbox with the newest product index of sq and rq, the hardware then can flush all outstanding wqes in sq and rq.

That's the whole mechanism of flush cqe, also is the flush path. We can't change neither mailbox sleep attribute or flush cqe occurred in post send/recv. To avoid the calltrace of flush cqe in post verbs under NVMe softirq, use workqueue for flush cqe seems reasonable.

Quoted 5 lines
Quoted 2 lines

As far as I know, there is no other alternative solution for this situation. I will be very grateful if you reminder me more information.

ib_drain_rq/ib_drain_sq/ib_drain_qp????

Hi Leon,

I think these interfaces are designed for application to check that all wqes have been processed by hardware, so called drain or flush. However, it is not the same as the flush in this patch. The solution in this patch is used to help the hardware generate flush cqes for outstanding wqes while qp error.

Quoted 13 lines
Quoted 10 lines

Thanks

Quoted 6 lines

_______________________________________________
Linuxarm mailing list
[email protected]
http://hulk.huawei.com/mailman/listinfo/linuxarm

.

#5 lore raw
Quoted 48 lines · Liuyixian (Eason)
Quoted 20 lines · Leon Romanovsky
Quoted 19 lines · Liuyixian (Eason)
Quoted 16 lines · Leon Romanovsky
Quoted 10 lines · Weihang Li

From: Yixian Liu <[email protected]>

Hip08 has the feature flush cqe, which help to flush wqe in workqueue (sq and rq) when error happened by transmitting producer index with mailbox to hardware. Flush cqe is emplemented in post send and recv verbs. However, under NVMe cases, these verbs will be called under softirq context, and it will lead to following calltrace with current driver as mailbox used by flush cqe can go to sleep.

This patch solves this problem by using workqueue to do flush cqe,

Unbelievable, almost every bug in this driver is solved by introducing workqueue. You should fix "sleep in flush path" issue and not by adding new workqueue.

Quoted 9 lines
Quoted 5 lines

Hi Leon,

Thanks for the comment.
Up to now, for hip08, only one place use workqueue in hns_roce_hw_v2.c where for irq prints.

Thanks to our lack of desire to add more workqueues and previous patches which removed extra workqueues from the driver.

Thanks, I see.

Quoted 14 lines
Quoted 13 lines

The solution for flush cqe in this patch is as follow:
While flush cqe should be implement, the driver should modify qp to error state through mailbox with the newest product index of sq and rq, the hardware then can flush all outstanding wqes in sq and rq.

That's the whole mechanism of flush cqe, also is the flush path. We can't change neither mailbox sleep attribute or flush cqe occurred in post send/recv. To avoid the calltrace of flush cqe in post verbs under NVMe softirq, use workqueue for flush cqe seems reasonable.

As far as I know, there is no other alternative solution for this situation. I will be very grateful if you reminder me more information.

Quoted 9 lines
Quoted 2 lines

ib_drain_rq/ib_drain_sq/ib_drain_qp????

Hi Leon,

I think these interfaces are designed for application to check that all wqes have been processed by hardware, so called drain or flush. However, it is not the same as the flush in this patch. The solution in this patch is used to help the hardware generate flush cqes for outstanding wqes while qp error.

Hi Leon,

What's your opinion about above? Do you have any further comments?

Thanks.

Quoted 21 lines
Quoted 11 lines
Quoted 10 lines

Thanks

Quoted 6 lines

_______________________________________________
Linuxarm mailing list
[email protected]
http://hulk.huawei.com/mailman/listinfo/linuxarm

Quoted 2 lines

.

_______________________________________________
Linuxarm mailing list
[email protected]
http://hulk.huawei.com/mailman/listinfo/linuxarm

.

#6 lore raw
Quoted 55 lines · Liuyixian (Eason)
Quoted 52 lines · Liuyixian (Eason)
Quoted 20 lines · Leon Romanovsky
Quoted 19 lines · Liuyixian (Eason)
Quoted 16 lines · Leon Romanovsky
Quoted 10 lines · Weihang Li

From: Yixian Liu <[email protected]>

Hip08 has the feature flush cqe, which help to flush wqe in workqueue (sq and rq) when error happened by transmitting producer index with mailbox to hardware. Flush cqe is emplemented in post send and recv verbs. However, under NVMe cases, these verbs will be called under softirq context, and it will lead to following calltrace with current driver as mailbox used by flush cqe can go to sleep.

This patch solves this problem by using workqueue to do flush cqe,

Unbelievable, almost every bug in this driver is solved by introducing workqueue. You should fix "sleep in flush path" issue and not by adding new workqueue.

Quoted 9 lines
Quoted 5 lines

Hi Leon,

Thanks for the comment.
Up to now, for hip08, only one place use workqueue in hns_roce_hw_v2.c where for irq prints.

Thanks to our lack of desire to add more workqueues and previous patches which removed extra workqueues from the driver.

Thanks, I see.

Quoted 11 lines
Quoted 11 lines

The solution for flush cqe in this patch is as follow:
While flush cqe should be implement, the driver should modify qp to error state through mailbox with the newest product index of sq and rq, the hardware then can flush all outstanding wqes in sq and rq.

That's the whole mechanism of flush cqe, also is the flush path. We can't change neither mailbox sleep attribute or flush cqe occurred in post send/recv. To avoid the calltrace of flush cqe in post verbs under NVMe softirq, use workqueue for flush cqe seems reasonable.

Quoted 5 lines
Quoted 2 lines

As far as I know, there is no other alternative solution for this situation. I will be very grateful if you reminder me more information.

ib_drain_rq/ib_drain_sq/ib_drain_qp????

Hi Leon,

Quoted 8 lines
Quoted 5 lines

I think these interfaces are designed for application to check that all wqes have been processed by hardware, so called drain or flush. However, it is not the same as the flush in this patch. The solution in this patch is used to help the hardware generate flush cqes for outstanding wqes while qp error.

Hi Leon,

What's your opinion about above? Do you have any further comments?

My opinion didn't change, you need to read discussions about ib_drain_*() functions, how and why they were introduced. It is a way to go.

Thanks

Quoted 25 lines

Thanks.

Quoted 21 lines
Quoted 11 lines
Quoted 10 lines

Thanks

Quoted 6 lines

_______________________________________________
Linuxarm mailing list
[email protected]
http://hulk.huawei.com/mailman/listinfo/linuxarm

Quoted 2 lines

.

_______________________________________________
Linuxarm mailing list
[email protected]
http://hulk.huawei.com/mailman/listinfo/linuxarm

.

#7 lore raw
Quoted 61 lines · Leon Romanovsky
Quoted 60 lines · Liuyixian (Eason)
Quoted 57 lines · Liuyixian (Eason)
Quoted 20 lines · Leon Romanovsky
Quoted 19 lines · Liuyixian (Eason)
Quoted 16 lines · Leon Romanovsky
Quoted 10 lines · Weihang Li

From: Yixian Liu <[email protected]>

Hip08 has the feature flush cqe, which help to flush wqe in workqueue (sq and rq) when error happened by transmitting producer index with mailbox to hardware. Flush cqe is emplemented in post send and recv verbs. However, under NVMe cases, these verbs will be called under softirq context, and it will lead to following calltrace with current driver as mailbox used by flush cqe can go to sleep.

This patch solves this problem by using workqueue to do flush cqe,

Unbelievable, almost every bug in this driver is solved by introducing workqueue. You should fix "sleep in flush path" issue and not by adding new workqueue.

Quoted 9 lines
Quoted 5 lines

Hi Leon,

Thanks for the comment.
Up to now, for hip08, only one place use workqueue in hns_roce_hw_v2.c where for irq prints.

Thanks to our lack of desire to add more workqueues and previous patches which removed extra workqueues from the driver.

Thanks, I see.

Quoted 11 lines
Quoted 11 lines

The solution for flush cqe in this patch is as follow:
While flush cqe should be implement, the driver should modify qp to error state through mailbox with the newest product index of sq and rq, the hardware then can flush all outstanding wqes in sq and rq.

That's the whole mechanism of flush cqe, also is the flush path. We can't change neither mailbox sleep attribute or flush cqe occurred in post send/recv. To avoid the calltrace of flush cqe in post verbs under NVMe softirq, use workqueue for flush cqe seems reasonable.

Quoted 5 lines
Quoted 2 lines

As far as I know, there is no other alternative solution for this situation. I will be very grateful if you reminder me more information.

ib_drain_rq/ib_drain_sq/ib_drain_qp????

Hi Leon,

I think these interfaces are designed for application to check that all wqes have been processed by hardware, so called drain or flush. However, it is not the same as the flush in this patch. The solution in this patch is used to help the hardware generate flush cqes for outstanding wqes while qp error.

Quoted 8 lines
Quoted 3 lines

Hi Leon,

What's your opinion about above? Do you have any further comments?

My opinion didn't change, you need to read discussions about ib_drain_*() functions, how and why they were introduced. It is a way to go.

Thanks

Hi Leon,

Thanks a lot! I will dig those functions for my problem.

Quoted 29 lines
Quoted 26 lines

Thanks.

Quoted 21 lines
Quoted 11 lines
Quoted 10 lines

Thanks

Quoted 6 lines

_______________________________________________
Linuxarm mailing list
[email protected]
http://hulk.huawei.com/mailman/listinfo/linuxarm

Quoted 2 lines

.

_______________________________________________
Linuxarm mailing list
[email protected]
http://hulk.huawei.com/mailman/listinfo/linuxarm

.

.

#8 lore raw
Quoted 68 lines · Liuyixian (Eason)
Quoted 65 lines · Leon Romanovsky
Quoted 63 lines · Liuyixian (Eason)
Quoted 48 lines · Liuyixian (Eason)
Quoted 20 lines · Leon Romanovsky
Quoted 19 lines · Liuyixian (Eason)
Quoted 16 lines · Leon Romanovsky
Quoted 10 lines · Weihang Li

From: Yixian Liu <[email protected]>

Hip08 has the feature flush cqe, which help to flush wqe in workqueue (sq and rq) when error happened by transmitting producer index with mailbox to hardware. Flush cqe is emplemented in post send and recv verbs. However, under NVMe cases, these verbs will be called under softirq context, and it will lead to following calltrace with current driver as mailbox used by flush cqe can go to sleep.

This patch solves this problem by using workqueue to do flush cqe,

Unbelievable, almost every bug in this driver is solved by introducing workqueue. You should fix "sleep in flush path" issue and not by adding new workqueue.

Quoted 9 lines
Quoted 5 lines

Hi Leon,

Thanks for the comment.
Up to now, for hip08, only one place use workqueue in hns_roce_hw_v2.c where for irq prints.

Thanks to our lack of desire to add more workqueues and previous patches which removed extra workqueues from the driver.

Thanks, I see.

Quoted 14 lines
Quoted 13 lines

The solution for flush cqe in this patch is as follow:
While flush cqe should be implement, the driver should modify qp to error state through mailbox with the newest product index of sq and rq, the hardware then can flush all outstanding wqes in sq and rq.

That's the whole mechanism of flush cqe, also is the flush path. We can't change neither mailbox sleep attribute or flush cqe occurred in post send/recv. To avoid the calltrace of flush cqe in post verbs under NVMe softirq, use workqueue for flush cqe seems reasonable.

As far as I know, there is no other alternative solution for this situation. I will be very grateful if you reminder me more information.

Quoted 9 lines
Quoted 2 lines

ib_drain_rq/ib_drain_sq/ib_drain_qp????

Hi Leon,

I think these interfaces are designed for application to check that all wqes have been processed by hardware, so called drain or flush. However, it is not the same as the flush in this patch. The solution in this patch is used to help the hardware generate flush cqes for outstanding wqes while qp error.

Hi Leon,

What's your opinion about above? Do you have any further comments?

Quoted 9 lines
Quoted 4 lines

My opinion didn't change, you need to read discussions about ib_drain_*() functions, how and why they were introduced. It is a way to go.

Thanks

Hi Leon,

Thanks a lot! I will dig those functions for my problem.

Hi Leon,

I have analysis the mechanism of ib_drain_(qp, sq, rq), that's okay to use it instead of our flush cqe as both of them are calling modify qp to error state in flush path.

However, both ib_drain_* and flush cqe will face the same problem as declared in previous emails, that is, in NVME case, post verbs will be called under **softirq**, which will result to calltrace as mailbox used in modify qp (flush path) can sleep, this is not allowed under softirq.

Thus, to resolve above calltrace (sleep in softirq), using workqueue as in this patch seems is a reasonable solution regardless of ib_drain_qp or flush cqe is called in the workqueue.

I think it is not a good idea to fix sleep in flush path (actually referred to mailbox used in modify qp) as the mailbox is such a mature mechanism.

Thanks.

#9 lore raw
Quoted 92 lines · Liuyixian (Eason)
Quoted 68 lines · Liuyixian (Eason)
Quoted 65 lines · Leon Romanovsky
Quoted 63 lines · Liuyixian (Eason)
Quoted 48 lines · Liuyixian (Eason)
Quoted 20 lines · Leon Romanovsky
Quoted 19 lines · Liuyixian (Eason)
Quoted 16 lines · Leon Romanovsky
Quoted 10 lines · Weihang Li

From: Yixian Liu <[email protected]>

Hip08 has the feature flush cqe, which help to flush wqe in workqueue (sq and rq) when error happened by transmitting producer index with mailbox to hardware. Flush cqe is emplemented in post send and recv verbs. However, under NVMe cases, these verbs will be called under softirq context, and it will lead to following calltrace with current driver as mailbox used by flush cqe can go to sleep.

This patch solves this problem by using workqueue to do flush cqe,

Unbelievable, almost every bug in this driver is solved by introducing workqueue. You should fix "sleep in flush path" issue and not by adding new workqueue.

Quoted 9 lines
Quoted 5 lines

Hi Leon,

Thanks for the comment.
Up to now, for hip08, only one place use workqueue in hns_roce_hw_v2.c where for irq prints.

Thanks to our lack of desire to add more workqueues and previous patches which removed extra workqueues from the driver.

Thanks, I see.

Quoted 14 lines
Quoted 13 lines

The solution for flush cqe in this patch is as follow:
While flush cqe should be implement, the driver should modify qp to error state through mailbox with the newest product index of sq and rq, the hardware then can flush all outstanding wqes in sq and rq.

That's the whole mechanism of flush cqe, also is the flush path. We can't change neither mailbox sleep attribute or flush cqe occurred in post send/recv. To avoid the calltrace of flush cqe in post verbs under NVMe softirq, use workqueue for flush cqe seems reasonable.

As far as I know, there is no other alternative solution for this situation. I will be very grateful if you reminder me more information.

Quoted 9 lines
Quoted 2 lines

ib_drain_rq/ib_drain_sq/ib_drain_qp????

Hi Leon,

I think these interfaces are designed for application to check that all wqes have been processed by hardware, so called drain or flush. However, it is not the same as the flush in this patch. The solution in this patch is used to help the hardware generate flush cqes for outstanding wqes while qp error.

Hi Leon,

What's your opinion about above? Do you have any further comments?

Quoted 9 lines
Quoted 4 lines

My opinion didn't change, you need to read discussions about ib_drain_*() functions, how and why they were introduced. It is a way to go.

Thanks

Hi Leon,

Thanks a lot! I will dig those functions for my problem.

Hi Leon,

I have analysis the mechanism of ib_drain_(qp, sq, rq), that's okay to use it instead of our flush cqe as both of them are calling modify qp to error state in flush path.

However, both ib_drain_* and flush cqe will face the same problem as declared in previous emails, that is, in NVME case, post verbs will be called under **softirq**, which will result to calltrace as mailbox used in modify qp (flush path) can sleep, this is not allowed under softirq.

Quoted 6 lines

Thus, to resolve above calltrace (sleep in softirq), using workqueue as in this patch seems is a reasonable solution regardless of ib_drain_qp or flush cqe is called in the workqueue.

I think it is not a good idea to fix sleep in flush path (actually referred to mailbox used in modify qp) as the mailbox is such a mature mechanism.

No, it is not reasonable solution.

Quoted 3 lines

Thanks.

#10 lore raw
Quoted 93 lines · Leon Romanovsky
Quoted 92 lines · Liuyixian (Eason)
Quoted 68 lines · Liuyixian (Eason)
Quoted 65 lines · Leon Romanovsky
Quoted 63 lines · Liuyixian (Eason)
Quoted 48 lines · Liuyixian (Eason)
Quoted 20 lines · Leon Romanovsky
Quoted 19 lines · Liuyixian (Eason)
Quoted 16 lines · Leon Romanovsky
Quoted 10 lines · Weihang Li

From: Yixian Liu <[email protected]>

Hip08 has the feature flush cqe, which help to flush wqe in workqueue (sq and rq) when error happened by transmitting producer index with mailbox to hardware. Flush cqe is emplemented in post send and recv verbs. However, under NVMe cases, these verbs will be called under softirq context, and it will lead to following calltrace with current driver as mailbox used by flush cqe can go to sleep.

This patch solves this problem by using workqueue to do flush cqe,

Unbelievable, almost every bug in this driver is solved by introducing workqueue. You should fix "sleep in flush path" issue and not by adding new workqueue.

Quoted 9 lines
Quoted 5 lines

Hi Leon,

Thanks for the comment.
Up to now, for hip08, only one place use workqueue in hns_roce_hw_v2.c where for irq prints.

Thanks to our lack of desire to add more workqueues and previous patches which removed extra workqueues from the driver.

Thanks, I see.

Quoted 14 lines
Quoted 13 lines

The solution for flush cqe in this patch is as follow:
While flush cqe should be implement, the driver should modify qp to error state through mailbox with the newest product index of sq and rq, the hardware then can flush all outstanding wqes in sq and rq.

That's the whole mechanism of flush cqe, also is the flush path. We can't change neither mailbox sleep attribute or flush cqe occurred in post send/recv. To avoid the calltrace of flush cqe in post verbs under NVMe softirq, use workqueue for flush cqe seems reasonable.

As far as I know, there is no other alternative solution for this situation. I will be very grateful if you reminder me more information.

Quoted 9 lines
Quoted 2 lines

ib_drain_rq/ib_drain_sq/ib_drain_qp????

Hi Leon,

I think these interfaces are designed for application to check that all wqes have been processed by hardware, so called drain or flush. However, it is not the same as the flush in this patch. The solution in this patch is used to help the hardware generate flush cqes for outstanding wqes while qp error.

Hi Leon,

What's your opinion about above? Do you have any further comments?

Quoted 9 lines
Quoted 4 lines

My opinion didn't change, you need to read discussions about ib_drain_*() functions, how and why they were introduced. It is a way to go.

Thanks

Hi Leon,

Thanks a lot! I will dig those functions for my problem.

Hi Leon,

I have analysis the mechanism of ib_drain_(qp, sq, rq), that's okay to use it instead of our flush cqe as both of them are calling modify qp to error state in flush path.

However, both ib_drain_* and flush cqe will face the same problem as declared in previous emails, that is, in NVME case, post verbs will be called under **softirq**, which will result to calltrace as mailbox used in modify qp (flush path) can sleep, this is not allowed under softirq.

Quoted 9 lines
Quoted 6 lines

Thus, to resolve above calltrace (sleep in softirq), using workqueue as in this patch seems is a reasonable solution regardless of ib_drain_qp or flush cqe is called in the workqueue.

I think it is not a good idea to fix sleep in flush path (actually referred to mailbox used in modify qp) as the mailbox is such a mature mechanism.

No, it is not reasonable solution.

Hi Leon,

I have explained this issue better in another patch set and pruned other logic. Thanks a lot for your review!

Best regards.
Eason

Quoted 6 lines
Quoted 3 lines

Thanks.

.

#11 lore raw
Quoted 106 lines · Liuyixian (Eason)
Quoted 93 lines · Leon Romanovsky
Quoted 92 lines · Liuyixian (Eason)
Quoted 68 lines · Liuyixian (Eason)
Quoted 65 lines · Leon Romanovsky
Quoted 63 lines · Liuyixian (Eason)
Quoted 48 lines · Liuyixian (Eason)
Quoted 20 lines · Leon Romanovsky
Quoted 19 lines · Liuyixian (Eason)
Quoted 16 lines · Leon Romanovsky
Quoted 10 lines · Weihang Li

From: Yixian Liu <[email protected]>

Hip08 has the feature flush cqe, which help to flush wqe in workqueue (sq and rq) when error happened by transmitting producer index with mailbox to hardware. Flush cqe is emplemented in post send and recv verbs. However, under NVMe cases, these verbs will be called under softirq context, and it will lead to following calltrace with current driver as mailbox used by flush cqe can go to sleep.

This patch solves this problem by using workqueue to do flush cqe,

Unbelievable, almost every bug in this driver is solved by introducing workqueue. You should fix "sleep in flush path" issue and not by adding new workqueue.

Quoted 9 lines
Quoted 5 lines

Hi Leon,

Thanks for the comment.
Up to now, for hip08, only one place use workqueue in hns_roce_hw_v2.c where for irq prints.

Thanks to our lack of desire to add more workqueues and previous patches which removed extra workqueues from the driver.

Thanks, I see.

Quoted 14 lines
Quoted 13 lines

The solution for flush cqe in this patch is as follow:
While flush cqe should be implement, the driver should modify qp to error state through mailbox with the newest product index of sq and rq, the hardware then can flush all outstanding wqes in sq and rq.

That's the whole mechanism of flush cqe, also is the flush path. We can't change neither mailbox sleep attribute or flush cqe occurred in post send/recv. To avoid the calltrace of flush cqe in post verbs under NVMe softirq, use workqueue for flush cqe seems reasonable.

As far as I know, there is no other alternative solution for this situation. I will be very grateful if you reminder me more information.

Quoted 9 lines
Quoted 2 lines

ib_drain_rq/ib_drain_sq/ib_drain_qp????

Hi Leon,

I think these interfaces are designed for application to check that all wqes have been processed by hardware, so called drain or flush. However, it is not the same as the flush in this patch. The solution in this patch is used to help the hardware generate flush cqes for outstanding wqes while qp error.

Hi Leon,

What's your opinion about above? Do you have any further comments?

Quoted 9 lines
Quoted 4 lines

My opinion didn't change, you need to read discussions about ib_drain_*() functions, how and why they were introduced. It is a way to go.

Thanks

Hi Leon,

Thanks a lot! I will dig those functions for my problem.

Hi Leon,

I have analysis the mechanism of ib_drain_(qp, sq, rq), that's okay to use it instead of our flush cqe as both of them are calling modify qp to error state in flush path.

However, both ib_drain_* and flush cqe will face the same problem as declared in previous emails, that is, in NVME case, post verbs will be called under **softirq**, which will result to calltrace as mailbox used in modify qp (flush path) can sleep, this is not allowed under softirq.

Quoted 9 lines
Quoted 6 lines

Thus, to resolve above calltrace (sleep in softirq), using workqueue as in this patch seems is a reasonable solution regardless of ib_drain_qp or flush cqe is called in the workqueue.

I think it is not a good idea to fix sleep in flush path (actually referred to mailbox used in modify qp) as the mailbox is such a mature mechanism.

No, it is not reasonable solution.

Quoted 8 lines

Hi Leon,

I have explained this issue better in another patch set and pruned other logic. Thanks a lot for your review!

Best regards.
Eason

Hi Doug and Loen,

I just want to make sure that you know the above mentioned patch set is on:
https://patchwork.kernel.org/project/linux-rdma/list/?series=194423

Sorry to reply your last comment so late as I analyzed all possible solutions with your comment, and found that I haven't describe our problem clear enough and accurate, thus, I made this new patch set with simple logic and detailed commit message. I hope I have clearly explained this problem .

Thanks.

#12 lore raw
Quoted 120 lines · Liuyixian (Eason)
Quoted 106 lines · Liuyixian (Eason)
Quoted 93 lines · Leon Romanovsky
Quoted 92 lines · Liuyixian (Eason)
Quoted 68 lines · Liuyixian (Eason)
Quoted 65 lines · Leon Romanovsky
Quoted 63 lines · Liuyixian (Eason)
Quoted 48 lines · Liuyixian (Eason)
Quoted 20 lines · Leon Romanovsky
Quoted 19 lines · Liuyixian (Eason)
Quoted 16 lines · Leon Romanovsky
Quoted 10 lines · Weihang Li

From: Yixian Liu <[email protected]>

Hip08 has the feature flush cqe, which help to flush wqe in workqueue (sq and rq) when error happened by transmitting producer index with mailbox to hardware. Flush cqe is emplemented in post send and recv verbs. However, under NVMe cases, these verbs will be called under softirq context, and it will lead to following calltrace with current driver as mailbox used by flush cqe can go to sleep.

This patch solves this problem by using workqueue to do flush cqe,

Unbelievable, almost every bug in this driver is solved by introducing workqueue. You should fix "sleep in flush path" issue and not by adding new workqueue.

Quoted 9 lines
Quoted 5 lines

Hi Leon,

Thanks for the comment.
Up to now, for hip08, only one place use workqueue in hns_roce_hw_v2.c where for irq prints.

Thanks to our lack of desire to add more workqueues and previous patches which removed extra workqueues from the driver.

Thanks, I see.

Quoted 14 lines
Quoted 13 lines

The solution for flush cqe in this patch is as follow:
While flush cqe should be implement, the driver should modify qp to error state through mailbox with the newest product index of sq and rq, the hardware then can flush all outstanding wqes in sq and rq.

That's the whole mechanism of flush cqe, also is the flush path. We can't change neither mailbox sleep attribute or flush cqe occurred in post send/recv. To avoid the calltrace of flush cqe in post verbs under NVMe softirq, use workqueue for flush cqe seems reasonable.

As far as I know, there is no other alternative solution for this situation. I will be very grateful if you reminder me more information.

Quoted 9 lines
Quoted 2 lines

ib_drain_rq/ib_drain_sq/ib_drain_qp????

Hi Leon,

I think these interfaces are designed for application to check that all wqes have been processed by hardware, so called drain or flush. However, it is not the same as the flush in this patch. The solution in this patch is used to help the hardware generate flush cqes for outstanding wqes while qp error.

Hi Leon,

What's your opinion about above? Do you have any further comments?

Quoted 9 lines
Quoted 4 lines

My opinion didn't change, you need to read discussions about ib_drain_*() functions, how and why they were introduced. It is a way to go.

Thanks

Hi Leon,

Thanks a lot! I will dig those functions for my problem.

Hi Leon,

I have analysis the mechanism of ib_drain_(qp, sq, rq), that's okay to use it instead of our flush cqe as both of them are calling modify qp to error state in flush path.

However, both ib_drain_* and flush cqe will face the same problem as declared in previous emails, that is, in NVME case, post verbs will be called under **softirq**, which will result to calltrace as mailbox used in modify qp (flush path) can sleep, this is not allowed under softirq.

Quoted 9 lines
Quoted 6 lines

Thus, to resolve above calltrace (sleep in softirq), using workqueue as in this patch seems is a reasonable solution regardless of ib_drain_qp or flush cqe is called in the workqueue.

I think it is not a good idea to fix sleep in flush path (actually referred to mailbox used in modify qp) as the mailbox is such a mature mechanism.

No, it is not reasonable solution.

Quoted 8 lines

Hi Leon,

I have explained this issue better in another patch set and pruned other logic. Thanks a lot for your review!

Best regards.
Eason

Hi Doug and Loen,

Quoted 7 lines

I just want to make sure that you know the above mentioned patch set is on:
https://patchwork.kernel.org/project/linux-rdma/list/?series=194423

Sorry to reply your last comment so late as I analyzed all possible solutions with your comment, and found that I haven't describe our problem clear enough and accurate, thus, I made this new patch set with simple logic and detailed commit message. I hope I have clearly explained this problem .

Hi,

I'm confident that Doug and/or Jason will review it very soon.

Thanks

Quoted 6 lines

Thanks.

#13 lore raw
Quoted 129 lines · Leon Romanovsky
Quoted 120 lines · Liuyixian (Eason)
Quoted 106 lines · Liuyixian (Eason)
Quoted 93 lines · Leon Romanovsky
Quoted 92 lines · Liuyixian (Eason)
Quoted 68 lines · Liuyixian (Eason)
Quoted 65 lines · Leon Romanovsky
Quoted 63 lines · Liuyixian (Eason)
Quoted 48 lines · Liuyixian (Eason)
Quoted 20 lines · Leon Romanovsky
Quoted 19 lines · Liuyixian (Eason)
Quoted 16 lines · Leon Romanovsky
Quoted 10 lines · Weihang Li

From: Yixian Liu <[email protected]>

Hip08 has the feature flush cqe, which help to flush wqe in workqueue
(sq and rq) when error happened by transmitting producer index with
mailbox to hardware. Flush cqe is emplemented in post send and recv
verbs. However, under NVMe cases, these verbs will be called under
softirq context, and it will lead to following calltrace with
current driver as mailbox used by flush cqe can go to sleep.

This patch solves this problem by using workqueue to do flush cqe,

Unbelievable, almost every bug in this driver is solved by introducing workqueue. You should fix "sleep in flush path" issue and not by adding new workqueue.

Quoted 9 lines
Quoted 5 lines

Hi Leon,

Thanks for the comment.
Up to now, for hip08, only one place use workqueue in hns_roce_hw_v2.c where for irq prints.

Thanks to our lack of desire to add more workqueues and previous patches which removed extra workqueues from the driver.

Thanks, I see.

Quoted 14 lines
Quoted 13 lines

The solution for flush cqe in this patch is as follow:
While flush cqe should be implement, the driver should modify qp to error state through mailbox with the newest product index of sq and rq, the hardware then can flush all outstanding wqes in sq and rq.

That's the whole mechanism of flush cqe, also is the flush path. We can't change neither mailbox sleep attribute or flush cqe occurred in post send/recv. To avoid the calltrace of flush cqe in post verbs under NVMe softirq, use workqueue for flush cqe seems reasonable.

As far as I know, there is no other alternative solution for this situation. I will be very grateful if you reminder me more information.

Quoted 9 lines
Quoted 2 lines

ib_drain_rq/ib_drain_sq/ib_drain_qp????

Hi Leon,

I think these interfaces are designed for application to check that all wqes have been processed by hardware, so called drain or flush. However, it is not the same as the flush in this patch. The solution in this patch is used to help the hardware generate flush cqes for outstanding wqes while qp error.

Hi Leon,

What's your opinion about above? Do you have any further comments?

Quoted 9 lines
Quoted 4 lines

My opinion didn't change, you need to read discussions about ib_drain_*() functions, how and why they were introduced. It is a way to go.

Thanks

Hi Leon,

Thanks a lot! I will dig those functions for my problem.

Hi Leon,

I have analysis the mechanism of ib_drain_(qp, sq, rq), that's okay to use it instead of our flush cqe as both of them are calling modify qp to error state in flush path.

However, both ib_drain_* and flush cqe will face the same problem as declared in previous emails, that is, in NVME case, post verbs will be called under **softirq**, which will result to calltrace as mailbox used in modify qp (flush path) can sleep, this is not allowed under softirq.

Quoted 9 lines
Quoted 6 lines

Thus, to resolve above calltrace (sleep in softirq), using workqueue as in this patch seems is a reasonable solution regardless of ib_drain_qp or flush cqe is called in the workqueue.

I think it is not a good idea to fix sleep in flush path (actually referred to mailbox used in modify qp) as the mailbox is such a mature mechanism.

No, it is not reasonable solution.

Quoted 8 lines

Hi Leon,

I have explained this issue better in another patch set and pruned other logic. Thanks a lot for your review!

Best regards.
Eason

Hi Doug and Loen,

Quoted 7 lines

I just want to make sure that you know the above mentioned patch set is on:
https://patchwork.kernel.org/project/linux-rdma/list/?series=194423

Sorry to reply your last comment so late as I analyzed all possible solutions with your comment, and found that I haven't describe our problem clear enough and accurate, thus, I made this new patch set with simple logic and detailed commit message. I hope I have clearly explained this problem .

Quoted 5 lines

Hi,

I'm confident that Doug and/or Jason will review it very soon.

Thanks

Thanks a lot!

Quoted 10 lines
Quoted 7 lines

Thanks.

.