Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp679008pxf; Thu, 1 Apr 2021 10:43:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyYu/hNed1gV93cK6brxT+Sjo4k0IESOSTimiYqqTQmQrMBwOWJ7Ez9sPOKP0sngnyeuNMi X-Received: by 2002:aa7:c709:: with SMTP id i9mr11391759edq.319.1617299012308; Thu, 01 Apr 2021 10:43:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617299012; cv=none; d=google.com; s=arc-20160816; b=zjbMsZDsNidWbBMsRDBWcnfQM/uBfqBwYM5qmVTbw73JAcUWnoWn3K65AcC14uHrqs 9XPjzGjEDRnKaOBnm/jp0soKBMHd/J/tWMm1ItfIiHBNyR8IPCudWMfPRA1h7qy5C29g TgMHmY7J1K2kf+B9Nw1QGJBk41x+0q4xwt53USbGv+BsqCF3FfHxM6LYXNNH5TuSXm7Z mb+p61vfRBO7Mqn7NnQ60ZefUPVPCXS75MlBvCPx6MjAqqeWyoS8gFaD5nREzfs5Wkyn y6mBvQ1jutjXQLbMnHeZP7bXYhv43dDdhHCXtAxRLqsQlSHQMTi3gnWR1Pu3+LAq8WxS LEhA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=wO8Dojv7wME+ubk+Yh3ZKiafoFd7I1oLkJMSO3Y31sI=; b=P2S5bV9jyB30IdXJG3Y/+BolQh+U8t+n3zHtWBRxZ4xj+JDIlpezsrtgJ/aLVNE53f mvpu+umoqZHru3n/VrrXBtFoWiltPpDhMjGio25j+ge3Hiw2MNQ97UEAKYVH2Z5wdOhn ZwR0OFPjj9LWHWI7EVxarkUnVTgS+Uex75HrYrg1bAVQStHJyiKmvdbOqES9KOZq7EQT IYHtywTw1syl4aBN4iC9PuKPlmXb6H1XnkPRzwopgZBCk5A5dQ/usDG/GgEZ6FTc2BCL H0ScXbXvc+SxUX4VdGF7xj5qlq6yG1mX0xidLf0v++fS7HDX72RZGlLCh4AvI+3ySczh wnFA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=F3O2zCAb; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y18si4573054ejj.628.2021.04.01.10.42.56; Thu, 01 Apr 2021 10:43:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=F3O2zCAb; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234658AbhDARl7 (ORCPT + 99 others); Thu, 1 Apr 2021 13:41:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57170 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234856AbhDARky (ORCPT ); Thu, 1 Apr 2021 13:40:54 -0400 Received: from mail-lj1-x236.google.com (mail-lj1-x236.google.com [IPv6:2a00:1450:4864:20::236]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 04F54C03116E; Thu, 1 Apr 2021 09:56:30 -0700 (PDT) Received: by mail-lj1-x236.google.com with SMTP id u4so2983841ljo.6; Thu, 01 Apr 2021 09:56:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=wO8Dojv7wME+ubk+Yh3ZKiafoFd7I1oLkJMSO3Y31sI=; b=F3O2zCAbbReZgeHKtbw0aXK2qQlf7F/t03hUelxOfQugiFwprHSLhgAmndLRyhp1eu xD+huyb1UwBnI2IhJFwFLD6bC3DFEp/nV2VqnXwz4Z+UQ9gPjcwRk/qHtnBWHLf/mAMU 27lOxowYfM7hfYr4eaYwmbJFgQXm+U9xHJAhoHR0YQpG46pKHL86lxLTvIRkQHbyP68r E+GCoG8AHmtjN5znoQ1bqMrOapzAotTU4Ieze/dDFVTUmF9lXtwLP0DdTEKHBpgWLksF UDQGQ4y7zcArnQk5FyBtctEj/9vPtSB9cmWmtVjWGRr9hKsl17dWe7xH0XvSuTV5nGs4 uE7g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=wO8Dojv7wME+ubk+Yh3ZKiafoFd7I1oLkJMSO3Y31sI=; b=cteK/QAZMNsuYjC5c5iw6fUc43fgZlIEFFKwQuLbvWdYK9MZBzRR379AJL9Be+K6ZE 3WUyuYoNxpiaJu8V/iHxUygJdAkRTS3FSRo4ubUBNMk3ns5iQt1PsLDKyo3F9+WK/UBo Sl6ENjP1BOVAy4qbZtddvH41PeYvoWsBLFllr6LOccBYioUHDXIUBCO1AH0H19N3mfTd 6wlGnb4w5lHPePzXSRvBVUyGFat9RElfGfU6SgE9qOCPBRD7UCQUyxFV+sMMnOe9rtCE +fMX2z0+v+IlEY/0yois0tKVgJCuXLIhka+KLN9luiqFXRkuexbmLe8Yo6GqLVOwyNCo mjKQ== X-Gm-Message-State: AOAM5329jokitcDXaqKBSuVThIyjb3wuT0T9sec5bJHVluEKrB6Sx7yO VpVBYTIuh8qhJE6Gb8sALkTrco4HnjwSTbtB1V0= X-Received: by 2002:a2e:a0cf:: with SMTP id f15mr6281590ljm.29.1617296188589; Thu, 01 Apr 2021 09:56:28 -0700 (PDT) MIME-Version: 1.0 References: <161721926778.515226.9805598788670386587.stgit@manet.1015granger.net> <161721937122.515226.14731175629421422152.stgit@manet.1015granger.net> <4004f56f-3603-f56c-aea9-651230b3181e@talpey.com> In-Reply-To: From: Chuck Lever Date: Thu, 1 Apr 2021 12:56:17 -0400 Message-ID: Subject: Re: [PATCH v1 2/8] xprtrdma: Do not post Receives after disconnect To: Tom Talpey Cc: linux-rdma , Linux NFS Mailing List Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org On Wed, Mar 31, 2021 at 5:22 PM Tom Talpey wrote: > > On 3/31/2021 4:31 PM, Chuck Lever wrote: > > On Wed, Mar 31, 2021 at 4:01 PM Tom Talpey wrote: > >> > >> On 3/31/2021 3:36 PM, Chuck Lever wrote: > >>> Currently the Receive completion handler refreshes the Receive Queue > >>> whenever a successful Receive completion occurs. > >>> > >>> On disconnect, xprtrdma drains the Receive Queue. The first few > >>> Receive completions after a disconnect are typically successful, > >>> until the first flushed Receive. > snip > >> Is it not possible to mark the WRs as > >> being part of a batch, and allowing them to flush? You could borrow a > >> bit in the completion cookie, and check it when the CQE pops out. Maybe. > > > > It's not an issue with batching, it's an issue with posting Receives from the > > Receive completion handler. I'd think that any of the ULPs that post Receives > > in their completion handler would have the same issue. > > > > The purpose of the QP drain in rpcrdma_xprt_disconnect() is to ensure there > > are no more WRs in flight so that the hardware resources can be safely > > destroyed. If the Receive completion handler continues to post Receive WRs > > after the drain sentinel has been posted, leaks and crashes become possible. > Well, why not do an atomic_set() of a flag just before posting the > sentinel, and check it with atomic_get() before any other RQ post? After a couple of private exchanges, Tom and I agree that doing an ib_query_qp() in rpcrdma_post_recvs() has some drawbacks and does not fully close the race window. There is nothing that prevents rpcrdma_xprt_disconnect() from starting the RQ drain while rpcrdma_post_recvs is still running. There needs to be serialization between ib_drain_rq() and rpcrdma_post_recvs() so that the drain sentinel is guaranteed to be the final Receive WR posted on the RQ. It would be great if the core ib_drain_rq() API itself could handle the exclusion. -- "We cannot take our next breath without the exhale." -- Ellen Scott Grable