Linux RDMA and InfiniBand development
 help / color / mirror / Atom feed
From: Bob Pearson <rpearsonhpe@gmail.com>
To: yanjun.zhu@linux.dev, jgg@ziepe.ca, leon@kernel.org,
	linux-rdma@vger.kernel.org
Cc: syzbot+833061116fa28df97f3b@syzkaller.appspotmail.com
Subject: Re: [PATCHv2 1/1] RDMA/rxe: Fix qp error handler
Date: Thu, 14 Jul 2022 11:54:08 -0500	[thread overview]
Message-ID: <2faee762-d9d4-f2d0-30ae-cade450d6f71@gmail.com> (raw)
In-Reply-To: <20220710043709.707649-1-yanjun.zhu@linux.dev>

On 7/9/22 23:37, 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>
> ---
>  drivers/infiniband/sw/rxe/rxe_qp.c   | 12 ++++++++----
>  drivers/infiniband/sw/rxe/rxe_task.c |  1 -
>  2 files changed, 8 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/infiniband/sw/rxe/rxe_qp.c b/drivers/infiniband/sw/rxe/rxe_qp.c
> index 8355a5b1cb60..259d8bb15116 100644
> --- a/drivers/infiniband/sw/rxe/rxe_qp.c
> +++ b/drivers/infiniband/sw/rxe/rxe_qp.c
> @@ -172,6 +172,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);
>  }
> @@ -231,7 +239,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,
> @@ -282,9 +289,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,
> diff --git a/drivers/infiniband/sw/rxe/rxe_task.c b/drivers/infiniband/sw/rxe/rxe_task.c
> index 0c4db5bb17d7..77c691570673 100644
> --- a/drivers/infiniband/sw/rxe/rxe_task.c
> +++ b/drivers/infiniband/sw/rxe/rxe_task.c
> @@ -98,7 +98,6 @@ int rxe_init_task(void *obj, struct rxe_task *task,
>  	tasklet_setup(&task->tasklet, rxe_do_task);
>  
>  	task->state = TASK_STATE_START;
> -	spin_lock_init(&task->state_lock);
>  
>  	return 0;
>  }

Zhu,

The task.state_lock spinlocks are an implementation detail of the tasklet code. Seems strange to
move the spin_lock_init() calls up into the qp code for these. This breaks encapsulation. We (HPE)
have a patch coming that extends the tasklet code to support tasklets and/or work queues which allow
steering the work to specific cpus. This gives a significant performance boost for IO intensive
work flows.

The only other issue with this patch is that for xrc QPs, which we don't support yet, the QPs only
have one side implemented and there won't be a reason to do unneeded work. Not a big issue though.

Bob 

  reply	other threads:[~2022-07-14 16:54 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-10  4:37 [PATCHv2 1/1] RDMA/rxe: Fix qp error handler yanjun.zhu
2022-07-14 16:54 ` Bob Pearson [this message]
2022-07-16 10:58   ` Yanjun Zhu

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=2faee762-d9d4-f2d0-30ae-cade450d6f71@gmail.com \
    --to=rpearsonhpe@gmail.com \
    --cc=jgg@ziepe.ca \
    --cc=leon@kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=syzbot+833061116fa28df97f3b@syzkaller.appspotmail.com \
    --cc=yanjun.zhu@linux.dev \
    /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