possible core cq bug
If an application creates its cq for DIRECT poll mode using ib_create_cq() instead of ib_alloc_cq(), and then uses ib_drain_qp() to drain its qp, ib_drain_sq/rq() will always hang forever because cq->wc is NULL. IE ib_create_cq() doesn't allocate cq->wc, and ib_alloc_cq() does. Yet the __ib_process_cq() requires cq->wc to actually complete any completions and calling the cqe_done function.
Is this a bug in the CQ core code or the application?
Thanks,
Steve.
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Hi Steve,
Quoted 8 lines
If an application creates its cq for DIRECT poll mode using
ib_create_cq()instead ofib_alloc_cq(), and then usesib_drain_qp()to drain its qp, ib_drain_sq/rq() will always hang forever becausecq->wcis NULL. IEib_create_cq()doesn't allocatecq->wc, andib_alloc_cq()does. Yet the__ib_process_cq()requirescq->wcto actually complete any completions and calling thecqe_donefunction.Is this a bug in the CQ core code or the application?
Take a look in __ib_drain_rq/__ib_drain_sq forcq->poll_ctx == IB_POLL_DIRECT. The drain routine polls
the completion queue from time to time...
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): be658098-28a6-e5a8-cebf-5865096f99ce-NQWnxTmZq1alnMjI0IkVqw@public.gmane.org
Quoted 6 lines
Quoted 6 lines
If an application creates its cq for DIRECT poll mode using
ib_create_cq()instead ofib_alloc_cq(), and then usesib_drain_qp()to drain its qp, ib_drain_sq/rq() will always hang forever becausecq->wcis NULL. IEib_create_cq()doesn't allocatecq->wc, andib_alloc_cq()does. Yet the__ib_process_cq()requirescq->wcto actually complete any completions
Quoted 8 lines
and
Quoted 3 lines
calling the
cqe_donefunction.Is this a bug in the CQ core code or the application?
Take a look in __ib_drain_rq/__ib_drain_sq for
cq->poll_ctx==IB_POLL_DIRECT. The drain routine polls the completion queue from time to time...
Yes, but it ends up calling __ib_process_cq() which doesn't actually poll the CQ because cq->wc is NULL.
Steve.
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 9 lines
Quoted 9 lines
Quoted 6 lines
If an application creates its cq for DIRECT poll mode using
ib_create_cq()instead ofib_alloc_cq(), and then usesib_drain_qp()to drain its qp, ib_drain_sq/rq() will always hang forever becausecq->wcis NULL. IEib_create_cq()doesn't allocatecq->wc, andib_alloc_cq()does. Yet the__ib_process_cq()requirescq->wcto actually complete any completionsand
Quoted 2 lines
calling the
cqe_donefunction.
Quoted 7 lines
Quoted 5 lines
Quoted 1 line
Is this a bug in the CQ core code or the application?
Take a look in __ib_drain_rq/__ib_drain_sq for
cq->poll_ctx==IB_POLL_DIRECT. The drain routine polls the completion queue from time to time...Yes, but it ends up calling
__ib_process_cq()which doesn't actually poll the CQ becausecq->wcis NULL.
Do you mean that the CQ allocation wasn't done with ib_alloc_cq? That indeed would be a bug. We can WARN on it as well so the application will know to allocate its CQ with ib_alloc_cq.
Does something like this makes sense?
--
drivers/infiniband/core/cq.c +1 -1
@@ -69,7 +69,7 @@ static int __ib_process_cq(struct ib_cq *cq, int budget)*/ int ib_process_cq_direct (struct ib_cq *cq,int budget) { -WARN_ON_ONCE (cq->poll_ctx !=IB_POLL_DIRECT ); +WARN_ON_ONCE (cq->poll_ctx !=IB_POLL_DIRECT || !cq->wc);return __ib_process_cq (cq, budget); }
--
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): e7782921-b55a-a628-02d4-874d88049ec5-NQWnxTmZq1alnMjI0IkVqw@public.gmane.org
Quoted 6 lines
Quoted 1 line
Yes, but it ends up calling
__ib_process_cq()which doesn't actually pollthe CQ because
cq->wcis NULL.Do you mean that the CQ allocation wasn't done with
ib_alloc_cq? That indeed would be a bug. We can WARN on it as well so the application will know to allocate its CQ withib_alloc_cq.
Yes, the application used ib_create_cq().
Quoted 3 lines
Does something like this makes sense?
That would at least log the issue, but the thread in ib_drain_qp() will be stuck forever continually blocking for 1/10sec and then polling. Perhaps the drain logic should detect this, and then return?
Is there a reason we don't get rid of ib_create_cq()? Or just make it call ib_alloc_cq()...
Quoted 6 lines
--
drivers/infiniband/core/cq.c +0
-0
drivers/infiniband/core/cq.c static int __ib_process_cq(struct ib_cq *cq, int budget)
Quoted 9 lines
drivers/infiniband/core/cq.c +1
-2@@ -69,7 +69,7 @@ static int __ib_process_cq(struct ib_cq *cq, int budget)*/ int ib_process_cq_direct (struct ib_cq *cq,int budget) { -WARN_ON_ONCE (cq->poll_ctx !=IB_POLL_DIRECT ); +WARN_ON_ONCE (cq->poll_ctx !=IB_POLL_DIRECT || !cq->wc);return __ib_process_cq (cq, budget); } --
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 2 lines
That would at least log the issue, but the thread in
ib_drain_qp()will be stuck forever continually blocking for 1/10sec and then polling. Perhaps the drain logic should detect this, and then return?
I don't think returning is a better choice here..
Quoted 1 line
Is there a reason we don't get rid of
ib_create_cq()? Or just make it callib_alloc_cq()...
We could do that, it also makes sense to me. Thoughts from others? --
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): 456aef15-a5a7-6dc8-478b-9fc7f75ff1fb-NQWnxTmZq1alnMjI0IkVqw@public.gmane.org
Quoted 7 lines
Quoted 2 lines
That would at least log the issue, but the thread in
ib_drain_qp()will bestuck forever continually blocking for 1/10sec and then polling. Perhaps the drain logic should detect this, and then return?
I don't think returning is a better choice here..
Why not?
Quoted 5 lines
Quoted 1 line
Is there a reason we don't get rid of
ib_create_cq()? Or just make it call
ib_alloc_cq()...We could do that, it also makes sense to me. Thoughts from others?
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html