All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] IB/core: Don't drain the receive queue for srq attached queue-pair
@ 2016-04-26 14:55 Sagi Grimberg
       [not found] ` <1461682538-19647-1-git-send-email-sagi-NQWnxTmZq1alnMjI0IkVqw@public.gmane.org>
  0 siblings, 1 reply; 19+ messages in thread
From: Sagi Grimberg @ 2016-04-26 14:55 UTC (permalink / raw)
  To: linux-rdma-u79uwXL29TY76Z2rM5mHXA; +Cc: Steve Wise, Christoph Hellwig

SRQ attached QPs will fail receive work posts does not
have a receive queue that needs to be drained, the receive
queue is shared.

Fixes: 765d67748bcf ("IB: new common API for draining queues")
Signed-off-by: Sagi Grimberg <sagi-NQWnxTmZq1alnMjI0IkVqw@public.gmane.org>
---
 drivers/infiniband/core/verbs.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/infiniband/core/verbs.c b/drivers/infiniband/core/verbs.c
index 769b000e8360..566bfb31cadb 100644
--- a/drivers/infiniband/core/verbs.c
+++ b/drivers/infiniband/core/verbs.c
@@ -1897,6 +1897,7 @@ EXPORT_SYMBOL(ib_drain_rq);
 void ib_drain_qp(struct ib_qp *qp)
 {
 	ib_drain_sq(qp);
-	ib_drain_rq(qp);
+	if (!qp->srq)
+		ib_drain_rq(qp);
 }
 EXPORT_SYMBOL(ib_drain_qp);
-- 
1.9.1

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

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

* Re: [PATCH] IB/core: Don't drain the receive queue for srq attached queue-pair
       [not found] ` <1461682538-19647-1-git-send-email-sagi-NQWnxTmZq1alnMjI0IkVqw@public.gmane.org>
@ 2016-04-26 15:07   ` Steve Wise
       [not found]     ` <CAB5WxwfAGL2qCe7w6A=mKQ65mwjbKKbp_8qFJFRF6Aj7tE+tLQ@mail.gmail.com>
  2016-04-26 15:46   ` Bart Van Assche
  1 sibling, 1 reply; 19+ messages in thread
From: Steve Wise @ 2016-04-26 15:07 UTC (permalink / raw)
  To: Sagi Grimberg, linux-rdma-u79uwXL29TY76Z2rM5mHXA; +Cc: Christoph Hellwig



On 4/26/2016 9:55 AM, Sagi Grimberg wrote:
> SRQ attached QPs will fail receive work posts does not
> have a receive queue that needs to be drained, the receive
> queue is shared.

NIT: I can't quite parse that sentence.

Maybe something like:

SRQ attached QPs don't have a private RQ and don't need to be drained.



>
> Fixes: 765d67748bcf ("IB: new common API for draining queues")
> Signed-off-by: Sagi Grimberg <sagi-NQWnxTmZq1alnMjI0IkVqw@public.gmane.org>
> ---
>   drivers/infiniband/core/verbs.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/infiniband/core/verbs.c b/drivers/infiniband/core/verbs.c
> index 769b000e8360..566bfb31cadb 100644
> --- a/drivers/infiniband/core/verbs.c
> +++ b/drivers/infiniband/core/verbs.c
> @@ -1897,6 +1897,7 @@ EXPORT_SYMBOL(ib_drain_rq);
>   void ib_drain_qp(struct ib_qp *qp)
>   {
>   	ib_drain_sq(qp);
> -	ib_drain_rq(qp);
> +	if (!qp->srq)
> +		ib_drain_rq(qp);
>   }
>   EXPORT_SYMBOL(ib_drain_qp);

Good catch!

Reviewed-by: Steve Wise <swise-7bPotxP6k4+P2YhJcF5u+vpXobYPEAuW@public.gmane.org>
--
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

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

* Re: [PATCH] IB/core: Don't drain the receive queue for srq attached queue-pair
       [not found]       ` <CAB5WxwfAGL2qCe7w6A=mKQ65mwjbKKbp_8qFJFRF6Aj7tE+tLQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2016-04-26 15:43         ` Christoph Hellwig
       [not found]           ` <20160426154328.GA12398-jcswGhMUV9g@public.gmane.org>
  0 siblings, 1 reply; 19+ messages in thread
