From: Jason Gunthorpe <jgg@nvidia.com>
To: Bob Pearson <rpearsonhpe@gmail.com>
Cc: zyjzyj2000@gmail.com, bvanassche@acm.org,
linux-rdma@vger.kernel.org, frank.zago@hpe.com, jhack@hpe.com
Subject: Re: [PATCH for-next v15 2/2] RDMA/rxe: Convert read side locking to rcu
Date: Mon, 6 Jun 2022 14:07:28 -0300 [thread overview]
Message-ID: <20220606170728.GC1343366@nvidia.com> (raw)
In-Reply-To: <20220606141804.4040-3-rpearsonhpe@gmail.com>
On Mon, Jun 06, 2022 at 09:18:04AM -0500, Bob Pearson wrote:
> Use rcu_read_lock() for protecting read side operations in rxe_pool.c.
>
> Signed-off-by: Bob Pearson <rpearsonhpe@gmail.com>
> drivers/infiniband/sw/rxe/rxe_pool.c | 26 ++++++++++----------------
> 1 file changed, 10 insertions(+), 16 deletions(-)
>
> diff --git a/drivers/infiniband/sw/rxe/rxe_pool.c b/drivers/infiniband/sw/rxe/rxe_pool.c
> index 7a5685f0713e..103bf0c03441 100644
> +++ b/drivers/infiniband/sw/rxe/rxe_pool.c
> @@ -195,16 +195,15 @@ void *rxe_pool_get_index(struct rxe_pool *pool, u32 index)
> {
> struct rxe_pool_elem *elem;
> struct xarray *xa = &pool->xa;
> - unsigned long flags;
> void *obj;
>
> - xa_lock_irqsave(xa, flags);
> + rcu_read_lock();
> elem = xa_load(xa, index);
> if (elem && kref_get_unless_zero(&elem->ref_cnt))
> obj = elem->obj;
> else
> obj = NULL;
> - xa_unlock_irqrestore(xa, flags);
> + rcu_read_unlock();
>
> return obj;
> }
> @@ -221,16 +220,15 @@ int __rxe_cleanup(struct rxe_pool_elem *elem, bool sleepable)
> struct rxe_pool *pool = elem->pool;
> struct xarray *xa = &pool->xa;
> static int timeout = RXE_POOL_TIMEOUT;
> - unsigned long flags;
> int ret, err = 0;
> void *xa_ret;
>
> + WARN_ON(!in_task());
I think this should just be
if (sleepable)
might_sleep();
?
It all seems OK, any chance the AH bit can be split to its own patch
or is it all interconnected? It would be easier for rc this way.
Jason
next prev parent reply other threads:[~2022-06-06 17:16 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-06 14:18 [PATCH for-next v15 0/2] Fix race conditions in rxe_pool Bob Pearson
2022-06-06 14:18 ` [PATCH for-next v15 1/2] RDMA/rxe: Stop lookup of partially built objects Bob Pearson
2022-06-06 17:10 ` Jason Gunthorpe
2022-06-06 20:48 ` Pearson, Robert B
2022-06-06 14:18 ` [PATCH for-next v15 2/2] RDMA/rxe: Convert read side locking to rcu Bob Pearson
2022-06-06 17:07 ` Jason Gunthorpe [this message]
2022-06-06 20:51 ` Pearson, Robert B
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=20220606170728.GC1343366@nvidia.com \
--to=jgg@nvidia.com \
--cc=bvanassche@acm.org \
--cc=frank.zago@hpe.com \
--cc=jhack@hpe.com \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox