From: "Steve Wise" <swise-7bPotxP6k4+P2YhJcF5u+vpXobYPEAuW@public.gmane.org>
To: 'Sagi Grimberg' <sagi-NQWnxTmZq1alnMjI0IkVqw@public.gmane.org>,
	'Bart Van Assche'
	<bart.vanassche-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>,
	'Doug Ledford' <dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
Cc: 'Christoph Hellwig' <hch-jcswGhMUV9g@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
Subject: RE: [PATCH v2 2/5] IB/core, RDMA RW API: Do not exceed QP SGE send limit
Date: Wed, 13 Jul 2016 09:29:29 -0500	[thread overview]
Message-ID: <002101d1dd12$f6ee0980$e4ca1c80$@opengridcomputing.com> (raw)
In-Reply-To: <578618BD.5080101-NQWnxTmZq1alnMjI0IkVqw@public.gmane.org>
> 
> 
> On 13/07/16 13:18, Bart Van Assche wrote:
> > On 07/13/2016 04:32 PM, Sagi Grimberg wrote:
> >>
> >>> -static inline u32 rdma_rw_max_sge(struct ib_device *dev,
> >>> -        enum dma_data_direction dir)
> >>> -{
> >>> -    return dir == DMA_TO_DEVICE ?
> >>> -        dev->attrs.max_sge : dev->attrs.max_sge_rd;
> >>> -}
> >>> -
> >>
> >> Wait, this looks wrong...
> >>
> >> iWARP devices have max_sge_rd = 1, Steve, did you get to test this?
> >>
> >>>   static inline u32 rdma_rw_fr_page_list_len(struct ib_device *dev)
> >>>   {
> >>>       /* arbitrary limit to avoid allocating gigantic resources */
> >>> @@ -186,7 +179,7 @@ static int rdma_rw_init_map_wrs(struct
> >>> rdma_rw_ctx *ctx, struct ib_qp *qp,
> >>>           u64 remote_addr, u32 rkey, enum dma_data_direction dir)
> >>>   {
> >>>       struct ib_device *dev = qp->pd->device;
> >>> -    u32 max_sge = rdma_rw_max_sge(dev, dir);
> >>> +    u32 max_sge = qp->max_send_sge;
> >>
> >> Here, rdma_read will use qp.max_send_sge = max_sge which is set by the
> >> ULP.
> >>
> >> If the ULP used max(max_sge, max_sge_rd) which is the right thing, then
> >> we get a bug, if the ULP set min(max_sge, max_sge_rd) then it has
> >> effectively a single sge even for writes (which is not good).
> >>
> >> The QP user needs to set the maximum sge allowed for reads or writes,
> >> but for reads use max_sge_rd and for writes use max_sge. Otherwise this
> >> will break.
> >
> > Hello Sagi,
> >
> > How about keeping rdma_rw_max_sge() and using the minimum of
> > qp->max_send_sge and dev->attrs.max_sge_rd for RDMA READs?
> 
> That would work.
I'll be sure and test v3 of this series on cxgb4 (please CC me).
Steve.
--
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-07-13 14:29 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-30 13:46 [PATCH v2 0/5] Reduce RDMA RW API SGE limit Bart Van Assche
     [not found] ` <c9a58bf1-b230-5990-a2b3-4e6aa729cd8f-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>
2016-06-30 13:49   ` [PATCH v2 1/5] IB/core: Make rdma_rw_ctx_init() initialize all used fields Bart Van Assche
     [not found]     ` <5917eaad-10e5-31c3-2b97-78cfcd8065de-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>
2016-07-13  9:22       ` Sagi Grimberg
2016-06-30 13:49   ` [PATCH v2 2/5] IB/core, RDMA RW API: Do not exceed QP SGE send limit Bart Van Assche
     [not found]     ` <7b9f8bca-38fa-b289-a92f-19cf93955e32-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>
2016-07-13  9:23       ` Sagi Grimberg
2016-07-13  9:32       ` Sagi Grimberg
     [not found]         ` <57860AA4.6070303-NQWnxTmZq1alnMjI0IkVqw@public.gmane.org>
2016-07-13 10:18           ` Bart Van Assche
     [not found]             ` <700c95fd-ea9f-e83c-389f-30e1ca846dac-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>
2016-07-13 10:32               ` Sagi Grimberg
     [not found]                 ` <578618BD.5080101-NQWnxTmZq1alnMjI0IkVqw@public.gmane.org>
2016-07-13 14:29                   ` Steve Wise [this message]
2016-07-14  0:26                     ` Bart Van Assche
2016-07-13 14:22           ` Steve Wise
2016-06-30 13:50   ` [PATCH v2 3/5] IB/srpt: Limit the number of SG elements per work request Bart Van Assche
     [not found]     ` <908f9aa5-1afd-2eab-29d8-475626e0db49-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>
2016-07-13  9:27       ` Sagi Grimberg
     [not found]         ` <5786098E.5020305-NQWnxTmZq1alnMjI0IkVqw@public.gmane.org>
2016-07-13  9:33           ` Sagi Grimberg
2016-07-13  9:39           ` Bart Van Assche
2016-06-30 13:51   ` [PATCH v2 4/5] IB/srpt: Simplify srpt_queue_response() Bart Van Assche
2016-06-30 13:51   ` [PATCH v2 5/5] IB/isert: Remove an unused member variable Bart Van Assche
     [not found]     ` <1adf8679-33d8-ef72-7f11-23b4a889d669-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>
2016-07-13 10:33       ` Sagi Grimberg
2016-06-30 13:54   ` [PATCH v2 0/5] Reduce RDMA RW API SGE limit Laurence Oberman
     [not found]     ` <1995455969.2271399.1467294878655.JavaMail.zimbra-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2016-07-01 14:52       ` Laurence Oberman
2016-06-30 14:27   ` Steve Wise
2016-06-30 15:10     ` Bart Van Assche
     [not found]       ` <047e7fc1-841f-963b-7fb5-ef659613c762-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2016-06-30 15:14         ` Steve Wise
2016-07-13 13:18   ` Doug Ledford
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='002101d1dd12$f6ee0980$e4ca1c80$@opengridcomputing.com' \
    --to=swise-7bpotxp6k4+p2yhjcf5u+vpxobypeauw@public.gmane.org \
    --cc=bart.vanassche-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org \
    --cc=dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
    --cc=hch-jcswGhMUV9g@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).