Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp419407pxb; Wed, 3 Feb 2021 08:28:42 -0800 (PST) X-Google-Smtp-Source: ABdhPJwhPJMciuaqrfzptnm12e1hW6ibu/BSxgUyjNBEChGUzdiJ+D6MRu8yEHxYgvQ+zRwJGYj2 X-Received: by 2002:a05:6000:188c:: with SMTP id a12mr4618534wri.105.1612369721927; Wed, 03 Feb 2021 08:28:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612369721; cv=none; d=google.com; s=arc-20160816; b=gGe1o+ctiNv3hP+R3MNjrpyfYk/A4q3aOHy9OzgYLwhsMIZQPg6XIGPSviy7IaavAz VbbV24wJBDDy5Ij7RdCRyGi7jnI+2KmbxYpt1yMUAv0uIXggYCT4hQi/Tj72DMbj1+HE 9RwNs873qYHLf+E+pj9Qewa7G/IpBZF6+TDkvJ+ykmKxeF/+CCFcDvQ3A98yEpRZ4BSO ftdFbQJdMeb6nNj+hSSXrlYSsZdLW+/LOcwSdq6CQx+gTkkaEKSW4J0+EbKyO+8whbMs nXTdhrXvLntIE7edSBuaGrP5adcvL+9O0zK0/vqrzqSMs67IS31mVVX0xTgzT0NHkP2J 2vRg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:to:from:subject; bh=NzGQuQkTIKvJPbyHmJBOxcAjM3RQEn2Ig/tRp8YJm4U=; b=jiLzvcRrRWR3vESwrgQIkbEurRlmRjouyCcmW18NrjhOaYcLXH9DfGAroJQknf2fgV pEJmA5yie6zQEhLuWNVJkZfB7cqqSId9yI9WewYudGIMHeEtK9bSSwXVMWyVbVpaeM7Q dT4gysREhRswuHzTnMjMeBfY2iAAucd2aEY5Zw/fBQmXsfhC1NRxVU/UzMzeg5LgYBGp sYjq2OGE0IlPC9hhVzav2TdquOyLAsw5dZ5QU9AFrW9L8pzjuuTi9qskVPYHXLCdzWuH EbD7wQ8ZCjFZ8j65YzQqFepIFnWzs+AUlUMa8DIb3ob/kcn7nZqdk+hXgFbDwthdB+PG C45w== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f11si1520250edu.40.2021.02.03.08.28.17; Wed, 03 Feb 2021 08:28:41 -0800 (PST) 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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233614AbhBCQZO (ORCPT + 99 others); Wed, 3 Feb 2021 11:25:14 -0500 Received: from mail.kernel.org ([198.145.29.99]:40286 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232550AbhBCQZL (ORCPT ); Wed, 3 Feb 2021 11:25:11 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 8793064F93; Wed, 3 Feb 2021 16:24:20 +0000 (UTC) Subject: [PATCH v2 5/6] xprtrdma: Pad optimization, revisited From: Chuck Lever To: linux-nfs@vger.kernel.org, linux-rdma@vger.kernel.org Date: Wed, 03 Feb 2021 11:24:19 -0500 Message-ID: <161236945965.1030487.13894327853038566730.stgit@manet.1015granger.net> In-Reply-To: <161236925476.1030487.10407536259816633879.stgit@manet.1015granger.net> References: <161236925476.1030487.10407536259816633879.stgit@manet.1015granger.net> User-Agent: StGit/0.23-29-ga622f1 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org The NetApp Linux team discovered that with NFS/RDMA servers that do not support RFC 8797, the Linux client is forming NFSv4.x WRITE requests incorrectly. In this case, the Linux NFS client disables implicit chunk round-up for odd-length Read and Write chunks. The goal was to support old servers that needed that padding to be sent explicitly by clients. In that case the Linux NFS included the tail kvec in the Read chunk, since the tail contains any needed padding. That meant a separate memory registration is needed for the tail kvec, adding to the cost of forming such requests. To avoid that cost for a mere 3 bytes of zeroes that are always ignored by receivers, we try to use implicit roundup when possible. For NFSv4.x, the tail kvec also sometimes contains a trailing GETATTR operation. The Linux NFS clients is unintentionally including that GETATTR operation in the Read chunk as well as inline. Fortunately, servers ignore this craziness and go about their normal business. The fix is simply to /never/ include the tail kvec when forming a data payload Read chunk. Note that since commit 9ed5af268e88 ("SUNRPC: Clean up the handling of page padding in rpc_prepare_reply_pages()") the NFS client passes payload data to the transport with the padding in xdr->pages instead of in the send buffer's tail kvec. So now the Linux NFS client appends XDR padding to all odd-sized Read chunks. This shouldn't be a problem because: - RFC 8166-compliant servers are supposed to work with or without that XDR padding in Read chunks. - Since the padding is now in the same memory region as the data payload, a separate memory registration is not needed. In addition, the link layer extends data in RDMA Read responses to 4-byte boundaries anyway. Thus there is now no savings when the padding is not included. Because older kernels include the payload's XDR padding in the tail kvec, a fix there will be more complicated. Thus backporting this patch is not recommended. Reported by: Olga Kornievskaia Signed-off-by: Chuck Lever --- net/sunrpc/xprtrdma/rpc_rdma.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/net/sunrpc/xprtrdma/rpc_rdma.c b/net/sunrpc/xprtrdma/rpc_rdma.c index f0af89a43efd..f1b52f9ab242 100644 --- a/net/sunrpc/xprtrdma/rpc_rdma.c +++ b/net/sunrpc/xprtrdma/rpc_rdma.c @@ -257,10 +257,7 @@ rpcrdma_convert_iovs(struct rpcrdma_xprt *r_xprt, struct xdr_buf *xdrbuf, page_base = 0; } - /* When encoding a Read chunk, the tail iovec contains an - * XDR pad and may be omitted. - */ - if (type == rpcrdma_readch && r_xprt->rx_ep->re_implicit_roundup) + if (type == rpcrdma_readch) goto out; /* When encoding a Write chunk, some servers need to see an