All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jason Gunthorpe <jgg@nvidia.com>
To: Bob Pearson <rpearsonhpe@gmail.com>
Cc: leon@kernel.org, zyjzyj2000@gmail.com, jhack@hpe.com,
	linux-rdma@vger.kernel.org
Subject: Re: [PATCH for-next 1/9] RDMA/rxe: Fix handling sleepable in rxe_pool.c
Date: Mon, 31 Jul 2023 15:08:14 -0300	[thread overview]
Message-ID: <ZMf4jipS+FdUK2Gn@nvidia.com> (raw)
In-Reply-To: <20230721205021.5394-2-rpearsonhpe@gmail.com>

On Fri, Jul 21, 2023 at 03:50:14PM -0500, Bob Pearson wrote:
> Since the AH creation and destroy verbs APIs can be called in
> interrupt context it is necessary to not sleep in these cases.
> This was partially dealt with in previous fixes but some cases
> remain where the code could still potentially sleep.
> 
> This patch fixes this by extending the __rxe_finalize() call to
> have a sleepable parameter and using this in the AH verbs calls.
> It also fixes one call to rxe_cleanup which did not use the
> sleepable API.
> 
> Fixes: 215d0a755e1b ("RDMA/rxe: Stop lookup of partially built objects")
> Signed-off-by: Bob Pearson <rpearsonhpe@gmail.com>
> ---
>  drivers/infiniband/sw/rxe/rxe_pool.c  |  5 +++--
>  drivers/infiniband/sw/rxe/rxe_pool.h  |  5 +++--
>  drivers/infiniband/sw/rxe/rxe_verbs.c | 11 ++++++-----
>  3 files changed, 12 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/infiniband/sw/rxe/rxe_pool.c b/drivers/infiniband/sw/rxe/rxe_pool.c
> index 6215c6de3a84..de0043b6d3f3 100644
> --- a/drivers/infiniband/sw/rxe/rxe_pool.c
> +++ b/drivers/infiniband/sw/rxe/rxe_pool.c
> @@ -247,10 +247,11 @@ int __rxe_put(struct rxe_pool_elem *elem)
>  	return kref_put(&elem->ref_cnt, rxe_elem_release);
>  }
>  
> -void __rxe_finalize(struct rxe_pool_elem *elem)
> +void __rxe_finalize(struct rxe_pool_elem *elem, bool sleepable)
>  {
>  	void *xa_ret;
> +	gfp_t gfp_flags = sleepable ? GFP_KERNEL : GFP_ATOMIC;
>  
> -	xa_ret = xa_store(&elem->pool->xa, elem->index, elem, GFP_KERNEL);
> +	xa_ret = xa_store(&elem->pool->xa, elem->index, elem, gfp_flags);
>  	WARN_ON(xa_err(xa_ret));
>  }

You don't need to do this, there is no allocation here, when you call
xa_alloc_cyclic() it reserved all the memory necessary for this.

Just add a comment and mark it GFP_ATOMIC.

Jason

  reply	other threads:[~2023-07-31 18:08 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-21 20:50 [PATCH for-next 0/9] RDMA/rxe: Misc fixes and cleanups Bob Pearson
2023-07-21 20:50 ` [PATCH for-next 1/9] RDMA/rxe: Fix handling sleepable in rxe_pool.c Bob Pearson
2023-07-31 18:08   ` Jason Gunthorpe [this message]
2023-07-21 20:50 ` [PATCH for-next 2/9] RDMA/rxe: Fix xarray locking " Bob Pearson
2023-07-21 20:50 ` [PATCH for-next 3/9] RDMA/rxe: Fix freeing busy objects Bob Pearson
2023-07-31 18:11   ` Jason Gunthorpe
2023-07-31 18:16     ` Bob Pearson
2023-07-31 18:22       ` Jason Gunthorpe
2023-07-21 20:50 ` [PATCH for-next 4/9] RDMA/rxe: Fix delayed send packet handling Bob Pearson
2023-07-23 13:03   ` Zhu Yanjun
2023-07-23 17:24     ` Bob Pearson
2023-07-24 17:59     ` Leon Romanovsky
2023-07-24 18:26       ` Bob Pearson
2023-07-31 18:12   ` Jason Gunthorpe
2023-07-31 18:20     ` Bob Pearson
2023-07-31 18:23       ` Jason Gunthorpe
2023-07-31 18:33         ` Bob Pearson
2023-08-04 14:17           ` Jason Gunthorpe
2023-07-21 20:50 ` [PATCH for-next 5/9] RDMA/rxe: Optimize rxe_init_packet in rxe_net.c Bob Pearson
2023-07-21 20:50 ` [PATCH for-next 6/9] RDMA/rxe: Delete unused field elem->list Bob Pearson
2023-07-21 20:50 ` [PATCH for-next 7/9] RDMA/rxe: Add elem->valid field Bob Pearson
2023-07-31 18:15   ` Jason Gunthorpe
2023-07-21 20:50 ` [PATCH for-next 8/9] RDMA/rxe: Report leaked objects Bob Pearson
2023-07-31 18:15   ` Jason Gunthorpe
2023-07-31 18:23     ` Bob Pearson
2023-07-31 18:31       ` Jason Gunthorpe
2023-07-31 18:42         ` Bob Pearson
2023-07-31 18:43           ` Jason Gunthorpe
2023-07-31 18:51             ` Bob Pearson
2023-08-04 14:16               ` Jason Gunthorpe
2023-07-21 20:50 ` [PATCH for-next 9/9] RDMA/rxe: Protect pending send packets Bob Pearson
2023-07-31 18:17   ` Jason Gunthorpe
2023-07-31 18:26     ` Bob Pearson
2023-07-31 18:32       ` Jason Gunthorpe
2023-07-31 18:44         ` Bob Pearson
2023-08-01 22:56           ` Jason Gunthorpe
2023-08-02 14:39             ` Bob Pearson
2023-08-02 14:57               ` Jason Gunthorpe

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=ZMf4jipS+FdUK2Gn@nvidia.com \
    --to=jgg@nvidia.com \
    --cc=jhack@hpe.com \
    --cc=leon@kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=rpearsonhpe@gmail.com \
    --cc=zyjzyj2000@gmail.com \
    /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.