From: Christoph Hellwig @ 2016-04-26 15:43 UTC (permalink / raw)
  To: sagi grimberg; +Cc: Steve Wise, linux-rdma-u79uwXL29TY76Z2rM5mHXA

Just curious: what takes care of draining SRQs when we unregister them
after all queues are gone?
--
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

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

* Re: [PATCH] IB/core: Don't drain the receive queue for srq attached queue-pair
       [not found] ` <1461682538-19647-1-git-send-email-sagi-NQWnxTmZq1alnMjI0IkVqw@public.gmane.org>
  2016-04-26 15:07   ` Steve Wise
@ 2016-04-26 15:46   ` Bart Van Assche
       [not found]     ` <571F8D48.4020503-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>
  1 sibling, 1 reply; 19+ messages in thread
From: Bart Van Assche @ 2016-04-26 15:46 UTC (permalink / raw)
  To: Sagi Grimberg, linux-rdma-u79uwXL29TY76Z2rM5mHXA
  Cc: Steve Wise, Christoph Hellwig

On 04/26/2016 07:55 AM, Sagi Grimberg wrote:
> SRQ attached QPs will fail receive work posts does not
> have a receive queue that needs to be drained, the receive
> queue is shared.

The patch itself looks fine to me but the description of this patch is 
very confusing. How about explaining that either an SRQ or an RQ is 
attached to a QP and hence that if an SRQ has been attached that there 
is no RQ attached and hence that it should not be drained?

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

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

* Re: [PATCH] IB/core: Don't drain the receive queue for srq attached queue-pair
       [not found]           ` <20160426154328.GA12398-jcswGhMUV9g@public.gmane.org>
@ 2016-04-26 15:55             ` Chuck Lever
       [not found]               ` <912C9E71-05E3-4ED9-9B41-137E131E3A71-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
  2016-04-26 19:07             ` Sagi Grimberg
  1 sibling, 1 reply; 19+ messages in thread
From: Chuck Lever @ 2016-04-26 15:55 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: sagi grimberg, Steve Wise, linux-rdma-u79uwXL29TY76Z2rM5mHXA


> On Apr 26, 2016, at 11:43 AM, Christoph Hellwig <hch-jcswGhMUV9g@public.gmane.org> wrote:
> 
> Just curious: what takes care of draining SRQs when we unregister them
> after all queues are gone?

Conversely, I would think that a consumer that uses SRQ
would want a similar drain mechanism to guarantee there
are no more posted Receives for the associated QP, and
thus it is safe to destroy it.


--
Chuck Lever



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

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

* Re: [PATCH] IB/core: Don't drain the receive queue for srq attached queue-pair
       [not found]               ` <912C9E71-05E3-4ED9-9B41-137E131E3A71-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
@ 2016-04-26 16:00                 ` Steve Wise
       [not found]                   ` <571F9084.2040506-7bPotxP6k4+P2YhJcF5u+vpXobYPEAuW@public.gmane.org>
  2016-04-26 19:15                 ` Sagi Grimberg
  1 sibling, 1 reply; 19+ messages in thread
From: Steve Wise @ 2016-04-26 16:00 UTC (permalink / raw)
  To: Chuck Lever, Christoph Hellwig
  Cc: sagi grimberg, linux-rdma-u79uwXL29TY76Z2rM5mHXA

On 4/26/2016 10:55 AM, Chuck Lever wrote:
>
>> On Apr 26, 2016, at 11:43 AM, Christoph Hellwig <hch-jcswGhMUV9g@public.gmane.org> wrote:
>>
>> Just curious: what takes care of draining SRQs when we unregister them
>> after all queues are gone?
>
> Conversely, I would think that a consumer that uses SRQ
> would want a similar drain mechanism to guarantee there
> are no more posted Receives for the associated QP, and
> thus it is safe to destroy it.

