Skip to contentSkip to conversation

RDMA/rxe: Fix qp error handler

PATCH Superseded [email protected] 3 participants 6 messages Jul 25, 2022 – Jul 30, 2022

Subsystems (2)

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 RDMA/rxe: Fix qp error handler

From: Zhu Yanjun <[email protected]>

About 7 spin locks in qp creation needs to be initialized. Now these spin locks are initialized in the function rxe_qp_init_misc. This will avoid the error "initialize spin locks before use".

---
V2->V3: Keep the spin_lock_init in rxe_init_task for future use.

---
 drivers/infiniband/sw/rxe/rxe_qp.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
drivers/infiniband/sw/rxe/rxe_qp.c +8 -4
index 22e9b85344c3..ae8c51ef2db6 100644
@@ -174,6 +174,14 @@ static void rxe_qp_init_misc(struct rxe_dev *rxe, struct rxe_qp *qp,
 
 	spin_lock_init(&qp->state_lock);
 
+	spin_lock_init(&qp->req.task.state_lock);
+	spin_lock_init(&qp->resp.task.state_lock);
+	spin_lock_init(&qp->comp.task.state_lock);
+
+	spin_lock_init(&qp->sq.sq_lock);
+	spin_lock_init(&qp->rq.producer_lock);
+	spin_lock_init(&qp->rq.consumer_lock);
+
 	atomic_set(&qp->ssn, 0);
 	atomic_set(&qp->skb_out, 0);
 }
