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 1/2] RDMA/rxe: Stop lookup of partially built objects
Date: Mon, 6 Jun 2022 14:10:21 -0300 [thread overview]
Message-ID: <20220606171021.GD1343366@nvidia.com> (raw)
In-Reply-To: <20220606141804.4040-2-rpearsonhpe@gmail.com>
On Mon, Jun 06, 2022 at 09:18:03AM -0500, Bob Pearson wrote:
> @@ -164,9 +171,16 @@ int __rxe_add_to_pool(struct rxe_pool *pool, struct rxe_pool_elem *elem)
> elem->pool = pool;
> elem->obj = (u8 *)elem - pool->elem_offset;
> kref_init(&elem->ref_cnt);
> + init_completion(&elem->complete);
>
> - err = xa_alloc_cyclic(&pool->xa, &elem->index, elem, pool->limit,
> - &pool->next, GFP_KERNEL);
> + /* AH objects are unique in that the create_ah verb
> + * can be called in atomic context. If the create_ah
> + * call is not sleepable use GFP_ATOMIC.
> + */
> + gfp_flags = sleepable ? GFP_KERNEL : GFP_ATOMIC;
I would add a 'if (sleepable) might_sleep()' here too
> + } else {
> + unsigned long until = jiffies + timeout;
> +
> + /* AH objects are unique in that the destroy_ah verb
> + * can be called in atomic context. This delay
> + * replaces the wait_for_completion call above
> + * when the destroy_ah call is not sleepable
> + */
> + while (!completion_done(&elem->complete) &&
> + time_before(jiffies, until))
> + mdelay(1);
Is it even possible that a transient AH reference can exist?
> +/**
> + * rxe_wqe_is_fenced - check if next wqe is fenced
> + * @qp: the queue pair
> + * @wqe: the next wqe
> + *
> + * Returns: 1 if wqe needs to wait
> + * 0 if wqe is ready to go
> + */
> +static int rxe_wqe_is_fenced(struct rxe_qp *qp, struct rxe_send_wqe *wqe)
> +{
> + /* Local invalidate fence (LIF) see IBA 10.6.5.1
> + * Requires ALL previous operations on the send queue
> + * are complete. Make mandatory for the rxe driver.
> + */
> + if (wqe->wr.opcode == IB_WR_LOCAL_INV)
> + return qp->req.wqe_index != queue_get_consumer(qp->sq.queue,
> + QUEUE_TYPE_FROM_CLIENT);
> +
> + /* Fence see IBA 10.8.3.3
> + * Requires that all previous read and atomic operations
> + * are complete.
> + */
> + return (wqe->wr.send_flags & IB_SEND_FENCE) &&
> + atomic_read(&qp->req.rd_atomic) != qp->attr.max_rd_atomic;
> +}
Does this belong in this patch?
Jason
next prev parent reply other threads:[~2022-06-06 17:17 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 [this message]
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
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=20220606171021.GD1343366@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 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.