linux-rdma.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* RE: [PATCH for-next] RDMA/qedr: Remove unsupported qedr_resize_cq callback
@ 2021-10-25  9:24 Prabhakar Kushwaha
  2021-10-25 10:06 ` Kamal Heib
  2021-10-25 14:27 ` Jason Gunthorpe
  0 siblings, 2 replies; 6+ messages in thread
From: Prabhakar Kushwaha @ 2021-10-25  9:24 UTC (permalink / raw)
  To: linux-rdma, kamalheib1
  Cc: Michal Kalderon, dledford, jgg, Ariel Elior, Alok Prasad

Dear Kamal,
 
> -----Original Message-----
> From: Kamal Heib <kamalheib1@gmail.com>
> Sent: Monday, October 25, 2021 9:27 AM
> To: linux-rdma@vger.kernel.org
> Cc: Michal Kalderon <mkalderon@marvell.com>; Ariel Elior
> <aelior@marvell.com>; Doug Ledford <dledford@redhat.com>; Jason
> Gunthorpe <jgg@ziepe.ca>; Kamal Heib <kamalheib1@gmail.com>
> Subject:  [PATCH for-next] RDMA/qedr: Remove unsupported
> qedr_resize_cq callback
> 
> External Email
> 
> ----------------------------------------------------------------------
> There is no need to return always zero for function which is not supported.
> 
> Fixes: a7efd7773e31 ("qedr: Add support for PD,PKEY and CQ verbs")
> Signed-off-by: Kamal Heib <kamalheib1@gmail.com>
> ---
>  drivers/infiniband/hw/qedr/main.c  |  1 -  drivers/infiniband/hw/qedr/verbs.c |
> 10 ----------  drivers/infiniband/hw/qedr/verbs.h |  1 -
>  3 files changed, 12 deletions(-)

Have you tested this patch? I afraid, there may be a crash because of  this 

