From: Tom Talpey <tom@talpey.com>
To: Chuck Lever <chuck.lever@oracle.com>,
linux-rdma@vger.kernel.org, linux-nfs@vger.kernel.org
Subject: Re: [PATCH v1 5/9] xprtrdma: Add ro_unmap_sync method for FMR
Date: Mon, 23 Nov 2015 19:57:42 -0500 [thread overview]
Message-ID: <5653B606.3070700@talpey.com> (raw)
In-Reply-To: <20151123221430.32702.86114.stgit@manet.1015granger.net>
On 11/23/2015 5:14 PM, Chuck Lever wrote:
> FMR's ro_unmap method is already synchronous because ib_unmap_fmr()
> is a synchronous verb. However, some improvements can be made here.
I thought FMR support was about to be removed in the core.
>
> 1. Gather all the MRs for the RPC request onto a list, and invoke
> ib_unmap_fmr() once with that list. This reduces the number of
> doorbells when there is more than one MR to invalidate
>
> 2. Perform the DMA unmap _after_ the MRs are unmapped, not before.
> This is critical after invalidating a Write chunk.
>
> Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
> ---
> net/sunrpc/xprtrdma/fmr_ops.c | 64 +++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 64 insertions(+)
>
> diff --git a/net/sunrpc/xprtrdma/fmr_ops.c b/net/sunrpc/xprtrdma/fmr_ops.c
> index f1e8daf..c14f3a4 100644
> --- a/net/sunrpc/xprtrdma/fmr_ops.c
> +++ b/net/sunrpc/xprtrdma/fmr_ops.c
> @@ -179,6 +179,69 @@ out_maperr:
> return rc;
> }
>
> +static void
> +__fmr_dma_unmap(struct rpcrdma_xprt *r_xprt, struct rpcrdma_mr_seg *seg)
> +{
> + struct ib_device *device = r_xprt->rx_ia.ri_device;
> + struct rpcrdma_mw *mw = seg->rl_mw;
> + int nsegs = seg->mr_nsegs;
> +
> + seg->rl_mw = NULL;
> +
> + while (nsegs--)
> + rpcrdma_unmap_one(device, seg++);
> +
> + rpcrdma_put_mw(r_xprt, mw);
> +}
> +
> +/* Invalidate all memory regions that were registered for "req".
> + *
> + * Sleeps until it is safe for the host CPU to access the
> + * previously mapped memory regions.
> + */
> +static void
> +fmr_op_unmap_sync(struct rpcrdma_xprt *r_xprt, struct rpcrdma_req *req)
> +{
> + struct rpcrdma_mr_seg *seg;
> + unsigned int i, nchunks;
> + struct rpcrdma_mw *mw;
> + LIST_HEAD(unmap_list);
> + int rc;
> +
> + dprintk("RPC: %s: req %p\n", __func__, req);
> +
> + /* ORDER: Invalidate all of the req's MRs first
> + *
> + * ib_unmap_fmr() is slow, so use a single call instead
> + * of one call per mapped MR.
> + */
> + for (i = 0, nchunks = req->rl_nchunks; nchunks; nchunks--) {
> + seg = &req->rl_segments[i];
> + mw = seg->rl_mw;
> +
> + list_add(&mw->r.fmr.fmr->list, &unmap_list);
> +
> + i += seg->mr_nsegs;
> + }
> + rc = ib_unmap_fmr(&unmap_list);
> + if (rc)
> + pr_warn("%s: ib_unmap_fmr failed (%i)\n", __func__, rc);
> +
> + /* ORDER: Now DMA unmap all of the req's MRs, and return
> + * them to the free MW list.
> + */
> + for (i = 0, nchunks = req->rl_nchunks; nchunks; nchunks--) {
> + seg = &req->rl_segments[i];
> +
> + __fmr_dma_unmap(r_xprt, seg);
> +
> + i += seg->mr_nsegs;
> + seg->mr_nsegs = 0;
> + }
> +
> + req->rl_nchunks = 0;
> +}
> +
> /* Use the ib_unmap_fmr() verb to prevent further remote
> * access via RDMA READ or RDMA WRITE.
> */
> @@ -231,6 +294,7 @@ fmr_op_destroy(struct rpcrdma_buffer *buf)
>
> const struct rpcrdma_memreg_ops rpcrdma_fmr_memreg_ops = {
> .ro_map = fmr_op_map,
> + .ro_unmap_sync = fmr_op_unmap_sync,
> .ro_unmap = fmr_op_unmap,
> .ro_open = fmr_op_open,
> .ro_maxpages = fmr_op_maxpages,
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
>
next prev parent reply other threads:[~2015-11-24 0:57 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-23 22:13 [PATCH v1 0/9] NFS/RDMA client patches for 4.5 Chuck Lever
2015-11-23 22:13 ` [PATCH v1 1/9] xprtrdma: Add a safety margin for receive buffers Chuck Lever
2015-11-24 0:55 ` Tom Talpey
2015-11-24 1:16 ` Chuck Lever
2015-11-24 1:22 ` Tom Talpey
2015-11-24 1:44 ` Chuck Lever
2015-11-23 22:14 ` [PATCH v1 2/9] xprtrdma: Move struct ib_send_wr off the stack Chuck Lever
2015-11-23 22:14 ` [PATCH v1 3/9] xprtrdma: Introduce ro_unmap_sync method Chuck Lever
2015-11-24 6:45 ` Christoph Hellwig
2015-11-24 7:28 ` Jason Gunthorpe
2015-11-24 10:59 ` Sagi Grimberg
2015-11-24 13:43 ` Tom Talpey
2015-11-24 14:40 ` Sagi Grimberg
2015-11-24 14:39 ` Chuck Lever
2015-11-24 14:44 ` Sagi Grimberg
2015-11-24 15:20 ` Chuck Lever
2015-11-24 18:57 ` Jason Gunthorpe
2015-11-23 22:14 ` [PATCH v1 4/9] xprtrdma: Add ro_unmap_sync method for FRWR Chuck Lever
2015-11-23 22:14 ` [PATCH v1 5/9] xprtrdma: Add ro_unmap_sync method for FMR Chuck Lever
2015-11-24 0:57 ` Tom Talpey [this message]
2015-11-24 6:52 ` Future of FMR support, was: " Christoph Hellwig
2015-11-24 7:12 ` Jason Gunthorpe
2015-12-01 15:33 ` Chuck Lever
2015-12-02 12:27 ` Christoph Hellwig
2015-11-24 12:36 ` Tom Talpey
2015-11-24 21:54 ` santosh shilimkar
2015-11-25 9:00 ` Christoph Hellwig
2015-11-25 17:09 ` santosh shilimkar
2015-11-25 18:22 ` Or Gerlitz
2015-11-25 19:17 ` santosh shilimkar
2015-11-25 19:28 ` Jason Gunthorpe
2015-11-26 10:01 ` Sagi Grimberg
2015-11-23 22:14 ` [PATCH v1 6/9] xprtrdma: Add ro_unmap_sync method for all-physical registration Chuck Lever
2015-11-23 22:14 ` [PATCH v1 7/9] SUNRPC: Introduct xprt_commit_rqst() Chuck Lever
2015-11-24 19:54 ` Anna Schumaker
2015-11-24 19:56 ` Chuck Lever
2015-11-23 22:14 ` [PATCH v1 8/9] xprtrdma: Invalidate in the RPC reply handler Chuck Lever
2015-11-24 1:01 ` Tom Talpey
2015-11-23 22:15 ` [PATCH v1 9/9] xprtrdma: Revert commit e7104a2a9606 ('xprtrdma: Cap req_cqinit') Chuck Lever
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=5653B606.3070700@talpey.com \
--to=tom@talpey.com \
--cc=chuck.lever@oracle.com \
--cc=linux-nfs@vger.kernel.org \
--cc=linux-rdma@vger.kernel.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).