From: Jason Gunthorpe <jgg@nvidia.com>
To: Bob Pearson <rpearsonhpe@gmail.com>
Cc: Bart Van Assche <bvanassche@acm.org>,
zyjzyj2000@gmail.com, linux-rdma@vger.kernel.org,
linux-scsi@vger.kernel.org, yi.zhang@redhat.com
Subject: Re: [PATCH for-next] RDMA/rxe: Fix "Replace red-black trees by xarrays"
Date: Mon, 11 Apr 2022 08:38:36 -0300 [thread overview]
Message-ID: <20220411113836.GD2120790@nvidia.com> (raw)
In-Reply-To: <6296dc52-1298-6a52-a4fb-2c6fe04ab151@gmail.com>
On Sun, Apr 10, 2022 at 10:13:16PM -0500, Bob Pearson wrote:
> On 4/10/22 22:06, Bart Van Assche wrote:
> > On 4/10/22 15:39, Bob Pearson wrote:
> >> Fixes: 3225717f6dfa ("RDMA/rxe: Replace red-black trees by carrays")
> > ^^^^^^^
> > xarrays?
> >
> >> @@ -138,8 +140,10 @@ void *rxe_alloc(struct rxe_pool *pool)
> >> elem->obj = obj;
> >> kref_init(&elem->ref_cnt);
> >> - err = xa_alloc_cyclic(&pool->xa, &elem->index, elem, pool->limit,
> >> + xa_lock_irqsave(xa, flags);
> >> + err = __xa_alloc_cyclic(&pool->xa, &elem->index, elem, pool->limit,
> >> &pool->next, GFP_KERNEL);
> >> + xa_unlock_irqrestore(xa, flags);
> >
> > Please take a look at the xas_unlock_type() and xas_lock_type() calls in __xas_nomem(). I think that the above change will trigger a GFP_KERNEL allocation with interrupts disabled. My understanding is that GFP_KERNEL allocations may sleep and hence that the above code may cause __xas_nomem() to sleep with interrupts disabled. I don't think that is allowed.
> >
> > Thanks,
> >
> > Bart.
>
> You're right. I missed that. Zhu wants to write the patch so hopefully he's on top of that.
> For now we could use GFP_ATOMIC.
Yes, you cannot use irq_save varients here. You have to know your
calling context is non-atomic already and use the irq wrapper.
Jason
next prev parent reply other threads:[~2022-04-11 11:38 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-10 22:39 [PATCH for-next] RDMA/rxe: Fix "Replace red-black trees by xarrays" Bob Pearson
2022-04-11 3:06 ` Bart Van Assche
2022-04-11 3:13 ` Bob Pearson
2022-04-11 11:38 ` Jason Gunthorpe [this message]
2022-04-11 15:52 ` Pearson, Robert B
2022-04-11 16:02 ` Jason Gunthorpe
2022-04-12 13:32 ` Yanjun Zhu
2022-04-12 13:39 ` Jason Gunthorpe
2022-04-12 13:49 ` Yanjun Zhu
2022-04-11 3:15 ` Zhu Yanjun
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=20220411113836.GD2120790@nvidia.com \
--to=jgg@nvidia.com \
--cc=bvanassche@acm.org \
--cc=linux-rdma@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=rpearsonhpe@gmail.com \
--cc=yi.zhang@redhat.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.