static int ib_uverbs_resize_cq(struct uverbs_attr_bundle *attrs)
{
<snip>

        cq = uobj_get_obj_read(cq, UVERBS_OBJECT_CQ, cmd.cq_handle, attrs);
        if (!cq)
                return -EINVAL;

        ret = cq->device->ops.resize_cq(cq, cmd.cqe, &attrs->driver_udata);    <<<< No check for NULL.


--pk


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

* Re: [PATCH for-next] RDMA/qedr: Remove unsupported qedr_resize_cq callback
  2021-10-25  9:24 [PATCH for-next] RDMA/qedr: Remove unsupported qedr_resize_cq callback Prabhakar Kushwaha
@ 2021-10-25 10:06 ` Kamal Heib
  2021-10-25 10:54   ` [EXT] " Prabhakar Kushwaha
  2021-10-25 14:27 ` Jason Gunthorpe
  1 sibling, 1 reply; 6+ messages in thread
From: Kamal Heib @ 2021-10-25 10:06 UTC (permalink / raw)
  To: Prabhakar Kushwaha
  Cc: linux-rdma, Michal Kalderon, dledford, jgg, Ariel Elior, Alok Prasad

On Mon, Oct 25, 2021 at 09:24:41AM +0000, Prabhakar Kushwaha wrote:
> Dear Kamal,
> 

Hi Prabhakar,

> > -----Original Message-----
> > From: Kamal Heib <kamalheib1@gmail.com>
> > Sent: Monday, October 25, 2021 9:27 AM
> > To: linux-rdma@vger.kernel.org
> > Cc: Michal Kalderon <mkalderon@marvell.com>; Ariel Elior
> > <aelior@marvell.com>; Doug Ledford <dledford@redhat.com>; Jason
> > Gunthorpe <jgg@ziepe.ca>; Kamal Heib <kamalheib1@gmail.com>
> > Subject:  [PATCH for-next] RDMA/qedr: Remove unsupported
> > qedr_resize_cq callback
> > 
> > External Email
> > 
> > ----------------------------------------------------------------------
> > There is no need to return always zero for function which is not supported.
> > 
> > Fixes: a7efd7773e31 ("qedr: Add support for PD,PKEY and CQ verbs")
> > Signed-off-by: Kamal Heib <kamalheib1@gmail.com>
> > ---
> >  drivers/infiniband/hw/qedr/main.c  |  1 -  drivers/infiniband/hw/qedr/verbs.c |
> > 10 ----------  drivers/infiniband/hw/qedr/verbs.h |  1 -
> >  3 files changed, 12 deletions(-)
> 
> Have you tested this patch? I afraid, there may be a crash because of  this 
>

I do not think that we will face a crash, because the libqedr in the
rdma-core package dose not implement the resize_cq() callback.

Furthermore, if there is a bug in the kernel rdma core this doesn't mean
that the qedr driver need to fake supporting resize_cq() to avoid a crash!.

Anyway, To be in the safe side we I'll prepare another patch that checks
for NULL in the core and return -EOPNOTSUPP if resize_cq() is not set
by the driver.


> static int ib_uverbs_resize_cq(struct uverbs_attr_bundle *attrs)
> {
> <snip>
> 
>         cq = uobj_get_obj_read(cq, UVERBS_OBJECT_CQ, cmd.cq_handle, attrs);
>         if (!cq)
>                 return -EINVAL;
> 
>         ret = cq->device->ops.resize_cq(cq, cmd.cqe, &attrs->driver_udata);    <<<< No check for NULL.
> 
> 
> --pk
>

Thanks,
Kamal

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

* RE: [EXT] Re: [PATCH for-next] RDMA/qedr: Remove unsupported qedr_resize_cq callback
  2021-10-25 10:06 ` Kamal Heib
@ 2021-10-25 10:54   ` Prabhakar Kushwaha
  0 siblings, 0 replies; 6+ messages in thread
From: Prabhakar Kushwaha @ 2021-10-25 10:54 UTC (permalink / raw)
  To: Kamal Heib
  Cc: linux-rdma, Michal Kalderon, dledford, jgg, Ariel Elior, Alok Prasad

Hi Kamal,

> -----Original Message-----
> From: Kamal Heib <kamalheib1@gmail.com>
> Sent: Monday, October 25, 2021 3:37 PM
> To: Prabhakar Kushwaha <pkushwaha@marvell.com>
> Cc: linux-rdma@vger.kernel.org; Michal Kalderon <mkalderon@marvell.com>;
> dledford@redhat.com; jgg@ziepe.ca; Ariel Elior <aelior@marvell.com>; Alok
> Prasad <palok@marvell.com>
> Subject: Re: [PATCH for-next] RDMA/qedr: Remove unsupported
> qedr_resize_cq callback
> 
 
> ----------------------------------------------------------------------
> On Mon, Oct 25, 2021 at 09:24:41AM +0000, Prabhakar Kushwaha wrote:
> > Dear Kamal,
> >
> 
> Hi Prabhakar,
> 
> > > -----Original Message-----
> > > From: Kamal Heib <kamalheib1@gmail.com>
> > > Sent: Monday, October 25, 2021 9:27 AM
> > > To: linux-rdma@vger.kernel.org
> > > Cc: Michal Kalderon <mkalderon@marvell.com>; Ariel Elior
> > > <aelior@marvell.com>; Doug Ledford <dledford@redhat.com>; Jason
> > > Gunthorpe <jgg@ziepe.ca>; Kamal Heib <kamalheib1@gmail.com>
> > > Subject:  [PATCH for-next] RDMA/qedr: Remove unsupported
> > > qedr_resize_cq callback
> > >

> > > ----------------------------------------------------------------------
> > > There is no need to return always zero for function which is not supported.
> > >
> > > Fixes: a7efd7773e31 ("qedr: Add support for PD,PKEY and CQ verbs")
> > > Signed-off-by: Kamal Heib <kamalheib1@gmail.com>
> > > ---
> > >  drivers/infiniband/hw/qedr/main.c  |  1 -
> drivers/infiniband/hw/qedr/verbs.c |
> > > 10 ----------  drivers/infiniband/hw/qedr/verbs.h |  1 -
> > >  3 files changed, 12 deletions(-)
> >
> > Have you tested this patch? I afraid, there may be a crash because of  this
> >
> 
> I do not think that we will face a crash, because the libqedr in the
> rdma-core package dose not implement the resize_cq() callback.
> 
> Furthermore, if there is a bug in the kernel rdma core this doesn't mean
> that the qedr driver need to fake supporting resize_cq() to avoid a crash!.
> 

a7efd7773e31 is quite old commit.  Not sure about the reason behind such function definition.
But a patch should consider the possible side-effects. 


> Anyway, To be in the safe side we I'll prepare another patch that checks
> for NULL in the core and return -EOPNOTSUPP if resize_cq() is not set
> by the driver.
> 

Thanks!!

--pk


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

* Re: [PATCH for-next] RDMA/qedr: Remove unsupported qedr_resize_cq callback
  2021-10-25  9:24 [PATCH for-next] RDMA/qedr: Remove unsupported qedr_resize_cq callback Prabhakar Kushwaha
  2021-10-25 10:06 ` Kamal Heib
@ 2021-10-25 14:27 ` Jason Gunthorpe
  1 sibling, 0 replies; 6+ messages in thread
From: Jason Gunthorpe @ 2021-10-25 14:27 UTC (permalink / raw)
  To: Prabhakar Kushwaha
  Cc: linux-rdma, kamalheib1, Michal Kalderon, dledford, Ariel Elior,
	Alok Prasad

On Mon, Oct 25, 2021 at 09:24:41AM +0000, Prabhakar Kushwaha wrote:
> Dear Kamal,
>  
> > From: Kamal Heib <kamalheib1@gmail.com>
> > Sent: Monday, October 25, 2021 9:27 AM
> > To: linux-rdma@vger.kernel.org
> > Cc: Michal Kalderon <mkalderon@marvell.com>; Ariel Elior
> > <aelior@marvell.com>; Doug Ledford <dledford@redhat.com>; Jason
> > Gunthorpe <jgg@ziepe.ca>; Kamal Heib <kamalheib1@gmail.com>
> > Subject:  [PATCH for-next] RDMA/qedr: Remove unsupported
> > qedr_resize_cq callback
> > 
> > External Email
> > 
> > There is no need to return always zero for function which is not supported.
> > 
> > Fixes: a7efd7773e31 ("qedr: Add support for PD,PKEY and CQ verbs")
> > Signed-off-by: Kamal Heib <kamalheib1@gmail.com>
> >  drivers/infiniband/hw/qedr/main.c  |  1 -  drivers/infiniband/hw/qedr/verbs.c |
> > 10 ----------  drivers/infiniband/hw/qedr/verbs.h |  1 -
> >  3 files changed, 12 deletions(-)
> 
> Have you tested this patch? I afraid, there may be a crash because of  this 
> 
> static int ib_uverbs_resize_cq(struct uverbs_attr_bundle *attrs)
> {
> <snip>
> 
>         cq = uobj_get_obj_read(cq, UVERBS_OBJECT_CQ, cmd.cq_handle, attrs);
>         if (!cq)
>                 return -EINVAL;
> 
>         ret = cq->device->ops.resize_cq(cq, cmd.cqe, &attrs->driver_udata);    <<<< No check for NULL.

The NULL check is here:

		DECLARE_UVERBS_WRITE(IB_USER_VERBS_CMD_RESIZE_CQ,
				     ib_uverbs_resize_cq,
				     UAPI_DEF_WRITE_UDATA_IO(
					     struct ib_uverbs_resize_cq,
					     struct ib_uverbs_resize_cq_resp),
				     UAPI_DEF_METHOD_NEEDS_FN(resize_cq)),

Jason

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

* Re: [PATCH for-next] RDMA/qedr: Remove unsupported qedr_resize_cq callback
  2021-10-25  6:26 Kamal Heib
@ 2021-10-25 19:48 ` Jason Gunthorpe
  0 siblings, 0 replies; 6+ messages in thread
From: Jason Gunthorpe @ 2021-10-25 19:48 UTC (permalink / raw)
  To: Kamal Heib; +Cc: linux-rdma, Michal Kalderon, Ariel Elior, Doug Ledford

On Mon, Oct 25, 2021 at 09:26:32AM +0300, Kamal Heib wrote:
> There is no need to return always zero for function which is not
> supported.
> 
> Fixes: a7efd7773e31 ("qedr: Add support for PD,PKEY and CQ verbs")
> Signed-off-by: Kamal Heib <kamalheib1@gmail.com>
> ---
>  drivers/infiniband/hw/qedr/main.c  |  1 -
>  drivers/infiniband/hw/qedr/verbs.c | 10 ----------
>  drivers/infiniband/hw/qedr/verbs.h |  1 -
>  3 files changed, 12 deletions(-)

Applied to for-next, thanks

Jason

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

* [PATCH for-next] RDMA/qedr: Remove unsupported qedr_resize_cq callback
@ 2021-10-25  6:26 Kamal Heib
  2021-10-25 19:48 ` Jason Gunthorpe
  0 siblings, 1 reply; 6+ messages in thread
From: Kamal Heib @ 2021-10-25  6:26 UTC (permalink / raw)
  To: linux-rdma
  Cc: Michal Kalderon, Ariel Elior, Doug Ledford, Jason Gunthorpe, Kamal Heib

There is no need to return always zero for function which is not
supported.

Fixes: a7efd7773e31 ("qedr: Add support for PD,PKEY and CQ verbs")
Signed-off-by: Kamal Heib <kamalheib1@gmail.com>
---
 drivers/infiniband/hw/qedr/main.c  |  1 -
 drivers/infiniband/hw/qedr/verbs.c | 10 ----------
 drivers/infiniband/hw/qedr/verbs.h |  1 -
 3 files changed, 12 deletions(-)

diff --git a/drivers/infiniband/hw/qedr/main.c b/drivers/infiniband/hw/qedr/main.c
index 755930be01b8..8b5291d424d2 100644
--- a/drivers/infiniband/hw/qedr/main.c
+++ b/drivers/infiniband/hw/qedr/main.c
@@ -228,7 +228,6 @@ static const struct ib_device_ops qedr_dev_ops = {
 	.query_srq = qedr_query_srq,
 	.reg_user_mr = qedr_reg_user_mr,
 	.req_notify_cq = qedr_arm_cq,
-	.resize_cq = qedr_resize_cq,
 
 	INIT_RDMA_OBJ_SIZE(ib_ah, qedr_ah, ibah),
 	INIT_RDMA_OBJ_SIZE(ib_cq, qedr_cq, ibcq),
diff --git a/drivers/infiniband/hw/qedr/verbs.c b/drivers/infiniband/hw/qedr/verbs.c
index 3fbf172dbbef..ce0e24fa14c5 100644
--- a/drivers/infiniband/hw/qedr/verbs.c
+++ b/drivers/infiniband/hw/qedr/verbs.c
@@ -1052,16 +1052,6 @@ int qedr_create_cq(struct ib_cq *ibcq, const struct ib_cq_init_attr *attr,
 	return -EINVAL;
 }
 
-int qedr_resize_cq(struct ib_cq *ibcq, int new_cnt, struct ib_udata *udata)
-{
-	struct qedr_dev *dev = get_qedr_dev(ibcq->device);
-	struct qedr_cq *cq = get_qedr_cq(ibcq);
-
-	DP_ERR(dev, "cq %p RESIZE NOT SUPPORTED\n", cq);
-
-	return 0;
-}
-
 #define QEDR_DESTROY_CQ_MAX_ITERATIONS		(10)
 #define QEDR_DESTROY_CQ_ITER_DURATION		(10)
 
diff --git a/drivers/infiniband/hw/qedr/verbs.h b/drivers/infiniband/hw/qedr/verbs.h
index 031687dafc61..081753df79ef 100644
--- a/drivers/infiniband/hw/qedr/verbs.h
+++ b/drivers/infiniband/hw/qedr/verbs.h
@@ -53,7 +53,6 @@ int qedr_alloc_xrcd(struct ib_xrcd *ibxrcd, struct ib_udata *udata);
 int qedr_dealloc_xrcd(struct ib_xrcd *ibxrcd, struct ib_udata *udata);
 int qedr_create_cq(struct ib_cq *ibcq, const struct ib_cq_init_attr *attr,
 		   struct ib_udata *udata);
-int qedr_resize_cq(struct ib_cq *, int cqe, struct ib_udata *);
 int qedr_destroy_cq(struct ib_cq *ibcq, struct ib_udata *udata);
 int qedr_arm_cq(struct ib_cq *ibcq, enum ib_cq_notify_flags flags);
 int qedr_create_qp(struct ib_qp *qp, struct ib_qp_init_attr *attrs,
-- 
2.31.1


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

end of thread, other threads:[~2021-10-25 19:53 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-25  9:24 [PATCH for-next] RDMA/qedr: Remove unsupported qedr_resize_cq callback Prabhakar Kushwaha
2021-10-25 10:06 ` Kamal Heib
2021-10-25 10:54   ` [EXT] " Prabhakar Kushwaha
2021-10-25 14:27 ` Jason Gunthorpe
  -- strict thread matches above, loose matches on Subject: below --
2021-10-25  6:26 Kamal Heib
2021-10-25 19:48 ` Jason Gunthorpe

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