I don't think there is anything now that handles draining an SRQ, nor 
ensuring a QP's RQEs are completed/consumed from its SRQ when draining 
the QP.  Sounds like work is needed here.

But are there any kernel SRQ consumers at this point?

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

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

* Re: [PATCH] IB/core: Don't drain the receive queue for srq attached queue-pair
       [not found]                   ` <571F9084.2040506-7bPotxP6k4+P2YhJcF5u+vpXobYPEAuW@public.gmane.org>
@ 2016-04-26 16:04                     ` Bart Van Assche
       [not found]                       ` <571F917C.40008-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>
  2016-04-26 19:18                     ` Sagi Grimberg
  1 sibling, 1 reply; 19+ messages in thread
From: Bart Van Assche @ 2016-04-26 16:04 UTC (permalink / raw)
  To: Steve Wise, Chuck Lever, Christoph Hellwig
  Cc: sagi grimberg, linux-rdma-u79uwXL29TY76Z2rM5mHXA

On 04/26/2016 09:00 AM, Steve Wise wrote:
> On 4/26/2016 10:55 AM, Chuck Lever wrote:
>>> On Apr 26, 2016, at 11:43 AM, Christoph Hellwig <hch-jcswGhMUV9g@public.gmane.org> wrote:
>>>
>>> Just curious: what takes care of draining SRQs when we unregister them
>>> after all queues are gone?
>>
>> Conversely, I would think that a consumer that uses SRQ
>> would want a similar drain mechanism to guarantee there
>> are no more posted Receives for the associated QP, and
>> thus it is safe to destroy it.
> 
> I don't think there is anything now that handles draining an SRQ, nor 
> ensuring a QP's RQEs are completed/consumed from its SRQ when draining 
> the QP.  Sounds like work is needed here.
> 
> But are there any kernel SRQ consumers at this point?

I think the following two:

$ git grep -nHE '(ib|rdma)_create_srq' drivers/infiniband/ulp
drivers/infiniband/ulp/ipoib/ipoib_cm.c:1521:	priv->cm.srq = ib_create_srq(priv->pd, &srq_init_attr);
drivers/infiniband/ulp/srpt/ib_srpt.c:2723:	sdev->srq = ib_create_srq(sdev->pd, &srq_attr);

Bart.

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

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

* Re: [PATCH] IB/core: Don't drain the receive queue for srq attached queue-pair
       [not found]                       ` <571F917C.40008-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>
@ 2016-04-26 16:28                         ` Steve Wise
       [not found]                           ` <571F972B.6030904-7bPotxP6k4+P2YhJcF5u+vpXobYPEAuW@public.gmane.org>
  2016-04-26 19:18                         ` Sagi Grimberg
  1 sibling, 1 reply; 19+ messages in thread
From: Steve Wise @ 2016-04-26 16:28 UTC (permalink / raw)
  To: Bart Van Assche, Chuck Lever, Christoph Hellwig
  Cc: sagi grimberg, linux-rdma-u79uwXL29TY76Z2rM5mHXA

On 4/26/2016 11:04 AM, Bart Van Assche wrote:
> On 04/26/2016 09:00 AM, Steve Wise wrote:
>> On 4/26/2016 10:55 AM, Chuck Lever wrote:
>>>> On Apr 26, 2016, at 11:43 AM, Christoph Hellwig <hch-jcswGhMUV9g@public.gmane.org> wrote:
>>>>
>>>> Just curious: what takes care of draining SRQs when we unregister them
>>>> after all queues are gone?
>>>
>>> Conversely, I would think that a consumer that uses SRQ
>>> would want a similar drain mechanism to guarantee there
>>> are no more posted Receives for the associated QP, and
>>> thus it is safe to destroy it.
>>
>> I don't think there is anything now that handles draining an SRQ, nor
>> ensuring a QP's RQEs are completed/consumed from its SRQ when draining
>> the QP.  Sounds like work is needed here.
>>
>> But are there any kernel SRQ consumers at this point?
>
> I think the following two:
>
> $ git grep -nHE '(ib|rdma)_create_srq' drivers/infiniband/ulp
> drivers/infiniband/ulp/ipoib/ipoib_cm.c:1521:	priv->cm.srq = ib_create_srq(priv->pd, &srq_init_attr);
> drivers/infiniband/ulp/srpt/ib_srpt.c:2723:	sdev->srq = ib_create_srq(sdev->pd, &srq_attr);
>
> Bart.

