Linux NFS development
 help / color / mirror / Atom feed
From: "J. Bruce Fields" <bfields@fieldses.org>
To: Tom Tucker <tom@opengridcomputing.com>
Cc: linux-nfs@vger.kernel.org
Subject: Re: [PATCH  2/17] svcrdma: Fix race with dto_tasklet in svc_rdma_send
Date: Mon, 5 May 2008 18:06:36 -0400	[thread overview]
Message-ID: <20080505220636.GG12814@fieldses.org> (raw)
In-Reply-To: <12097457223351-git-send-email-tom@opengridcomputing.com>

On Fri, May 02, 2008 at 11:28:34AM -0500, Tom Tucker wrote:
> The svc_rdma_send function will attempt to reap SQ WR to make room for
> a new request if it finds the SQ full. This function races with the
> dto_tasklet that also reaps SQ WR. To avoid calling the function
> unnecessarily use test_and_clear_bit with the RDMAXPRT_SQ_PENDING
> flag to serialize access to the sq_cq_reap function.

OK.  I won't pretend to understand much of this, but--would it be worth
pulling out the added code here into a helper function, since it now
exists in two different places?  (Especially if correctness depends on
the same thing happening in both the places this bit can be cleared.)

--b.

> 
> Signed-off-by: Tom Tucker <tom@opengridcomputing.com>
> 
> ---
>  net/sunrpc/xprtrdma/svc_rdma_transport.c |    8 ++++++--
>  1 files changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/net/sunrpc/xprtrdma/svc_rdma_transport.c b/net/sunrpc/xprtrdma/svc_rdma_transport.c
> index 1e0af2f..14f83a1 100644
> --- a/net/sunrpc/xprtrdma/svc_rdma_transport.c
> +++ b/net/sunrpc/xprtrdma/svc_rdma_transport.c
> @@ -1010,8 +1010,12 @@ int svc_rdma_send(struct svcxprt_rdma *xprt, struct ib_send_wr *wr)
>  		if (xprt->sc_sq_depth == atomic_read(&xprt->sc_sq_count)) {
>  			spin_unlock_bh(&xprt->sc_lock);
>  			atomic_inc(&rdma_stat_sq_starve);
> -			/* See if we can reap some SQ WR */
> -			sq_cq_reap(xprt);
> +
> +			/* See if we can opportunistically reap SQ WR to make room */
> +			if (test_and_clear_bit(RDMAXPRT_SQ_PENDING, &xprt->sc_flags)) {
> +				ib_req_notify_cq(xprt->sc_sq_cq, IB_CQ_NEXT_COMP);
> +				sq_cq_reap(xprt);
> +			}
>  
>  			/* Wait until SQ WR available if SQ still full */
>  			wait_event(xprt->sc_send_wait,

  parent reply	other threads:[~2008-05-05 22:06 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1209745721600-git-send-email-tom@opengridcomputing.com>
2008-05-02 22:37 ` [PATCH 0/17] svcrdma: RDMA transport driver close path cleanup J. Bruce Fields
2008-05-02 23:05   ` Tom Tucker
     [not found] ` <12097457211326-git-send-email-tom@opengridcomputing.com>
     [not found]   ` <1209745721248-git-send-email-tom@opengridcomputing.com>
     [not found]     ` <12097457213375-git-send-email-tom@opengridcomputing.com>
2008-05-05 19:31       ` [PATCH 1/17] svcrdma: Simplify receive buffer posting J. Bruce Fields
     [not found]       ` <12097457212336-git-send-email-tom@opengridcomputing.com>
     [not found]         ` <12097457212951-git-send-email-tom@opengridcomputing.com>
     [not found]           ` <12097457211122-git-send-email-tom@opengridcomputing.com>
     [not found]             ` <12097457223433-git-send-email-tom@opengridcomputing.com>
     [not found]               ` <12097457223971-git-send-email-tom@opengridcomputing.com>
     [not found]                 ` <12097457223635-git-send-email-tom@opengridcomputing.com>
     [not found]                   ` <12097457223351-git-send-email-tom@opengridcomputing.com>
2008-05-05 22:06                     ` J. Bruce Fields [this message]
2008-05-06  2:26                       ` [PATCH 2/17] svcrdma: Fix race with dto_tasklet in svc_rdma_send Tom Tucker
2008-05-06 21:18                         ` J. Bruce Fields
2008-05-07  0:45                           ` Tom Tucker
     [not found]                     ` <12097457221640-git-send-email-tom@opengridcomputing.com>
2008-05-05 22:08                       ` [PATCH 3/17] svcrdma: Fix return value " J. Bruce Fields
2008-05-06  2:03                         ` Tom Tucker
2008-05-06 21:08                           ` J. Bruce Fields
     [not found]                       ` <120974572253-git-send-email-tom@opengridcomputing.com>
     [not found]                         ` <12097457223519-git-send-email-tom@opengridcomputing.com>
     [not found]                           ` <12097457223927-git-send-email-tom@opengridcomputing.com>
     [not found]                             ` <12097457232986-git-send-email-tom@opengridcomputing.com>
2008-05-05 22:41                               ` [PATCH 7/17] svcrdma: Fix error handling during listening endpoint creation J. Bruce Fields
2008-05-06 14:48                                 ` Tom Tucker
2008-05-06 21:22                                   ` J. Bruce Fields
2008-05-07  0:48                                     ` Tom Tucker
2008-05-07  1:30                                       ` J. Bruce Fields
     [not found]                               ` <12097457231736-git-send-email-tom@opengridcomputing.com>
2008-05-05 22:52                                 ` [PATCH 8/17] svcrdma: Return error from rdma_read_xdr so caller knows to free context J. Bruce Fields
2008-05-06  2:05                                   ` Tom Tucker
2008-05-06 21:32     ` [PATCH 11/17] svcrdma: Use standard Linux lists for context cache J. Bruce Fields
2008-05-07  0:49       ` Tom Tucker
2008-05-06 21:46 ` [PATCH 0/17] svcrdma: RDMA transport driver close path cleanup J. Bruce Fields

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=20080505220636.GG12814@fieldses.org \
    --to=bfields@fieldses.org \
    --cc=linux-nfs@vger.kernel.org \
    --cc=tom@opengridcomputing.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