From: Leon Romanovsky <leonro@mellanox.com>
To: Jason Gunthorpe <jgg@nvidia.com>
Cc: linux-rdma@vger.kernel.org, Matthew Wilcox <willy@infradead.org>
Subject: Re: [PATCH] RDMA/cm: Make the local_id_table xarray non-irq
Date: Thu, 5 Nov 2020 10:52:31 +0200 [thread overview]
Message-ID: <20201105085231.GP5429@unreal> (raw)
In-Reply-To: <0-v1-808b6da3bd3f+1857-cm_xarray_no_irq_jgg@nvidia.com>
On Wed, Nov 04, 2020 at 05:40:59PM -0400, Jason Gunthorpe wrote:
> The xarray is never mutated from an IRQ handler, only from work queues
> under a spinlock_irq. Thus there is no reason for it be an IRQ type
> xarray.
>
> This was copied over from the original IDR code, but the recent rework put
> the xarray inside another spinlock_irq which will unbalance the unlocking.
>
> Fixes: c206f8bad15d ("RDMA/cm: Make it clearer how concurrency works in cm_req_handler()")
> Reported-by: Matthew Wilcox <willy@infradead.org>
> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
> ---
> drivers/infiniband/core/cm.c | 12 ++++++------
> 1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/infiniband/core/cm.c b/drivers/infiniband/core/cm.c
> index 0201364974594f..167e436ae11ded 100644
> --- a/drivers/infiniband/core/cm.c
> +++ b/drivers/infiniband/core/cm.c
> @@ -859,8 +859,8 @@ static struct cm_id_private *cm_alloc_id_priv(struct ib_device *device,
> atomic_set(&cm_id_priv->work_count, -1);
> refcount_set(&cm_id_priv->refcount, 1);
>
> - ret = xa_alloc_cyclic_irq(&cm.local_id_table, &id, NULL, xa_limit_32b,
> - &cm.local_id_next, GFP_KERNEL);
> + ret = xa_alloc_cyclic(&cm.local_id_table, &id, NULL, xa_limit_32b,
> + &cm.local_id_next, GFP_KERNEL);
> if (ret < 0)
> goto error;
> cm_id_priv->id.local_id = (__force __be32)id ^ cm.random_id_operand;
> @@ -878,8 +878,8 @@ static struct cm_id_private *cm_alloc_id_priv(struct ib_device *device,
> */
> static void cm_finalize_id(struct cm_id_private *cm_id_priv)
> {
> - xa_store_irq(&cm.local_id_table, cm_local_id(cm_id_priv->id.local_id),
> - cm_id_priv, GFP_KERNEL);
> + xa_store(&cm.local_id_table, cm_local_id(cm_id_priv->id.local_id),
> + cm_id_priv, GFP_ATOMIC);
> }
I see that in the ib_create_cm_id() function, we call to cm_finalize_id(),
won't it be a problem to do it without irq lock?
Thanks
next prev parent reply other threads:[~2020-11-05 8:52 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-04 21:40 [PATCH] RDMA/cm: Make the local_id_table xarray non-irq Jason Gunthorpe
2020-11-05 8:52 ` Leon Romanovsky [this message]
2020-11-05 15:15 ` Jason Gunthorpe
2020-11-10 9:07 ` Leon Romanovsky
2020-11-12 16:32 ` 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=20201105085231.GP5429@unreal \
--to=leonro@mellanox.com \
--cc=jgg@nvidia.com \
--cc=linux-rdma@vger.kernel.org \
--cc=willy@infradead.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 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).