All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCHv3 1/1] RDMA/rxe: Fix qp error handler
@ 2022-07-26  4:56 yanjun.zhu
  2022-07-27  9:16 ` Leon Romanovsky
  2022-07-28 16:38 ` Jason Gunthorpe
  0 siblings, 2 replies; 6+ messages in thread
From: yanjun.zhu @ 2022-07-26  4:56 UTC (permalink / raw)
  To: jgg, leon, linux-rdma, yanjun.zhu; +Cc: syzbot+833061116fa28df97f3b

From: Zhu Yanjun <yanjun.zhu@linux.dev>

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".

Reported-by: syzbot+833061116fa28df97f3b@syzkaller.appspotmail.com
Signed-off-by: Zhu Yanjun <yanjun.zhu@linux.dev>
---
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(-)

diff --git a/drivers/infiniband/sw/rxe/rxe_qp.c b/drivers/infiniband/sw/rxe/rxe_qp.c
index 22e9b85344c3..ae8c51ef2db6 100644
--- a/drivers/infiniband/sw/rxe/rxe_qp.c
+++ b/drivers/infiniband/sw/rxe/rxe_qp.c
@@ -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,
-- 
2.34.1


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

* Re: [PATCHv3 1/1] RDMA/rxe: Fix qp error handler
  2022-07-26  4:56 [PATCHv3 1/1] RDMA/rxe: Fix qp error handler yanjun.zhu
@ 2022-07-27  9:16 ` Leon Romanovsky
  2022-07-27 12:38   ` Yanjun Zhu
  2022-07-28 16:38 ` Jason Gunthorpe
  1 sibling, 1 reply; 6+ messages in thread
From: Leon Romanovsky @ 2022-07-27  9:16 UTC (permalink / raw)
  To: yanjun.zhu; +Cc: jgg, linux-rdma, syzbot+833061116fa28df97f3b

On Tue, Jul 26, 2022 at 12:56:31AM -0400, yanjun.zhu@linux.dev wrote:
> From: Zhu Yanjun <yanjun.zhu@linux.dev>
> 
> 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".
> 
> Reported-by: syzbot+833061116fa28df97f3b@syzkaller.appspotmail.com
> Signed-off-by: Zhu Yanjun <yanjun.zhu@linux.dev>
> ---
> 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?

> 
> diff --git a/drivers/infiniband/sw/rxe/rxe_qp.c b/drivers/infiniband/sw/rxe/rxe_qp.c
> index 22e9b85344c3..ae8c51ef2db6 100644
> --- a/drivers/infiniband/sw/rxe/rxe_qp.c
> +++ b/drivers/infiniband/sw/rxe/rxe_qp.c
> @@ -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,
> -- 
> 2.34.1
> 

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

* Re: [PATCHv3 1/1] RDMA/rxe: Fix qp error handler
  2022-07-27  9:16 ` Leon Romanovsky
@ 2022-07-27 12:38   ` Yanjun Zhu
  0 siblings, 0 replies; 6+ messages in thread
From: Yanjun Zhu @ 2022-07-27 12:38 UTC (permalink / raw)
  To: Leon Romanovsky; +Cc: jgg, linux-rdma, syzbot+833061116fa28df97f3b


在 2022/7/27 17:16, Leon Romanovsky 写道:
> On Tue, Jul 26, 2022 at 12:56:31AM -0400, yanjun.zhu@linux.dev wrote:
>> From: Zhu Yanjun <yanjun.zhu@linux.dev>
>>
>> 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".
>>
>> Reported-by: syzbot+833061116fa28df97f3b@syzkaller.appspotmail.com
>> Signed-off-by: Zhu Yanjun <yanjun.zhu@linux.dev>
>> ---
>> 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

>
>> diff --git a/drivers/infiniband/sw/rxe/rxe_qp.c b/drivers/infiniband/sw/rxe/rxe_qp.c
>> index 22e9b85344c3..ae8c51ef2db6 100644
>> --- a/drivers/infiniband/sw/rxe/rxe_qp.c
>> +++ b/drivers/infiniband/sw/rxe/rxe_qp.c
>> @@ -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,
>> -- 
>> 2.34.1
>>

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

* Re: [PATCHv3 1/1] RDMA/rxe: Fix qp error handler
  2022-07-26  4:56 [PATCHv3 1/1] RDMA/rxe: Fix qp error handler yanjun.zhu
  2022-07-27  9:16 ` Leon Romanovsky
