From: Jason Gunthorpe <jgg@ziepe.ca>
To: Daisuke Matsuda <matsuda-daisuke@fujitsu.com>
Cc: linux-rdma@vger.kernel.org, leon@kernel.org,
zyjzyj2000@gmail.com, linux-kernel@vger.kernel.org,
rpearsonhpe@gmail.com, yangx.jy@fujitsu.com,
lizhijian@fujitsu.com, y-goto@fujitsu.com
Subject: Re: [PATCH for-next v6 7/7] RDMA/rxe: Add support for the traditional Atomic operations with ODP
Date: Fri, 8 Sep 2023 11:29:01 -0300 [thread overview]
Message-ID: <ZPsvrTvT3CtsdWu5@ziepe.ca> (raw)
In-Reply-To: <908514dfa6bbeae72d36481d893674b254ee416d.1694153251.git.matsuda-daisuke@fujitsu.com>
On Fri, Sep 08, 2023 at 03:26:48PM +0900, Daisuke Matsuda wrote:
> +int rxe_odp_mr_atomic_op(struct rxe_mr *mr, u64 iova, int opcode,
> + u64 compare, u64 swap_add, u64 *orig_val)
> +{
> + int err;
> + int retry = 0;
> + struct ib_umem_odp *umem_odp = to_ib_umem_odp(mr->umem);
> +
> + mutex_lock(&umem_odp->umem_mutex);
> +
> + /* Atomic operations manipulate a single char. */
> + if (rxe_odp_check_pages(mr, iova, sizeof(char), 0))
> + goto need_fault;
> +
> + err = rxe_mr_do_atomic_op(mr, iova, opcode, compare,
> + swap_add, orig_val);
> +
> + mutex_unlock(&umem_odp->umem_mutex);
You should just use the xarray spinlock, the umem_mutex should only be
held around the faulting flow
> +
> + return err;
> +
> +need_fault:
> + /* allow max 3 tries for pagefault */
> + do {
Why a retry loop? We already have a retry loop in
ib_umem_odp_map_dma_and_lock,it doesn't need to be done externally. If
you reach here with the lock held then progress should be guarenteed
under the lock.
Jason
prev parent reply other threads:[~2023-09-08 14:29 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-08 6:26 [PATCH for-next v6 0/7] On-Demand Paging on SoftRoCE Daisuke Matsuda
2023-09-08 6:26 ` [PATCH for-next v6 1/7] RDMA/rxe: Always defer tasks on responder and completer to workqueue Daisuke Matsuda
2023-09-08 6:26 ` [PATCH for-next v6 2/7] RDMA/rxe: Make MR functions accessible from other rxe source code Daisuke Matsuda
2023-09-08 6:26 ` [PATCH for-next v6 3/7] RDMA/rxe: Move resp_states definition to rxe_verbs.h Daisuke Matsuda
2023-09-08 6:26 ` [PATCH for-next v6 4/7] RDMA/rxe: Add page invalidation support Daisuke Matsuda
2023-09-08 14:22 ` Jason Gunthorpe
2023-09-10 8:30 ` Zhu Yanjun
2023-09-08 6:26 ` [PATCH for-next v6 5/7] RDMA/rxe: Allow registering MRs for On-Demand Paging Daisuke Matsuda
2023-09-08 14:24 ` Jason Gunthorpe
2023-09-10 8:32 ` Zhu Yanjun
2023-09-08 6:26 ` [PATCH for-next v6 6/7] RDMA/rxe: Add support for Send/Recv/Write/Read with ODP Daisuke Matsuda
2023-09-08 14:30 ` Jason Gunthorpe
2023-09-08 6:26 ` [PATCH for-next v6 7/7] RDMA/rxe: Add support for the traditional Atomic operations " Daisuke Matsuda
2023-09-08 14:29 ` Jason Gunthorpe [this message]
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=ZPsvrTvT3CtsdWu5@ziepe.ca \
--to=jgg@ziepe.ca \
--cc=leon@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=lizhijian@fujitsu.com \
--cc=matsuda-daisuke@fujitsu.com \
--cc=rpearsonhpe@gmail.com \
--cc=y-goto@fujitsu.com \
--cc=yangx.jy@fujitsu.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