From: Sagi Grimberg <sagig@dev.mellanox.co.il>
To: Chuck Lever <chuck.lever@oracle.com>,
linux-rdma@vger.kernel.org, linux-nfs@vger.kernel.org
Subject: Re: [PATCH v1 15/18] svcrdma: Add svc_rdma_get_context() API that is allowed to fail
Date: Sun, 20 Sep 2015 15:40:49 +0300 [thread overview]
Message-ID: <55FEA951.8000106@dev.mellanox.co.il> (raw)
In-Reply-To: <20150917204614.19671.61606.stgit@manet.1015granger.net>
On 9/17/2015 11:46 PM, Chuck Lever wrote:
> To support backward direction calls, I'm going to add an
> svc_rdma_get_context() call in the client RDMA transport.
>
> Called from ->buf_alloc(), we can't sleep waiting for memory.
> So add an API that can get a server op_ctxt but won't sleep.
>
> Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
> ---
> include/linux/sunrpc/svc_rdma.h | 2 ++
> net/sunrpc/xprtrdma/svc_rdma_transport.c | 28 +++++++++++++++++++++++-----
> 2 files changed, 25 insertions(+), 5 deletions(-)
>
> diff --git a/include/linux/sunrpc/svc_rdma.h b/include/linux/sunrpc/svc_rdma.h
> index 6ce7495..2500dd1 100644
> --- a/include/linux/sunrpc/svc_rdma.h
> +++ b/include/linux/sunrpc/svc_rdma.h
> @@ -224,6 +224,8 @@ extern void svc_rdma_send_error(struct svcxprt_rdma *, struct rpcrdma_msg *,
> extern int svc_rdma_post_recv(struct svcxprt_rdma *);
> extern int svc_rdma_create_listen(struct svc_serv *, int, struct sockaddr *);
> extern struct svc_rdma_op_ctxt *svc_rdma_get_context(struct svcxprt_rdma *);
> +extern struct svc_rdma_op_ctxt *svc_rdma_get_context_gfp(struct svcxprt_rdma *,
> + gfp_t);
> extern void svc_rdma_put_context(struct svc_rdma_op_ctxt *, int);
> extern void svc_rdma_unmap_dma(struct svc_rdma_op_ctxt *ctxt);
> extern struct svc_rdma_req_map *svc_rdma_get_req_map(void);
> diff --git a/net/sunrpc/xprtrdma/svc_rdma_transport.c b/net/sunrpc/xprtrdma/svc_rdma_transport.c
> index 23aba30..c4083a3 100644
> --- a/net/sunrpc/xprtrdma/svc_rdma_transport.c
> +++ b/net/sunrpc/xprtrdma/svc_rdma_transport.c
> @@ -153,17 +153,35 @@ static void svc_rdma_bc_free(struct svc_xprt *xprt)
> }
> #endif /* CONFIG_SUNRPC_BACKCHANNEL */
>
> -struct svc_rdma_op_ctxt *svc_rdma_get_context(struct svcxprt_rdma *xprt)
> +static void svc_rdma_init_context(struct svcxprt_rdma *xprt,
> + struct svc_rdma_op_ctxt *ctxt)
> {
> - struct svc_rdma_op_ctxt *ctxt;
> -
> - ctxt = kmem_cache_alloc(svc_rdma_ctxt_cachep,
> - GFP_KERNEL | __GFP_NOFAIL);
> ctxt->xprt = xprt;
> INIT_LIST_HEAD(&ctxt->dto_q);
> ctxt->count = 0;
> ctxt->frmr = NULL;
> atomic_inc(&xprt->sc_ctxt_used);
> +}
> +
> +struct svc_rdma_op_ctxt *svc_rdma_get_context_gfp(struct svcxprt_rdma *xprt,
> + gfp_t flags)
> +{
> + struct svc_rdma_op_ctxt *ctxt;
> +
> + ctxt = kmem_cache_alloc(svc_rdma_ctxt_cachep, flags);
> + if (!ctxt)
> + return NULL;
> + svc_rdma_init_context(xprt, ctxt);
> + return ctxt;
> +}
> +
> +struct svc_rdma_op_ctxt *svc_rdma_get_context(struct svcxprt_rdma *xprt)
> +{
Why not:
return svc_rdma_get_context_gfp(xprt, GFP_KERNEL | __GFP_NOFAIL);
?
> + struct svc_rdma_op_ctxt *ctxt;
> +
> + ctxt = kmem_cache_alloc(svc_rdma_ctxt_cachep,
> + GFP_KERNEL | __GFP_NOFAIL);
> + svc_rdma_init_context(xprt, ctxt);
> return ctxt;
> }
>
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
WARNING: multiple messages have this Message-ID (diff)
From: Sagi Grimberg <sagig-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
To: Chuck Lever <chuck.lever-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>,
linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-nfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH v1 15/18] svcrdma: Add svc_rdma_get_context() API that is allowed to fail
Date: Sun, 20 Sep 2015 15:40:49 +0300 [thread overview]
Message-ID: <55FEA951.8000106@dev.mellanox.co.il> (raw)
In-Reply-To: <20150917204614.19671.61606.stgit-FYjufvaPoItvLzlybtyyYzGyq/o6K9yX@public.gmane.org>
On 9/17/2015 11:46 PM, Chuck Lever wrote:
> To support backward direction calls, I'm going to add an
> svc_rdma_get_context() call in the client RDMA transport.
>
> Called from ->buf_alloc(), we can't sleep waiting for memory.
> So add an API that can get a server op_ctxt but won't sleep.
>
> Signed-off-by: Chuck Lever <chuck.lever-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
> ---
> include/linux/sunrpc/svc_rdma.h | 2 ++
> net/sunrpc/xprtrdma/svc_rdma_transport.c | 28 +++++++++++++++++++++++-----
> 2 files changed, 25 insertions(+), 5 deletions(-)
>
> diff --git a/include/linux/sunrpc/svc_rdma.h b/include/linux/sunrpc/svc_rdma.h
> index 6ce7495..2500dd1 100644
> --- a/include/linux/sunrpc/svc_rdma.h
> +++ b/include/linux/sunrpc/svc_rdma.h
> @@ -224,6 +224,8 @@ extern void svc_rdma_send_error(struct svcxprt_rdma *, struct rpcrdma_msg *,
> extern int svc_rdma_post_recv(struct svcxprt_rdma *);
> extern int svc_rdma_create_listen(struct svc_serv *, int, struct sockaddr *);
> extern struct svc_rdma_op_ctxt *svc_rdma_get_context(struct svcxprt_rdma *);
> +extern struct svc_rdma_op_ctxt *svc_rdma_get_context_gfp(struct svcxprt_rdma *,
> + gfp_t);
> extern void svc_rdma_put_context(struct svc_rdma_op_ctxt *, int);
> extern void svc_rdma_unmap_dma(struct svc_rdma_op_ctxt *ctxt);
> extern struct svc_rdma_req_map *svc_rdma_get_req_map(void);
> diff --git a/net/sunrpc/xprtrdma/svc_rdma_transport.c b/net/sunrpc/xprtrdma/svc_rdma_transport.c
> index 23aba30..c4083a3 100644
> --- a/net/sunrpc/xprtrdma/svc_rdma_transport.c
> +++ b/net/sunrpc/xprtrdma/svc_rdma_transport.c
> @@ -153,17 +153,35 @@ static void svc_rdma_bc_free(struct svc_xprt *xprt)
> }
> #endif /* CONFIG_SUNRPC_BACKCHANNEL */
>
> -struct svc_rdma_op_ctxt *svc_rdma_get_context(struct svcxprt_rdma *xprt)
> +static void svc_rdma_init_context(struct svcxprt_rdma *xprt,
> + struct svc_rdma_op_ctxt *ctxt)
> {
> - struct svc_rdma_op_ctxt *ctxt;
> -
> - ctxt = kmem_cache_alloc(svc_rdma_ctxt_cachep,
> - GFP_KERNEL | __GFP_NOFAIL);
> ctxt->xprt = xprt;
> INIT_LIST_HEAD(&ctxt->dto_q);
> ctxt->count = 0;
> ctxt->frmr = NULL;
> atomic_inc(&xprt->sc_ctxt_used);
> +}
> +
> +struct svc_rdma_op_ctxt *svc_rdma_get_context_gfp(struct svcxprt_rdma *xprt,
> + gfp_t flags)
> +{
> + struct svc_rdma_op_ctxt *ctxt;
> +
> + ctxt = kmem_cache_alloc(svc_rdma_ctxt_cachep, flags);
> + if (!ctxt)
> + return NULL;
> + svc_rdma_init_context(xprt, ctxt);
> + return ctxt;
> +}
> +
> +struct svc_rdma_op_ctxt *svc_rdma_get_context(struct svcxprt_rdma *xprt)
> +{
Why not:
return svc_rdma_get_context_gfp(xprt, GFP_KERNEL | __GFP_NOFAIL);
?
> + struct svc_rdma_op_ctxt *ctxt;
> +
> + ctxt = kmem_cache_alloc(svc_rdma_ctxt_cachep,
> + GFP_KERNEL | __GFP_NOFAIL);
> + svc_rdma_init_context(xprt, ctxt);
> return ctxt;
> }
>
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
> the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2015-09-20 12:40 UTC|newest]
Thread overview: 84+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-17 20:44 [PATCH v1 00/18] RFC NFS/RDMA patches for merging into v4.4 Chuck Lever
2015-09-17 20:44 ` Chuck Lever
2015-09-17 20:44 ` [PATCH v1 01/18] xprtrdma: Enable swap-on-NFS/RDMA Chuck Lever
2015-09-17 20:44 ` Chuck Lever
2015-09-21 8:58 ` Devesh Sharma
2015-09-21 8:58 ` Devesh Sharma
2015-09-17 20:44 ` [PATCH v1 02/18] xprtrdma: Replace global lkey with lkey local to PD Chuck Lever
2015-09-17 20:44 ` Chuck Lever
2015-09-21 8:59 ` Devesh Sharma
2015-09-21 8:59 ` Devesh Sharma
2015-09-17 20:44 ` [PATCH v1 03/18] xprtrdma: Remove completion polling budgets Chuck Lever
2015-09-17 20:44 ` Chuck Lever
2015-09-18 6:52 ` Devesh Sharma
2015-09-18 6:52 ` Devesh Sharma
2015-09-18 14:19 ` Chuck Lever
2015-09-18 14:19 ` Chuck Lever
2015-09-20 10:35 ` Sagi Grimberg
2015-09-20 10:35 ` Sagi Grimberg
2015-09-21 8:51 ` Devesh Sharma
2015-09-21 8:51 ` Devesh Sharma
2015-09-21 15:45 ` Chuck Lever
2015-09-21 15:45 ` Chuck Lever
2015-09-22 17:32 ` Devesh Sharma
2015-09-22 17:32 ` Devesh Sharma
2015-10-01 16:37 ` Chuck Lever
2015-10-01 16:37 ` Chuck Lever
2015-10-01 17:13 ` Jason Gunthorpe
2015-10-01 17:13 ` Jason Gunthorpe
2015-10-01 17:36 ` Chuck Lever
2015-10-01 17:36 ` Chuck Lever
2015-10-01 18:15 ` Jason Gunthorpe
2015-10-01 18:15 ` Jason Gunthorpe
2015-10-01 18:31 ` Chuck Lever
2015-10-01 18:31 ` Chuck Lever
2015-10-01 18:38 ` Jason Gunthorpe
2015-10-01 18:38 ` Jason Gunthorpe
2015-09-21 8:51 ` Devesh Sharma
2015-09-21 8:51 ` Devesh Sharma
2015-09-17 20:44 ` [PATCH v1 04/18] xprtrdma: Refactor reply handler error handling Chuck Lever
2015-09-17 20:44 ` Chuck Lever
2015-09-21 8:59 ` Devesh Sharma
2015-09-21 8:59 ` Devesh Sharma
2015-09-17 20:44 ` [PATCH v1 05/18] xprtrdma: Replace send and receive arrays Chuck Lever
2015-09-17 20:44 ` Chuck Lever
2015-09-20 10:52 ` Sagi Grimberg
2015-09-20 10:52 ` Sagi Grimberg
2015-09-21 23:04 ` Chuck Lever
2015-09-21 23:04 ` Chuck Lever
2015-09-17 20:45 ` [PATCH v1 06/18] SUNRPC: Abstract backchannel operations Chuck Lever
2015-09-17 20:45 ` Chuck Lever
2015-09-17 20:45 ` [PATCH v1 07/18] xprtrdma: Pre-allocate backward rpc_rqst and send/receive buffers Chuck Lever
2015-09-17 20:45 ` Chuck Lever
2015-09-21 10:28 ` Devesh Sharma
2015-09-21 10:28 ` Devesh Sharma
2015-09-17 20:45 ` [PATCH v1 08/18] xprtrdma: Pre-allocate Work Requests for backchannel Chuck Lever
2015-09-17 20:45 ` Chuck Lever
2015-09-21 10:33 ` Devesh Sharma
2015-09-21 10:33 ` Devesh Sharma
2015-09-21 22:41 ` Chuck Lever
2015-09-21 22:41 ` Chuck Lever
2015-09-17 20:45 ` [PATCH v1 09/18] xprtrdma: Add support for sending backward direction RPC replies Chuck Lever
2015-09-17 20:45 ` Chuck Lever
2015-09-17 20:45 ` [PATCH v1 10/18] xprtrdma: Handle incoming backward direction RPC calls Chuck Lever
2015-09-17 20:45 ` Chuck Lever
2015-09-17 20:45 ` [PATCH v1 11/18] svcrdma: Add backward direction service for RPC/RDMA transport Chuck Lever
2015-09-17 20:45 ` Chuck Lever
2015-09-17 20:45 ` [PATCH v1 12/18] SUNRPC: Remove the TCP-only restriction in bc_svc_process() Chuck Lever
2015-09-17 20:45 ` Chuck Lever
2015-09-17 20:45 ` [PATCH v1 13/18] NFS: Enable client side NFSv4.1 backchannel to use other transports Chuck Lever
2015-09-17 20:45 ` Chuck Lever
2015-09-17 20:46 ` [PATCH v1 14/18] svcrdma: Define maximum number of backchannel requests Chuck Lever
2015-09-17 20:46 ` Chuck Lever
2015-09-17 20:46 ` [PATCH v1 15/18] svcrdma: Add svc_rdma_get_context() API that is allowed to fail Chuck Lever
2015-09-17 20:46 ` Chuck Lever
2015-09-20 12:40 ` Sagi Grimberg [this message]
2015-09-20 12:40 ` Sagi Grimberg
2015-09-21 22:34 ` Chuck Lever
2015-09-21 22:34 ` Chuck Lever
2015-09-17 20:46 ` [PATCH v1 16/18] svcrdma: Add infrastructure to send backwards direction RPC/RDMA calls Chuck Lever
2015-09-17 20:46 ` Chuck Lever
2015-09-17 20:46 ` [PATCH v1 17/18] svcrdma: Add infrastructure to receive backwards direction RPC/RDMA replies Chuck Lever
2015-09-17 20:46 ` Chuck Lever
2015-09-17 20:46 ` [PATCH v1 18/18] xprtrdma: Add class for RDMA backwards direction transport Chuck Lever
2015-09-17 20:46 ` 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=55FEA951.8000106@dev.mellanox.co.il \
--to=sagig@dev.mellanox.co.il \
--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 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.