If we make the requirement that the ib_drain_rq() caller must consume 
all completions for all QPs attached to an SRQ if they are outstanding, 
then I think we can modify ib_drain_rq() to post the drain recv WR to 
the SRQ.  It should work, right?

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

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

* Re: [PATCH] IB/core: Don't drain the receive queue for srq attached queue-pair
       [not found]                           ` <571F972B.6030904-7bPotxP6k4+P2YhJcF5u+vpXobYPEAuW@public.gmane.org>
@ 2016-04-26 17:27                             ` Bart Van Assche
       [not found]                               ` <571FA4E5.2030501-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>
  0 siblings, 1 reply; 19+ messages in thread
From: Bart Van Assche @ 2016-04-26 17:27 UTC (permalink / raw)
  To: Steve Wise, Chuck Lever, Christoph Hellwig
  Cc: sagi grimberg, linux-rdma-u79uwXL29TY76Z2rM5mHXA

On 04/26/2016 09:28 AM, Steve Wise wrote:
> On 4/26/2016 11:04 AM, Bart Van Assche wrote:
>> On 04/26/2016 09:00 AM, Steve Wise wrote:
>>> On 4/26/2016 10:55 AM, Chuck Lever wrote:
>>>>> On Apr 26, 2016, at 11:43 AM, Christoph Hellwig <hch-jcswGhMUV9g@public.gmane.org> wrote:
>>>>>
>>>>> Just curious: what takes care of draining SRQs when we unregister them
>>>>> after all queues are gone?
>>>>
>>>> Conversely, I would think that a consumer that uses SRQ
>>>> would want a similar drain mechanism to guarantee there
>>>> are no more posted Receives for the associated QP, and
>>>> thus it is safe to destroy it.
>>>
>>> I don't think there is anything now that handles draining an SRQ, nor
>>> ensuring a QP's RQEs are completed/consumed from its SRQ when draining
>>> the QP.  Sounds like work is needed here.
>>>
>>> But are there any kernel SRQ consumers at this point?
>>
>> I think the following two:
>>
>> $ git grep -nHE '(ib|rdma)_create_srq' drivers/infiniband/ulp
>> drivers/infiniband/ulp/ipoib/ipoib_cm.c:1521:    priv->cm.srq =
>> ib_create_srq(priv->pd, &srq_init_attr);
>> drivers/infiniband/ulp/srpt/ib_srpt.c:2723:    sdev->srq =
>> ib_create_srq(sdev->pd, &srq_attr);
>
> If we make the requirement that the ib_drain_rq() caller must consume
> all completions for all QPs attached to an SRQ if they are outstanding,
> then I think we can modify ib_drain_rq() to post the drain recv WR to
> the SRQ.  It should work, right?

At least the ib_srpt driver already guarantees that no further receive 
completions will be generated before ib_destroy_qp() is called. But 
posting an additional receive WR on the SRQ from inside ib_drain_rq() 
shouldn't hurt.

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

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

* Re: [PATCH] IB/core: Don't drain the receive queue for srq attached queue-pair
       [not found]                               ` <571FA4E5.2030501-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>
