From: Yuval Shaia <yuval.shaia-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
To: Bryan Tan <bryantan-pghWNbHTmq7QT0dZR+AlfA@public.gmane.org>
Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH v1 for-rc 1/8] RDMA/vmw_pvrdma: Clarify QP and CQ is_kernel logic
Date: Thu, 14 Dec 2017 11:30:17 +0200 [thread overview]
Message-ID: <20171214093016.GB3254@yuvallap> (raw)
In-Reply-To: <20171214001937.GA11378-qXbCdz4EeRo1jLI2hToXVI42T8aCTgcwy4vvyvUx+exJXi8ZT2ovy+oDBWuYMCC/JZORHMmSJCU@public.gmane.org>
On Wed, Dec 13, 2017 at 04:19:43PM -0800, Bryan Tan wrote:
> Be more consistent in setting and checking is_kernel
> flag for QPs and CQs.
>
> Reviewed-by: Adit Ranadive <aditr-pghWNbHTmq7QT0dZR+AlfA@public.gmane.org>
> Reviewed-by: Aditya Sarwade <asarwade-pghWNbHTmq7QT0dZR+AlfA@public.gmane.org>
> Reviewed-by: Jorgen Hansen <jhansen-pghWNbHTmq7QT0dZR+AlfA@public.gmane.org>
> Signed-off-by: Bryan Tan <bryantan-pghWNbHTmq7QT0dZR+AlfA@public.gmane.org>
> ---
> drivers/infiniband/hw/vmw_pvrdma/pvrdma_cq.c | 9 ++++-----
> drivers/infiniband/hw/vmw_pvrdma/pvrdma_qp.c | 7 +++----
> 2 files changed, 7 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/infiniband/hw/vmw_pvrdma/pvrdma_cq.c b/drivers/infiniband/hw/vmw_pvrdma/pvrdma_cq.c
> index 3562c0c..ea8db5e6 100644
> --- a/drivers/infiniband/hw/vmw_pvrdma/pvrdma_cq.c
> +++ b/drivers/infiniband/hw/vmw_pvrdma/pvrdma_cq.c
> @@ -132,8 +132,9 @@ struct ib_cq *pvrdma_create_cq(struct ib_device *ibdev,
> }
>
> cq->ibcq.cqe = entries;
> + cq->is_kernel = !context;
>
> - if (context) {
> + if (!cq->is_kernel) {
> if (ib_copy_from_udata(&ucmd, udata, sizeof(ucmd))) {
> ret = -EFAULT;
> goto err_cq;
> @@ -148,8 +149,6 @@ struct ib_cq *pvrdma_create_cq(struct ib_device *ibdev,
>
> npages = ib_umem_page_count(cq->umem);
> } else {
> - cq->is_kernel = true;
> -
> /* One extra page for shared ring state */
> npages = 1 + (entries * sizeof(struct pvrdma_cqe) +
> PAGE_SIZE - 1) / PAGE_SIZE;
> @@ -202,7 +201,7 @@ struct ib_cq *pvrdma_create_cq(struct ib_device *ibdev,
> dev->cq_tbl[cq->cq_handle % dev->dsr->caps.max_cq] = cq;
> spin_unlock_irqrestore(&dev->cq_tbl_lock, flags);
>
> - if (context) {
> + if (!cq->is_kernel) {
> cq->uar = &(to_vucontext(context)->uar);
>
> /* Copy udata back. */
> @@ -219,7 +218,7 @@ struct ib_cq *pvrdma_create_cq(struct ib_device *ibdev,
> err_page_dir:
> pvrdma_page_dir_cleanup(dev, &cq->pdir);
> err_umem:
> - if (context)
> + if (!cq->is_kernel)
> ib_umem_release(cq->umem);
> err_cq:
> atomic_dec(&dev->num_cqs);
> diff --git a/drivers/infiniband/hw/vmw_pvrdma/pvrdma_qp.c b/drivers/infiniband/hw/vmw_pvrdma/pvrdma_qp.c
> index 10420a1..b932b7e 100644
> --- a/drivers/infiniband/hw/vmw_pvrdma/pvrdma_qp.c
> +++ b/drivers/infiniband/hw/vmw_pvrdma/pvrdma_qp.c
> @@ -249,8 +249,9 @@ struct ib_qp *pvrdma_create_qp(struct ib_pd *pd,
> init_waitqueue_head(&qp->wait);
>
> qp->state = IB_QPS_RESET;
> + qp->is_kernel = !(pd->uobject && udata);
>
> - if (pd->uobject && udata) {
> + if (!qp->is_kernel) {
> dev_dbg(&dev->pdev->dev,
> "create queuepair from user space\n");
>
> @@ -291,8 +292,6 @@ struct ib_qp *pvrdma_create_qp(struct ib_pd *pd,
> qp->npages_recv = 0;
> qp->npages = qp->npages_send + qp->npages_recv;
> } else {
> - qp->is_kernel = true;
> -
> ret = pvrdma_set_sq_size(to_vdev(pd->device),
> &init_attr->cap, qp);
> if (ret)
> @@ -394,7 +393,7 @@ struct ib_qp *pvrdma_create_qp(struct ib_pd *pd,
> err_pdir:
> pvrdma_page_dir_cleanup(dev, &qp->pdir);
> err_umem:
> - if (pd->uobject && udata) {
> + if (!qp->is_kernel) {
> if (qp->rumem)
> ib_umem_release(qp->rumem);
> if (qp->sumem)
> --
> 1.8.5.6
Reviewed-by: Yuval Shaia <yuval.shaia-QHcLZuEGTsvQT0dZR+AlfA@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
--
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:[~2017-12-14 9:30 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-12-14 0:17 [PATCH v1 for-rc 0/8] vmw_pvrdma fixes for 4.15 Bryan Tan
[not found] ` <20171214001753.GA9780-qXbCdz4EeRo1jLI2hToXVI42T8aCTgcwy4vvyvUx+exJXi8ZT2ovy+oDBWuYMCC/JZORHMmSJCU@public.gmane.org>
2017-12-14 0:19 ` [PATCH v1 for-rc 1/8] RDMA/vmw_pvrdma: Clarify QP and CQ is_kernel logic Bryan Tan
[not found] ` <20171214001937.GA11378-qXbCdz4EeRo1jLI2hToXVI42T8aCTgcwy4vvyvUx+exJXi8ZT2ovy+oDBWuYMCC/JZORHMmSJCU@public.gmane.org>
2017-12-14 9:30 ` Yuval Shaia [this message]
2017-12-14 0:21 ` [PATCH v1 for-rc 2/8] RDMA/vmw_pvrdma: Call ib_umem_release on destroy QP path Bryan Tan
[not found] ` <20171214002123.GA13402-qXbCdz4EeRo1jLI2hToXVI42T8aCTgcwy4vvyvUx+exJXi8ZT2ovy+oDBWuYMCC/JZORHMmSJCU@public.gmane.org>
2017-12-14 9:28 ` Yuval Shaia
2017-12-14 0:22 ` [PATCH v1 for-rc 3/8] RDMA/vmw_pvrdma: Use more specific sizeof in kcalloc Bryan Tan
2017-12-14 0:23 ` [PATCH v1 for-rc 4/8] RDMA/vmw_pvrdma: Use refcount_dec_and_test to avoid warning Bryan Tan
2017-12-14 0:24 ` [PATCH v1 for-rc 5/8] RDMA/vmw_pvrdma: Use refcount_t instead of atomic_t Bryan Tan
[not found] ` <20171214002402.GA16082-qXbCdz4EeRo1jLI2hToXVI42T8aCTgcwy4vvyvUx+exJXi8ZT2ovy+oDBWuYMCC/JZORHMmSJCU@public.gmane.org>
2017-12-19 5:32 ` Leon Romanovsky
[not found] ` <20171219053201.GG18894-U/DQcQFIOTAAJjI8aNfphQ@public.gmane.org>
2017-12-20 20:02 ` Bryan Tan
2017-12-14 0:25 ` [PATCH v1 for-rc 6/8] RDMA/vmw_pvrdma: Remove usage of BIT() from UAPI header Bryan Tan
2017-12-14 0:25 ` [PATCH v1 for-rc 7/8] RDMA/vmw_pvrdma: Add UAR SRQ macros in ABI header file Bryan Tan
2017-12-14 0:26 ` [PATCH v1 for-rc 8/8] RDMA/vmw_pvrdma: Use completion instead of wait queue Bryan Tan
2017-12-18 18:25 ` [PATCH v1 for-rc 0/8] vmw_pvrdma fixes for 4.15 Jason Gunthorpe
[not found] ` <20171218182511.GH19070-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2017-12-18 21:42 ` Bryan Tan
[not found] ` <20171218214244.GA19558-qXbCdz4EeRo1jLI2hToXVI42T8aCTgcwy4vvyvUx+exJXi8ZT2ovy+oDBWuYMCC/JZORHMmSJCU@public.gmane.org>
2017-12-18 22:45 ` Jason Gunthorpe
[not found] ` <20171218224519.GI19070-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2017-12-18 23:04 ` Bryan Tan
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=20171214093016.GB3254@yuvallap \
--to=yuval.shaia-qhclzuegtsvqt0dzr+alfa@public.gmane.org \
--cc=bryantan-pghWNbHTmq7QT0dZR+AlfA@public.gmane.org \
--cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@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.