@@ -233,7 +241,6 @@ static int rxe_qp_init_req(struct rxe_dev *rxe, struct rxe_qp *qp,
 	qp->req.opcode		= -1;
 	qp->comp.opcode		= -1;
 
-	spin_lock_init(&qp->sq.sq_lock);
 	skb_queue_head_init(&qp->req_pkts);
 
 	rxe_init_task(rxe, &qp->req.task, qp,
@@ -284,9 +291,6 @@ static int rxe_qp_init_resp(struct rxe_dev *rxe, struct rxe_qp *qp,
 		}
 	}
 
-	spin_lock_init(&qp->rq.producer_lock);
-	spin_lock_init(&qp->rq.consumer_lock);
-
 	skb_queue_head_init(&qp->resp_pkts);
 
 	rxe_init_task(rxe, &qp->resp.task, qp,
Signature · 1 line
2.34.1
#1 lore raw
Quoted 6 lines · On Tue, Jul 26, 2022 at 12:56:31AM -0400, [email protected] wrote:

From: Zhu Yanjun <[email protected]>

About 7 spin locks in qp creation needs to be initialized. Now these spin locks are initialized in the function rxe_qp_init_misc. This will avoid the error "initialize spin locks before use".

Quoted 7 lines

---
V2->V3: Keep the spin_lock_init in rxe_init_task for future use.

---
 drivers/infiniband/sw/rxe/rxe_qp.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

Fixes line?

Quoted 41 lines
drivers/infiniband/sw/rxe/rxe_qp.c +8 -4
index 22e9b85344c3..ae8c51ef2db6 100644
@@ -174,6 +174,14 @@ static void rxe_qp_init_misc(struct rxe_dev *rxe, struct rxe_qp *qp,
 
 	spin_lock_init(&qp->state_lock);
 
+	spin_lock_init(&qp->req.task.state_lock);
+	spin_lock_init(&qp->resp.task.state_lock);
+	spin_lock_init(&qp->comp.task.state_lock);
+
+	spin_lock_init(&qp->sq.sq_lock);
+	spin_lock_init(&qp->rq.producer_lock);
+	spin_lock_init(&qp->rq.consumer_lock);
+
 	atomic_set(&qp->ssn, 0);
 	atomic_set(&qp->skb_out, 0);
 }
@@ -233,7 +241,6 @@ static int rxe_qp_init_req(struct rxe_dev *rxe, struct rxe_qp *qp,
 	qp->req.opcode		= -1;
 	qp->comp.opcode		= -1;
 
-	spin_lock_init(&qp->sq.sq_lock);
 	skb_queue_head_init(&qp->req_pkts);
 
 	rxe_init_task(rxe, &qp->req.task, qp,
@@ -284,9 +291,6 @@ static int rxe_qp_init_resp(struct rxe_dev *rxe, struct rxe_qp *qp,
 		}
 	}
 
-	spin_lock_init(&qp->rq.producer_lock);
-	spin_lock_init(&qp->rq.consumer_lock);
-
 	skb_queue_head_init(&qp->resp_pkts);
 
 	rxe_init_task(rxe, &qp->resp.task, qp,
Signature · 1 line
2.34.1
author
#2 lore raw
Quoted 7 lines · Leon Romanovsky
Quoted 6 lines · On Tue, Jul 26, 2022 at 12:56:31AM -0400, [email protected] wrote:

From: Zhu Yanjun <[email protected]>

About 7 spin locks in qp creation needs to be initialized. Now these spin locks are initialized in the function rxe_qp_init_misc. This will avoid the error "initialize spin locks before use".

Quoted 8 lines
Quoted 7 lines

---
V2->V3: Keep the spin_lock_init in rxe_init_task for future use.

---
  drivers/infiniband/sw/rxe/rxe_qp.c | 12 ++++++++----
  1 file changed, 8 insertions(+), 4 deletions(-)

Fixes line?

The Fixes line should be:

Fixes 8700e3e7c485 ("Soft RoCE driver")

Thanks and Regards,

Zhu Yanjun

Quoted 41 lines
Quoted 41 lines
drivers/infiniband/sw/rxe/rxe_qp.c +8 -4
index 22e9b85344c3..ae8c51ef2db6 100644
@@ -174,6 +174,14 @@ static void rxe_qp_init_misc(struct rxe_dev *rxe, struct rxe_qp *qp,
 
  	spin_lock_init(&qp->state_lock);
 
+	spin_lock_init(&qp->req.task.state_lock);
+	spin_lock_init(&qp->resp.task.state_lock);
+	spin_lock_init(&qp->comp.task.state_lock);
+
+	spin_lock_init(&qp->sq.sq_lock);
+	spin_lock_init(&qp->rq.producer_lock);
+	spin_lock_init(&qp->rq.consumer_lock);
+
  	atomic_set(&qp->ssn, 0);
  	atomic_set(&qp->skb_out, 0);
  }
@@ -233,7 +241,6 @@ static int rxe_qp_init_req(struct rxe_dev *rxe, struct rxe_qp *qp,
  	qp->req.opcode		= -1;
  	qp->comp.opcode		= -1;
 
-	spin_lock_init(&qp->sq.sq_lock);
  	skb_queue_head_init(&qp->req_pkts);
 
  	rxe_init_task(rxe, &qp->req.task, qp,
@@ -284,9 +291,6 @@ static int rxe_qp_init_resp(struct rxe_dev *rxe, struct rxe_qp *qp,
  		}
  	}
 
-	spin_lock_init(&qp->rq.producer_lock);
-	spin_lock_init(&qp->rq.consumer_lock);
-
  	skb_queue_head_init(&qp->resp_pkts);
 
  	rxe_init_task(rxe, &qp->resp.task, qp,
Signature · 1 line
2.34.1
maintainer
#3 lore raw
In reply to [email protected]
Quoted 5 lines · On Tue, Jul 26, 2022 at 12:56:31AM -0400, [email protected] wrote:

From: Zhu Yanjun <[email protected]>

About 7 spin locks in qp creation needs to be initialized. Now these spin locks are initialized in the function rxe_qp_init_misc. This will avoid the error "initialize spin locks before use".

Explain the problem completely please, is this triggered in an error unwind case?

Quoted 1 line
Reported-by [email protected]

This isn't the right format for reported by

Jason

author
#4 lore raw
Quoted 9 lines · Jason Gunthorpe
Quoted 5 lines · On Tue, Jul 26, 2022 at 12:56:31AM -0400, [email protected] wrote:

From: Zhu Yanjun <[email protected]>

About 7 spin locks in qp creation needs to be initialized. Now these spin locks are initialized in the function rxe_qp_init_misc. This will avoid the error "initialize spin locks before use".

Explain the problem completely please, is this triggered in an error unwind case?

I will explain this problem in detail.

Zhu Yanjun

Quoted 6 lines
Quoted 2 lines
Reported-by [email protected]

This isn't the right format for reported by

Jason

author
#5 lore raw
In reply to Jason Gunthorpe
Quoted 10 lines · Jason Gunthorpe
Quoted 5 lines · On Tue, Jul 26, 2022 at 12:56:31AM -0400, [email protected] wrote:

From: Zhu Yanjun <[email protected]>

About 7 spin locks in qp creation needs to be initialized. Now these spin locks are initialized in the function rxe_qp_init_misc. This will avoid the error "initialize spin locks before use".

Explain the problem completely please, is this triggered in an error unwind case?

Quoted 1 line
Reported-by [email protected]

In this link news://nntp.lore.kernel.org:119/[email protected],

"

IMPORTANT: if you fix the issue, please add the following tag to the commit:

Reported-by [email protected]

"
Zhu Yanjun

Quoted 3 lines

This isn't the right format for reported by

Jason