@ 2016-04-26 17:35                                 ` Steve Wise
       [not found]                                   ` <571FA6D5.2060607-7bPotxP6k4+P2YhJcF5u+vpXobYPEAuW@public.gmane.org>
  2016-04-26 19:20                                 ` Sagi Grimberg
  1 sibling, 1 reply; 19+ messages in thread
From: Steve Wise @ 2016-04-26 17:35 UTC (permalink / raw)
  To: Bart Van Assche, Chuck Lever, Christoph Hellwig
  Cc: sagi grimberg, linux-rdma-u79uwXL29TY76Z2rM5mHXA

On 4/26/2016 12:27 PM, Bart Van Assche wrote:
>>>>> Conversely, I would think that a consumer that uses SRQ
>>>>> would want a similar drain mechanism to guarantee there
>>>>> are no more posted Receives for the associated QP, and
>>>>> thus it is safe to destroy it.
>>>>
>>>> I don't think there is anything now that handles draining an SRQ, nor
>>>> ensuring a QP's RQEs are completed/consumed from its SRQ when draining
>>>> the QP.  Sounds like work is needed here.
>>>>
>>>> But are there any kernel SRQ consumers at this point?
>>>
>>> I think the following two:
>>>
>>> $ git grep -nHE '(ib|rdma)_create_srq' drivers/infiniband/ulp
>>> drivers/infiniband/ulp/ipoib/ipoib_cm.c:1521:    priv->cm.srq =
>>> ib_create_srq(priv->pd, &srq_init_attr);
>>> drivers/infiniband/ulp/srpt/ib_srpt.c:2723:    sdev->srq =
>>> ib_create_srq(sdev->pd, &srq_attr);
>>
>> If we make the requirement that the ib_drain_rq() caller must consume
>> all completions for all QPs attached to an SRQ if they are outstanding,
>> then I think we can modify ib_drain_rq() to post the drain recv WR to
>> the SRQ.  It should work, right?
>
> At least the ib_srpt driver already guarantees that no further receive
> completions will be generated before ib_destroy_qp() is called. But
> posting an additional receive WR on the SRQ from inside ib_drain_rq()
> shouldn't hurt.

Actually, after thinking more about this, posting anything to the SRQ 
will not force it to complete.  The only reason that works for a QP with 
an RQ is that the QP is in ERR state and thus the RECV WR gets completed 
with FLUSHED status.

So SRQ drain would require some other method...

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

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

* Re: [PATCH] IB/core: Don't drain the receive queue for srq attached queue-pair
       [not found]           ` <20160426154328.GA12398-jcswGhMUV9g@public.gmane.org>
  2016-04-26 15:55             ` Chuck Lever
@ 2016-04-26 19:07             ` Sagi Grimberg
  1 sibling, 0 replies; 19+ messages in thread
From: Sagi Grimberg @ 2016-04-26 19:07 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: Steve Wise, linux-rdma-u79uwXL29TY76Z2rM5mHXA

Hi Christoph,

> Just curious: what takes care of draining SRQs when we unregister them
> after all queues are gone?

So unlike QPs, we can (and probably should) destroy SRQs after
destroying the CQs and that's a sufficient barrier to destroy the SRQs.
--
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

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

* Re: [PATCH] IB/core: Don't drain the receive queue for srq attached queue-pair
       [not found]     ` <571F8D48.4020503-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>
@ 2016-04-26 19:11       ` Sagi Grimberg
       [not found]         ` <571FBD4B.2030102-NQWnxTmZq1alnMjI0IkVqw@public.gmane.org>
  0 siblings, 1 reply; 19+ messages in thread
From: Sagi Grimberg @ 2016-04-26 19:11 UTC (permalink / raw)
  To: Bart Van Assche, linux-rdma-u79uwXL29TY76Z2rM5mHXA
  Cc: Steve Wise, Christoph Hellwig


>> SRQ attached QPs will fail receive work posts does not
>> have a receive queue that needs to be drained, the receive
>> queue is shared.
>
> The patch itself looks fine to me but the description of this patch is
> very confusing.

Sorry for the poor change log :) I was in a hurry (just now got back)
and quickly wrote description and sent out the patch without giving the
phrasing any thought.

> How about explaining that either an SRQ or an RQ is
> attached to a QP and hence that if an SRQ has been attached that there
> is no RQ attached and hence that it should not be drained?

I'll send out a better description, thanks.
--
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

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

* Re: [PATCH] IB/core: Don't drain the receive queue for srq attached queue-pair
       [not found]               ` <912C9E71-05E3-4ED9-9B41-137E131E3A71-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
  2016-04-26 16:00                 ` Steve Wise
@ 2016-04-26 19:15                 ` Sagi Grimberg
  1 sibling, 0 replies; 19+ messages in thread
