linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH for-next] RDMA/core: Remove unnecessary statements
@ 2022-02-23  7:49 Yajun Deng
  2022-02-24 19:15 ` Leon Romanovsky
  2022-02-28 17:57 ` Jason Gunthorpe
  0 siblings, 2 replies; 3+ messages in thread
From: Yajun Deng @ 2022-02-23  7:49 UTC (permalink / raw)
  To: jgg; +Cc: linux-rdma, linux-kernel, Yajun Deng

The rdma_zalloc_drv_obj() in __ib_alloc_pd() would zero pd, it unnecessary
add NULL to the object in struct pd.

The uverbs_free_pd() already return busy if pd->usecnt is true, there is
no need to add a warning.

Signed-off-by: Yajun Deng <yajun.deng@linux.dev>
---
 drivers/infiniband/core/verbs.c | 7 -------
 1 file changed, 7 deletions(-)

diff --git a/drivers/infiniband/core/verbs.c b/drivers/infiniband/core/verbs.c
index e821dc94a43e..03bc9d34c13d 100644
--- a/drivers/infiniband/core/verbs.c
+++ b/drivers/infiniband/core/verbs.c
@@ -268,8 +268,6 @@ struct ib_pd *__ib_alloc_pd(struct ib_device *device, unsigned int flags,
 		return ERR_PTR(-ENOMEM);
 
 	pd->device = device;
-	pd->uobject = NULL;
-	pd->__internal_mr = NULL;
 	atomic_set(&pd->usecnt, 0);
 	pd->flags = flags;
 
@@ -341,11 +339,6 @@ int ib_dealloc_pd_user(struct ib_pd *pd, struct ib_udata *udata)
 		pd->__internal_mr = NULL;
 	}
 
-	/* uverbs manipulates usecnt with proper locking, while the kabi
-	 * requires the caller to guarantee we can't race here.
-	 */
-	WARN_ON(atomic_read(&pd->usecnt));
-
 	ret = pd->device->ops.dealloc_pd(pd, udata);
 	if (ret)
 		return ret;
-- 
2.25.1


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

* Re: [PATCH for-next] RDMA/core: Remove unnecessary statements
  2022-02-23  7:49 [PATCH for-next] RDMA/core: Remove unnecessary statements Yajun Deng
@ 2022-02-24 19:15 ` Leon Romanovsky
  2022-02-28 17:57 ` Jason Gunthorpe
  1 sibling, 0 replies; 3+ messages in thread
From: Leon Romanovsky @ 2022-02-24 19:15 UTC (permalink / raw)
  To: Yajun Deng; +Cc: jgg, linux-rdma, linux-kernel

On Wed, Feb 23, 2022 at 03:49:01PM +0800, Yajun Deng wrote:
> The rdma_zalloc_drv_obj() in __ib_alloc_pd() would zero pd, it unnecessary
> add NULL to the object in struct pd.
> 
> The uverbs_free_pd() already return busy if pd->usecnt is true, there is
> no need to add a warning.
> 
> Signed-off-by: Yajun Deng <yajun.deng@linux.dev>
> ---
>  drivers/infiniband/core/verbs.c | 7 -------
>  1 file changed, 7 deletions(-)
> 
> diff --git a/drivers/infiniband/core/verbs.c b/drivers/infiniband/core/verbs.c
> index e821dc94a43e..03bc9d34c13d 100644
> --- a/drivers/infiniband/core/verbs.c
> +++ b/drivers/infiniband/core/verbs.c
> @@ -268,8 +268,6 @@ struct ib_pd *__ib_alloc_pd(struct ib_device *device, unsigned int flags,
>  		return ERR_PTR(-ENOMEM);
>  
>  	pd->device = device;
> -	pd->uobject = NULL;
> -	pd->__internal_mr = NULL;
>  	atomic_set(&pd->usecnt, 0);
^^^^^^^^ this line should be removed too.

>  	pd->flags = flags;
>  
> @@ -341,11 +339,6 @@ int ib_dealloc_pd_user(struct ib_pd *pd, struct ib_udata *udata)
>  		pd->__internal_mr = NULL;
>  	}
>  
> -	/* uverbs manipulates usecnt with proper locking, while the kabi
> -	 * requires the caller to guarantee we can't race here.
> -	 */
> -	WARN_ON(atomic_read(&pd->usecnt));
> -

ib_dealloc_pd_user() is called not only in uverbs_free_pd(), but in ib_dealloc_pd() too.
So commit message is not really correct.

Of course, ib_dealloc_pd() is kernel verb and doesn't use ->usecnt at all.

Thanks,
Reviewed-by: Leon Romanovsky <leonro@nvidia.com>

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

* Re: [PATCH for-next] RDMA/core: Remove unnecessary statements
  2022-02-23  7:49 [PATCH for-next] RDMA/core: Remove unnecessary statements Yajun Deng
  2022-02-24 19:15 ` Leon Romanovsky
@ 2022-02-28 17:57 ` Jason Gunthorpe
  1 sibling, 0 replies; 3+ messages in thread
From: Jason Gunthorpe @ 2022-02-28 17:57 UTC (permalink / raw)
  To: Yajun Deng; +Cc: linux-rdma, linux-kernel

On Wed, Feb 23, 2022 at 03:49:01PM +0800, Yajun Deng wrote:
> The rdma_zalloc_drv_obj() in __ib_alloc_pd() would zero pd, it unnecessary
> add NULL to the object in struct pd.
> 
> The uverbs_free_pd() already return busy if pd->usecnt is true, there is
> no need to add a warning.
> 
> Signed-off-by: Yajun Deng <yajun.deng@linux.dev>
> Reviewed-by: Leon Romanovsky <leonro@nvidia.com>
>  drivers/infiniband/core/verbs.c | 7 -------
>  1 file changed, 7 deletions(-)

Applied to for-next, with Leon's note added

Thanks,
Jason

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

end of thread, other threads:[~2022-02-28 18:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-23  7:49 [PATCH for-next] RDMA/core: Remove unnecessary statements Yajun Deng
2022-02-24 19:15 ` Leon Romanovsky
2022-02-28 17:57 ` 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).