Re: [PATCH V4 for-next 02/10] IB/core: Introduce Work Queue object and its verbs
From: Yishai Hadas <hidden>
Date: 2016-05-31 16:22:52
On 5/30/2016 11:09 PM, Or Gerlitz wrote:
On Mon, May 23, 2016 at 3:20 PM, Yishai Hadas [off-list ref] wrote:quoted
+int ib_destroy_wq(struct ib_wq *wq) +{ + int err; + struct ib_cq *cq = wq->cq; + struct ib_pd *pd = wq->pd; + + if (atomic_read(&wq->usecnt)) + return -EBUSY; + + err = wq->device->destroy_wq(wq); + if (!err) { + atomic_dec(&pd->usecnt); + atomic_dec(&cq->usecnt); + } + return err;by the reverse unwinding principlequoted
+ atomic_inc(&pd->usecnt); + atomic_inc(&wq_attr->cq->usecnt);-->quoted
+ atomic_dec(&cq->usecnt); + atomic_dec(&pd->usecnt);
The PD and the CQ are two unrelated objects, we are not dealing with locking order so the reverse principle is not required. Look also at ib_create/destroy QP for PD/CQ usage, behavior is the same. -- 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