From: Sagi Grimberg @ 2016-04-26 19:15 UTC (permalink / raw)
  To: Chuck Lever, Christoph Hellwig
  Cc: Steve Wise, linux-rdma-u79uwXL29TY76Z2rM5mHXA


>> Just curious: what takes care of draining SRQs when we unregister them
>> after all queues are gone?
>
> Conversely, I would think that a consumer that uses SRQ
> would want a similar drain mechanism to guarantee there
> are no more posted Receives for the associated QP, and
> thus it is safe to destroy it.

Umm, not sure if that is completely true.

The consumer that uses a SRQ will usually detach the recv buffers and
contexts from the session/connection so I'm not sure if the consumer
will want/need a similar drain mechanism.

Also, there is no draining a SRQ, it doesn't move to ERROR state
and the (shared) receive completions are coming only from incoming
receives (no FLUSH errors).
--
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

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

* Re: [PATCH] IB/core: Don't drain the receive queue for srq attached queue-pair
       [not found]                   ` <571F9084.2040506-7bPotxP6k4+P2YhJcF5u+vpXobYPEAuW@public.gmane.org>
  2016-04-26 16:04                     ` Bart Van Assche
@ 2016-04-26 19:18                     ` Sagi Grimberg
  1 sibling, 0 replies; 19+ messages in thread
From: Sagi Grimberg @ 2016-04-26 19:18 UTC (permalink / raw)
  To: Steve Wise, Chuck Lever, Christoph Hellwig
  Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA


>>> On Apr 26, 2016, at 11:43 AM, Christoph Hellwig <hch-jcswGhMUV9g@public.gmane.org> wrote:
>>>
>>> Just curious: what takes care of draining SRQs when we unregister them
>>> after all queues are gone?
>>
>> Conversely, I would think that a consumer that uses SRQ
>> would want a similar drain mechanism to guarantee there
>> are no more posted Receives for the associated QP, and
>> thus it is safe to destroy it.
>
> I don't think there is anything now that handles draining an SRQ, nor
> ensuring a QP's RQEs are completed/consumed from its SRQ when draining
> the QP.

There is no "QP's RQEs" in s SRQ, this is a misconception.
A SRQ is just a bunch of receive buffers. The QP is assigned
and completion time (when the incoming recv is processed).
--
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

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

* Re: [PATCH] IB/core: Don't drain the receive queue for srq attached queue-pair
       [not found]                       ` <571F917C.40008-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>
  2016-04-26 16:28                         ` Steve Wise
@ 2016-04-26 19:18                         ` Sagi Grimberg
  1 sibling, 0 replies; 19+ messages in thread
From: Sagi Grimberg @ 2016-04-26 19:18 UTC (permalink / raw)
  To: Bart Van Assche, Steve Wise, Chuck Lever, Christoph Hellwig
  Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA


>>>> On Apr 26, 2016, at 11:43 AM, Christoph Hellwig <hch-jcswGhMUV9g@public.gmane.org> wrote:
>>>>
>>>> Just curious: what takes care of draining SRQs when we unregister them
>>>> after all queues are gone?
>>>
>>> Conversely, I would think that a consumer that uses SRQ
>>> would want a similar drain mechanism to guarantee there
>>> are no more posted Receives for the associated QP, and
>>> thus it is safe to destroy it.
>>
>> I don't think there is anything now that handles draining an SRQ, nor
>> ensuring a QP's RQEs are completed/consumed from its SRQ when draining
>> the QP.  Sounds like work is needed here.
>>
>> But are there any kernel SRQ consumers at this point?
>
> I think the following two:
>
> $ git grep -nHE '(ib|rdma)_create_srq' drivers/infiniband/ulp
> drivers/infiniband/ulp/ipoib/ipoib_cm.c:1521:	priv->cm.srq = ib_create_srq(priv->pd, &srq_init_attr);
> drivers/infiniband/ulp/srpt/ib_srpt.c:2723:	sdev->srq = ib_create_srq(sdev->pd, &srq_attr);

