From: Christoph Hellwig <hch-jcswGhMUV9g@public.gmane.org>
To: Bart Van Assche <bart.vanassche-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>
Cc: Doug Ledford <dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>,
Christoph Hellwig <hch-jcswGhMUV9g@public.gmane.org>,
Sagi Grimberg <sagi-NQWnxTmZq1alnMjI0IkVqw@public.gmane.org>,
"Nicholas A. Bellinger"
<nab-IzHhD5pYlfBP7FQvKIMDCQ@public.gmane.org>,
Parav Pandit
<pandit.parav-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
Laurence Oberman
<loberman-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>,
"linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
<linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
Subject: Re: [PATCH 1/5] IB/core: Make rdma_rw_ctx_init() initialize all used fields
Date: Tue, 28 Jun 2016 13:51:05 +0200 [thread overview]
Message-ID: <20160628115105.GA28113@lst.de> (raw)
In-Reply-To: <91e53f7b-fdb6-bd66-ada6-982c641c2048-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>
On Tue, Jun 28, 2016 at 01:25:15PM +0200, Bart Van Assche wrote:
> Some but not all callers of rdma_rw_ctx_init() zero-initialize
> struct rdma_rw_ctx. Hence make rdma_rw_ctx_init() initialize all
> work request fields that will be read by ib_post_send().
>
> Fixes: b99f8e4d7bcd ("IB/srpt: convert to the generic RDMA READ/WRITE API")
> Signed-off-by: Bart Van Assche <bart.vanassche-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>
> Cc: <stable-u79uwXL29TY76Z2rM5mHXA@public.gmane.org> #v4.7+
> Cc: Christoph Hellwig <hch-jcswGhMUV9g@public.gmane.org>
> Cc: Sagi Grimberg <sagi-NQWnxTmZq1alnMjI0IkVqw@public.gmane.org>
> Cc: Nicholas Bellinger <nab-IzHhD5pYlfBP7FQvKIMDCQ@public.gmane.org>
> Cc: Parav Pandit <pandit.parav-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> Cc: Laurence Oberman <loberman-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
> ---
> drivers/infiniband/core/rw.c | 14 +++++++++-----
> 1 file changed, 9 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/infiniband/core/rw.c b/drivers/infiniband/core/rw.c
> index 1eb9b12..13d4067 100644
> --- a/drivers/infiniband/core/rw.c
> +++ b/drivers/infiniband/core/rw.c
> @@ -99,6 +99,7 @@ static int rdma_rw_init_one_mr(struct ib_qp *qp, u8 port_num,
> }
>
> reg->reg_wr.wr.opcode = IB_WR_REG_MR;
> + reg->reg_wr.wr.next = NULL;
This one is always set up by the callers of the function.
> @@ -114,6 +115,7 @@ static int rdma_rw_init_mr_wrs(struct rdma_rw_ctx *ctx, struct ib_qp *qp,
> u8 port_num, struct scatterlist *sg, u32 sg_cnt, u32 offset,
> u64 remote_addr, u32 rkey, enum dma_data_direction dir)
> {
> + struct rdma_rw_reg_ctx *prev = NULL;
> u32 pages_per_mr = rdma_rw_fr_page_list_len(qp->pd->device);
> int i, j, ret = 0, count = 0;
>
> @@ -125,7 +127,6 @@ static int rdma_rw_init_mr_wrs(struct rdma_rw_ctx *ctx, struct ib_qp *qp,
> }
>
> for (i = 0; i < ctx->nr_ops; i++) {
> - struct rdma_rw_reg_ctx *prev = i ? &ctx->reg[i - 1] : NULL;
> struct rdma_rw_reg_ctx *reg = &ctx->reg[i];
> u32 nents = min(sg_cnt, pages_per_mr);
>
> @@ -162,9 +163,13 @@ static int rdma_rw_init_mr_wrs(struct rdma_rw_ctx *ctx, struct ib_qp *qp,
> sg_cnt -= nents;
> for (j = 0; j < nents; j++)
> sg = sg_next(sg);
> + prev = reg;
> offset = 0;
> }
>
> + if (prev)
> + prev->wr.wr.next = NULL;
> +
> ctx->type = RDMA_RW_MR;
> return count;
I think the right fix here is to set last_wr->next to NULL for
the !chain_wr case in rdma_rw_ctx_wrs, or in fact maybe just simplify
the end of rdma_rw_ctx_wrs to:
last_wr->next = chain_wr;
if (!chain_wr) {
last_wr->wr_cqe = cqe;
last_wr->send_flags |= IB_SEND_SIGNALED;
}
> @@ -205,11 +210,10 @@ static int rdma_rw_init_map_wrs(struct rdma_rw_ctx *ctx, struct ib_qp *qp,
> rdma_wr->wr.opcode = IB_WR_RDMA_READ;
> rdma_wr->remote_addr = remote_addr + total_len;
> rdma_wr->rkey = rkey;
> + rdma_wr->wr.num_sge = nr_sge;
> rdma_wr->wr.sg_list = sge;
>
> for (j = 0; j < nr_sge; j++, sg = sg_next(sg)) {
> - rdma_wr->wr.num_sge++;
> -
This parts looks fine.
> - if (i + 1 < ctx->nr_ops)
> - rdma_wr->wr.next = &ctx->map.wrs[i + 1].wr;
> + rdma_wr->wr.next = i + 1 < ctx->nr_ops ?
> + &ctx->map.wrs[i + 1].wr : NULL;
I think the rdma_rw_ctx_wrs should take care of this as well.
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2016-06-28 11:51 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-28 11:23 [PATCH 0/5] Make RDMA RW API SGE limit configurable Bart Van Assche
[not found] ` <419391ba-0c39-11ce-f249-84b428dc73d5-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>
2016-06-28 11:25 ` [PATCH 1/5] IB/core: Make rdma_rw_ctx_init() initialize all used fields Bart Van Assche
[not found] ` <91e53f7b-fdb6-bd66-ada6-982c641c2048-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>
2016-06-28 11:51 ` Christoph Hellwig [this message]
[not found] ` <20160628115105.GA28113-jcswGhMUV9g@public.gmane.org>
2016-06-28 13:04 ` Bart Van Assche
2016-06-28 11:26 ` [PATCH 2/5] IB/core: Add max_sge argument to rdma_rw_ctx_init() Bart Van Assche
[not found] ` <ce96b1f4-e9b9-31e2-f9d2-77e71f8bbcd1-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>
2016-06-28 11:52 ` Christoph Hellwig
[not found] ` <20160628115206.GB28113-jcswGhMUV9g@public.gmane.org>
2016-06-28 12:37 ` Bart Van Assche
[not found] ` <7fbd81ae-4b0d-4f8b-18ac-7efcf0dd4d61-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>
2016-06-28 15:42 ` Christoph Hellwig
[not found] ` <20160628154235.GA2843-jcswGhMUV9g@public.gmane.org>
2016-06-28 16:12 ` Bart Van Assche
2016-06-28 11:26 ` [PATCH 3/5] IB/isert: Limit the number of SG elements per work request Bart Van Assche
[not found] ` <885f39a6-9d75-9999-d582-e403f072bec1-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>
2016-06-28 14:28 ` Steve Wise
2016-06-28 14:58 ` Bart Van Assche
[not found] ` <74522811-15d7-41a2-d704-96083199454f-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>
2016-06-28 15:01 ` Steve Wise
2016-06-28 14:33 ` Steve Wise
2016-06-28 15:03 ` Bart Van Assche
[not found] ` <6e513522-6b06-d942-bddd-cc00f9a32f44-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>
2016-06-28 15:09 ` Steve Wise
2016-06-28 18:41 ` Bart Van Assche
[not found] ` <9e8c6a52-3bf9-6b3f-1f36-d77205cb3ee0-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>
2016-06-28 19:13 ` Steve Wise
2016-06-30 13:47 ` Bart Van Assche
2016-06-28 15:46 ` Christoph Hellwig
[not found] ` <20160628154618.GB2843-jcswGhMUV9g@public.gmane.org>
2016-06-28 16:11 ` Bart Van Assche
2016-06-28 11:28 ` [PATCH 4/5] IB/srpt: " Bart Van Assche
2016-06-28 11:29 ` [PATCH 5/5] IB/srpt: Simplify srpt_queue_response() Bart Van Assche
[not found] ` <8457ca4e-0359-687f-e078-76979adf54c3-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>
2016-06-28 11:52 ` Christoph Hellwig
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=20160628115105.GA28113@lst.de \
--to=hch-jcswghmuv9g@public.gmane.org \
--cc=bart.vanassche-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org \
--cc=dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
--cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=loberman-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
--cc=nab-IzHhD5pYlfBP7FQvKIMDCQ@public.gmane.org \
--cc=pandit.parav-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=sagi-NQWnxTmZq1alnMjI0IkVqw@public.gmane.org \
/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 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.