Received: by 2002:a05:7412:bbc7:b0:fc:a2b0:25d7 with SMTP id kh7csp2096125rdb; Sun, 4 Feb 2024 15:17:18 -0800 (PST) X-Google-Smtp-Source: AGHT+IHsQwmIWzCgNbHJPuMW055OGC9LuB1TbFM7eGssN3h73Y8BRyUnHy3vQD+DC710hFWBB3zS X-Received: by 2002:a17:902:d486:b0:1d9:c01a:dee6 with SMTP id c6-20020a170902d48600b001d9c01adee6mr158312plg.44.1707088637906; Sun, 04 Feb 2024 15:17:17 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707088637; cv=pass; d=google.com; s=arc-20160816; b=P3YBPmO04GHgf7GHlP3iQ1Rxu04myssg5pb46VDJNS6fl67mpT8ZNus8ijyiWQB+VD IB+6eD+tNuBXoFLQgk7Fg5tH1aPJvNZJnl1KDt7UC2RM5JSbFFZTVaSLkWZO0feVEupm yCr9JmJxoeDHPzU9VtiTyTIM/2M0o+Jkx9632CbCYP2FKd25TvUTZZadOCGFsZtIiVCn 4opaFCDpOZP3q+2rwI9l9J25q99k2cREybpGYZpfSOdKSsYRLZNcJW4p5ahbveD5o8dW fZoVLuiegSS8AGZGBLD/FF0WVYEkY+1TuvIsRQcxdr9aZYCOgGaCSWr4HkiTPeevWnLG SfwA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:user-agent:references:in-reply-to :message-id:date:to:from:subject:dkim-signature; bh=NZY79dtY2kUpYCGAaUKNQThLIfwgU/EX8/dkTc9kj1E=; fh=KyVmlDXHII+0hBefCKRoJMMFTXdFeos7iZvyxSH2wrw=; b=J+cs/hFWmcmMmsVJME+MYT+y8diAXswIYIzLOs+zjR8GRw2Yy8kqEFSJd5SC1WDsoe v+1m8b78kVrxmru44nRRc+GjmpAmh/zHBfQ5Y5VXDmp4HlJx2xbH6WDAbNmWNvEh/C3S EKIsf4rabdCkxacdcK+w1TKgOVSmrVB+W2s7cVpssPq95z+ptKDH6jy11lUHA27nBdvS 2RIleTudwvKiMel4CQF+Qfl3QEc+GAHv0YxWkx7d/NeS7NXajk47zg0oQRxRDQkSAf4v jwqk7VwAbjsbdZ3P63KJupj5bhv/+atQn1LYPwWUSM0bioO7VXd/9OSYweLTKJO1fczg BqOg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Cc0IUMvV; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-nfs+bounces-1755-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-nfs+bounces-1755-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org X-Forwarded-Encrypted: i=1; AJvYcCWnpRAWQuYNqxLnpoFgSomnC8BW/fuU2nMAv+RSYLLmbjuAikuLqQKu1Y9BohNUe9EoCF+8LrD0TQDBy9l96LPV8h9JukAgHPUSm1nfgw== Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id m15-20020a170902db0f00b001d8e974ed31si5281705plx.623.2024.02.04.15.17.17 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 04 Feb 2024 15:17:17 -0800 (PST) Received-SPF: pass (google.com: domain of linux-nfs+bounces-1755-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Cc0IUMvV; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-nfs+bounces-1755-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-nfs+bounces-1755-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id D32F2B217BD for ; Sun, 4 Feb 2024 23:17:11 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id ACD85881E; Sun, 4 Feb 2024 23:16:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Cc0IUMvV" X-Original-To: linux-nfs@vger.kernel.org Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 85D7ADDB2; Sun, 4 Feb 2024 23:16:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707088618; cv=none; b=B8POd+fUi92Q1F+T5yVcs+BOy5YX2XCESSpducwkzcPwwh20bIPzleS3fWv3JZHZsZTxd+oZ8aGe1XWcYOqmy2B7edWwdVGc2UUUvD2qt+Hsp+Aa1+Gt0iLcwl8ot6llNbInxLqafns5DQrroi0r/zQYDm/S8vtxI1IFnFXEU6Y= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707088618; c=relaxed/simple; bh=+V9dSTnar5Zbg2d9qB3pTwMQy1aH5p5NMLsE+cUSjSw=; h=Subject:From:To:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Dix5Upjb69Tf3a03CfAeQnzf9qoyHV9PJAnJBY38pLHMK4+w34mIV5+vEU/y1+xYmfQYdZpHrq/HU7UK4kR/CLg/uMkvzhR84L8NyfDxODLTuozf2GHdJv0UaEgPJnuf2jsuz99ovVRty+6habm5Inrub8ZzLkumVJiL4DK9sho= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Cc0IUMvV; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id D5C52C433C7; Sun, 4 Feb 2024 23:16:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1707088618; bh=+V9dSTnar5Zbg2d9qB3pTwMQy1aH5p5NMLsE+cUSjSw=; h=Subject:From:To:Date:In-Reply-To:References:From; b=Cc0IUMvVz4uDtfTNW7ITk0Im4g2H4o8cwHMHYwy+la43eePM5s4QNhgtdfzLQ66bx wH7sDhiR8yT0gFEUFkS2QrY+Gz5CvM2kTeY2GRR2qG7dWt2SA02zH04ZP+4khLbBAZ 7amgAbkAE8X7Y/733KINY4lFLmOWwfY8ITF9zHLtKNc6yQ+1bFUYd0kN2o97lh8FpX ueEb5xD5KmtZPqmBGyn23wWx/58NHh75OlOxAo5CUtJTv786JVdy9p2bMYnJMQODmN /qgiVIogXxV/WHB7BjPoWzkD21ZDp8tA7gX55UmhF0YaeiZcnBrpuyk6h6T4G0iVCG CUigivrIca2pw== Subject: [PATCH v2 04/12] svcrdma: Increase the per-transport rw_ctx count From: Chuck Lever To: linux-nfs@vger.kernel.org, linux-rdma@vger.kernel.org Date: Sun, 04 Feb 2024 18:16:56 -0500 Message-ID: <170708861688.28128.16380294131274226696.stgit@bazille.1015granger.net> In-Reply-To: <170708844422.28128.2979813721958631192.stgit@bazille.1015granger.net> References: <170708844422.28128.2979813721958631192.stgit@bazille.1015granger.net> User-Agent: StGit/1.5 Precedence: bulk X-Mailing-List: linux-nfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit From: Chuck Lever rdma_rw_mr_factor() returns the smallest number of MRs needed to move a particular number of pages. svcrdma currently asks for the number of MRs needed to move RPCSVC_MAXPAGES (a little over one megabyte), as that is the number of pages in the largest r/wsize the server supports. This call assumes that the client's NIC can bundle a full one megabyte payload in a single rdma_segment. In fact, most NICs cannot handle a full megabyte with a single rkey / rdma_segment. Clients will typically split even a single Read chunk into many segments. The server needs one MR to read each rdma_segment in a Read chunk, and thus each one needs an rw_ctx. svcrdma has been vastly underestimating the number of rw_ctxs needed to handle 64 RPC requests with large Read chunks using small rdma_segments. Unfortunately there doesn't seem to be a good way to estimate this number without knowing the client NIC's capabilities. Even then, the client RPC/RDMA implementation is still free to split a chunk into smaller segments (for example, it might be using physical registration, which needs an rdma_segment per page). The best we can do for now is choose a number that will guarantee forward progress in the worst case (one page per segment). At some later point, we could add some mechanisms to make this much less of a problem: - Add a core API to add more rw_ctxs to an already-established QP - svcrdma could treat rw_ctx exhaustion as a temporary error and try again - Limit the number of Reads in flight Signed-off-by: Chuck Lever --- net/sunrpc/xprtrdma/svc_rdma_transport.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/net/sunrpc/xprtrdma/svc_rdma_transport.c b/net/sunrpc/xprtrdma/svc_rdma_transport.c index 839c0e80e5cd..2b1c16b9547d 100644 --- a/net/sunrpc/xprtrdma/svc_rdma_transport.c +++ b/net/sunrpc/xprtrdma/svc_rdma_transport.c @@ -422,8 +422,13 @@ static struct svc_xprt *svc_rdma_accept(struct svc_xprt *xprt) newxprt->sc_max_requests = rq_depth - 2; newxprt->sc_max_bc_requests = 2; } - ctxts = rdma_rw_mr_factor(dev, newxprt->sc_port_num, RPCSVC_MAXPAGES); - ctxts *= newxprt->sc_max_requests; + + /* Arbitrarily estimate the number of rw_ctxs needed for + * this transport. This is enough rw_ctxs to make forward + * progress even if the client is using one rkey per page + * in each Read chunk. + */ + ctxts = 3 * RPCSVC_MAXPAGES; newxprt->sc_sq_depth = rq_depth + ctxts; if (newxprt->sc_sq_depth > dev->attrs.max_qp_wr) newxprt->sc_sq_depth = dev->attrs.max_qp_wr;