And the nvme-fabrics one has a SRQ mode.
--
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

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

* Re: [PATCH] IB/core: Don't drain the receive queue for srq attached queue-pair
       [not found]                               ` <571FA4E5.2030501-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>
  2016-04-26 17:35                                 ` Steve Wise
@ 2016-04-26 19:20                                 ` Sagi Grimberg
  1 sibling, 0 replies; 19+ messages in thread
From: Sagi Grimberg @ 2016-04-26 19:20 UTC (permalink / raw)
  To: Bart Van Assche, Steve Wise, Chuck Lever, Christoph Hellwig
  Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA


>> If we make the requirement that the ib_drain_rq() caller must consume
>> all completions for all QPs attached to an SRQ if they are outstanding,
>> then I think we can modify ib_drain_rq() to post the drain recv WR to
>> the SRQ.  It should work, right?

That won't work because it won't FLUSH (SRQ is stateless and does not
FLUSH errors).

> At least the ib_srpt driver already guarantees that no further receive
> completions will be generated before ib_destroy_qp() is called. But
> posting an additional receive WR on the SRQ from inside ib_drain_rq()
> shouldn't hurt.

It doesn't have any meaning either...
--
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

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

* Re: [PATCH] IB/core: Don't drain the receive queue for srq attached queue-pair
       [not found]                                   ` <571FA6D5.2060607-7bPotxP6k4+P2YhJcF5u+vpXobYPEAuW@public.gmane.org>
@ 2016-04-26 19:24                                     ` Sagi Grimberg
       [not found]                                       ` <571FC051.7020009-NQWnxTmZq1alnMjI0IkVqw@public.gmane.org>
  0 siblings, 1 reply; 19+ messages in thread
From: Sagi Grimberg @ 2016-04-26 19:24 UTC (permalink / raw)
  To: Steve Wise, Bart Van Assche, Chuck Lever, Christoph Hellwig
  Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA


> Actually, after thinking more about this, posting anything to the SRQ
> will not force it to complete.  The only reason that works for a QP with
> an RQ is that the QP is in ERR state and thus the RECV WR gets completed
> with FLUSHED status.

Exactly...

> So SRQ drain would require some other method...

I still don't understand the meaning of draining a SRQ.
There are no QP associated post recvs, the QP and contexts
(wc->qp) are assigned at completion processing time. When
we have a SRQ the recv contexts are not bound to a
session/connection/QP...

Can you well-define what are you trying to do?
--
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

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

* Re: [PATCH] IB/core: Don't drain the receive queue for srq attached queue-pair
       [not found]                                       ` <571FC051.7020009-NQWnxTmZq1alnMjI0IkVqw@public.gmane.org>
@ 2016-04-26 19:25                                         ` Steve Wise
  0 siblings, 0 replies; 19+ messages in thread
From: Steve Wise @ 2016-04-26 19:25 UTC (permalink / raw)
  To: Sagi Grimberg, Bart Van Assche, Chuck Lever, Christoph Hellwig
  Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA

On 4/26/2016 2:24 PM, Sagi Grimberg wrote:
>
>> Actually, after thinking more about this, posting anything to the SRQ
>> will not force it to complete.  The only reason that works for a QP with
>> an RQ is that the QP is in ERR state and thus the RECV WR gets completed
>> with FLUSHED status.
>
> Exactly...
>
>> So SRQ drain would require some other method...
>
> I still don't understand the meaning of draining a SRQ.
> There are no QP associated post recvs, the QP and contexts
> (wc->qp) are assigned at completion processing time. When
> we have a SRQ the recv contexts are not bound to a
> session/connection/QP...
>
> Can you well-define what are you trying to do?

Answer Christoph's question. :)

I'll climb out of my rat hole now... :D:D:D


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

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

* Re: [PATCH] IB/core: Don't drain the receive queue for srq attached queue-pair
       [not found]         ` <571FBD4B.2030102-NQWnxTmZq1alnMjI0IkVqw@public.gmane.org>
@ 2016-04-26 20:06           ` Doug Ledford
  0 siblings, 0 replies; 19+ messages in thread