@ 2022-07-28 16:38 ` Jason Gunthorpe
  2022-07-30 13:14   ` Yanjun Zhu
  2022-07-30 14:01   ` Yanjun Zhu
  1 sibling, 2 replies; 6+ messages in thread
From: Jason Gunthorpe @ 2022-07-28 16:38 UTC (permalink / raw)
  To: yanjun.zhu; +Cc: leon, linux-rdma, syzbot+833061116fa28df97f3b

On Tue, Jul 26, 2022 at 12:56:31AM -0400, yanjun.zhu@linux.dev wrote:
> From: Zhu Yanjun <yanjun.zhu@linux.dev>
> 
> 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?
 
> Reported-by: syzbot+833061116fa28df97f3b@syzkaller.appspotmail.com

This isn't the right format for reported by

Jason

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

* Re: [PATCHv3 1/1] RDMA/rxe: Fix qp error handler
  2022-07-28 16:38 ` Jason Gunthorpe
@ 2022-07-30 13:14   ` Yanjun Zhu
  2022-07-30 14:01   ` Yanjun Zhu
  1 sibling, 0 replies; 6+ messages in thread
From: Yanjun Zhu @ 2022-07-30 13:14 UTC (permalink / raw)
  To: Jason Gunthorpe, yanjun.zhu; +Cc: leon, linux-rdma, syzbot+833061116fa28df97f3b

在 2022/7/29 0:38, Jason Gunthorpe 写道:
> On Tue, Jul 26, 2022 at 12:56:31AM -0400, yanjun.zhu@linux.dev wrote:
>> From: Zhu Yanjun <yanjun.zhu@linux.dev>
>>
>> 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

>   
>> Reported-by: syzbot+833061116fa28df97f3b@syzkaller.appspotmail.com
> 
> This isn't the right format for reported by
> 
> Jason


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

* Re: [PATCHv3 1/1] RDMA/rxe: Fix qp error handler
  2022-07-28 16:38 ` Jason Gunthorpe
  2022-07-30 13:14   ` Yanjun Zhu
@ 2022-07-30 14:01   ` Yanjun Zhu
  1 sibling, 0 replies; 6+ messages in thread
From: Yanjun Zhu @ 2022-07-30 14:01 UTC (permalink / raw)
  To: Jason Gunthorpe; +Cc: leon, linux-rdma, syzbot+833061116fa28df97f3b


在 2022/7/29 0:38, Jason Gunthorpe 写道:
> On Tue, Jul 26, 2022 at 12:56:31AM -0400, yanjun.zhu@linux.dev wrote:
>> From: Zhu Yanjun <yanjun.zhu@linux.dev>
>>
>> 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?
>   
>> Reported-by: syzbot+833061116fa28df97f3b@syzkaller.appspotmail.com

In this link 
news://nntp.lore.kernel.org:119/0000000000006ed46805dfaded18@google.com,

"

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by:syzbot+833061116fa28df97f3b@syzkaller.appspotmail.com
"
Zhu Yanjun

> This isn't the right format for reported by
>
> Jason

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

end of thread, other threads:[~2022-07-30 14:02 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-26  4:56 [PATCHv3 1/1] RDMA/rxe: Fix qp error handler yanjun.zhu
2022-07-27  9:16 ` Leon Romanovsky
2022-07-27 12:38   ` Yanjun Zhu
2022-07-28 16:38 ` Jason Gunthorpe
2022-07-30 13:14   ` Yanjun Zhu
2022-07-30 14:01   ` Yanjun Zhu

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.