From: Doug Ledford @ 2016-04-26 20:06 UTC (permalink / raw)
  To: Sagi Grimberg, Bart Van Assche, linux-rdma-u79uwXL29TY76Z2rM5mHXA
  Cc: Steve Wise, Christoph Hellwig


[-- Attachment #1.1: Type: text/plain, Size: 887 bytes --]

On 4/26/2016 3:11 PM, Sagi Grimberg wrote:
> 
>>> SRQ attached QPs will fail receive work posts does not
>>> have a receive queue that needs to be drained, the receive
>>> queue is shared.
>>
>> The patch itself looks fine to me but the description of this patch is
>> very confusing.
> 
> Sorry for the poor change log :) I was in a hurry (just now got back)
> and quickly wrote description and sent out the patch without giving the
> phrasing any thought.
> 
>> How about explaining that either an SRQ or an RQ is
>> attached to a QP and hence that if an SRQ has been attached that there
>> is no RQ attached and hence that it should not be drained?
> 
> I'll send out a better description, thanks.

I already picked the patch up and reworded the description myself.  See
if you are happy with it.  If not, I'll reword it again before sending a
pull request.



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 884 bytes --]

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

end of thread, other threads:[~2016-04-26 20:06 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-04-26 14:55 [PATCH] IB/core: Don't drain the receive queue for srq attached queue-pair Sagi Grimberg
     [not found] ` <1461682538-19647-1-git-send-email-sagi-NQWnxTmZq1alnMjI0IkVqw@public.gmane.org>
2016-04-26 15:07   ` Steve Wise
     [not found]     ` <CAB5WxwfAGL2qCe7w6A=mKQ65mwjbKKbp_8qFJFRF6Aj7tE+tLQ@mail.gmail.com>
     [not found]       ` <CAB5WxwfAGL2qCe7w6A=mKQ65mwjbKKbp_8qFJFRF6Aj7tE+tLQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-04-26 15:43         ` Christoph Hellwig
     [not found]           ` <20160426154328.GA12398-jcswGhMUV9g@public.gmane.org>
2016-04-26 15:55             ` Chuck Lever
     [not found]               ` <912C9E71-05E3-4ED9-9B41-137E131E3A71-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
2016-04-26 16:00                 ` Steve Wise
     [not found]                   ` <571F9084.2040506-7bPotxP6k4+P2YhJcF5u+vpXobYPEAuW@public.gmane.org>
2016-04-26 16:04                     ` Bart Van Assche
     [not found]                       ` <571F917C.40008-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>
2016-04-26 16:28                         ` Steve Wise
     [not found]                           ` <571F972B.6030904-7bPotxP6k4+P2YhJcF5u+vpXobYPEAuW@public.gmane.org>
2016-04-26 17:27                             ` Bart Van Assche
     [not found]                               ` <571FA4E5.2030501-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>
2016-04-26 17:35                                 ` Steve Wise
     [not found]                                   ` <571FA6D5.2060607-7bPotxP6k4+P2YhJcF5u+vpXobYPEAuW@public.gmane.org>
2016-04-26 19:24                                     ` Sagi Grimberg
     [not found]                                       ` <571FC051.7020009-NQWnxTmZq1alnMjI0IkVqw@public.gmane.org>
2016-04-26 19:25                                         ` Steve Wise
2016-04-26 19:20                                 ` Sagi Grimberg
2016-04-26 19:18                         ` Sagi Grimberg
2016-04-26 19:18                     ` Sagi Grimberg
2016-04-26 19:15                 ` Sagi Grimberg
2016-04-26 19:07             ` Sagi Grimberg
2016-04-26 15:46   ` Bart Van Assche
     [not found]     ` <571F8D48.4020503-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>
2016-04-26 19:11       ` Sagi Grimberg
     [not found]         ` <571FBD4B.2030102-NQWnxTmZq1alnMjI0IkVqw@public.gmane.org>
2016-04-26 20:06           ` Doug Ledford

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.