From patchwork Tue May 30 14:16:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Howells X-Patchwork-Id: 13260164 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 926F8C7EE23 for ; Tue, 30 May 2023 14:17:06 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 08C50900002; Tue, 30 May 2023 10:17:06 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 03C546B0078; Tue, 30 May 2023 10:17:05 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E465C900002; Tue, 30 May 2023 10:17:05 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id D53566B0075 for ; Tue, 30 May 2023 10:17:05 -0400 (EDT) Received: from smtpin20.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 5A019AE0B3 for ; Tue, 30 May 2023 14:17:05 +0000 (UTC) X-FDA: 80847123210.20.3A6AF35 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf27.hostedemail.com (Postfix) with ESMTP id AE5E94000C for ; Tue, 30 May 2023 14:17:00 +0000 (UTC) Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b="fiGqG/wQ"; spf=pass (imf27.hostedemail.com: domain of dhowells@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=dhowells@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1685456222; a=rsa-sha256; cv=none; b=Ezv8E6ESIqZeUmlKJrTUcdapDm+l5QbNys1i1Y5/FUEaFlrp1rU+j9MHxPb6TBVdkU0RJN gu6m/BZdUHWuDnU9DBaQkf2B+plN5cnaKXjL8guY56E1N2kMXLkFlvome1bkRtvBmYYBGB pUc3PAv+9pw4V15Une194uqKFh/CrNw= ARC-Authentication-Results: i=1; imf27.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b="fiGqG/wQ"; spf=pass (imf27.hostedemail.com: domain of dhowells@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=dhowells@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1685456222; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:references:dkim-signature; bh=MWi+zmGc/Ddi01/GgCyhiHQp9bA5/4VLjJA2qlX57j4=; b=WgOtkXU3xkKCsjf20qzCBdkQ81WWF6WqkDs1GekzZLiZE59zdbZIv+F1w/BflIHcZfD1of 5f6xG45XJwkCxs/XUhcb/ZABKT6/3sIHkUlzdGg8cnPuZrmYxv5RtjXE5olbuOSS1P2ijc mYue/8ccZ2dKLHsSTHRlFszeZ+qgwuk= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1685456220; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=MWi+zmGc/Ddi01/GgCyhiHQp9bA5/4VLjJA2qlX57j4=; b=fiGqG/wQDfEI4Yz9MNBLR0lGysiD522RuXgCcG/fOuMVuNDsFYNcoiEn1PLAGWow3QQUUB kh+xEyfuXZ8bQhvBKXnBebymcIcixP8EHJxBGody1dRy557bxWrHoMwHp54Mw2UYWrYDCX z3g6ds9zjDoqiPr5xM6sEb6Wj3wYPpM= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-434-TTCJgiS3MASF7UDkH-Yhcw-1; Tue, 30 May 2023 10:16:56 -0400 X-MC-Unique: TTCJgiS3MASF7UDkH-Yhcw-1 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id E8D8780331C; Tue, 30 May 2023 14:16:55 +0000 (UTC) Received: from warthog.procyon.org.uk (unknown [10.42.28.182]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3150148205E; Tue, 30 May 2023 14:16:52 +0000 (UTC) From: David Howells To: netdev@vger.kernel.org Cc: David Howells , Herbert Xu , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Willem de Bruijn , David Ahern , Matthew Wilcox , Jens Axboe , linux-crypto@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next v2 00/10] crypto, splice, net: Make AF_ALG handle sendmsg(MSG_SPLICE_PAGES) Date: Tue, 30 May 2023 15:16:24 +0100 Message-ID: <20230530141635.136968-1-dhowells@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: AE5E94000C X-Stat-Signature: ow9nragz9nc8nzoa351z8mmk8rwfq36y X-Rspam-User: X-HE-Tag: 1685456220-185079 X-HE-Meta: U2FsdGVkX18ftuNae5qaKqqlItalV8QeIBm7qy+Xq9EQznr3zfR9SLE/sjJxky2/MZj4ro4ght1lIWrH6l+5Bn56cvsUZNEZNBAPFgvvg0hT10HikHfW/3irMgmYacSZE8QBzFkkBPv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pzLiADXRNYjCl1FGrhQBAeNLb9391Uu3lwmZLmwBrSvT7GtG8PIXYG4liypFRyvD/RLsrv97b30CXhGnaRFrhxhvwxYXI40kycqI9BpPEsA6Lv/lW7VJ2TYOcs X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Here's the fourth tranche of patches towards providing a MSG_SPLICE_PAGES internal sendmsg flag that is intended to replace the ->sendpage() op with calls to sendmsg(). MSG_SPLICE_PAGES is a hint that tells the protocol that it should splice the pages supplied if it can. This set consists of the following parts: (1) Move netfs_extract_iter_to_sg() to somewhere more general and rename it to drop the "netfs" prefix. We use this to extract directly from an iterator into a scatterlist. (2) Make AF_ALG use iov_iter_extract_pages(). This has the additional effect of pinning pages obtained from userspace rather than taking refs on them. Pages from kernel-backed iterators would not be pinned, but AF_ALG isn't really meant for use by kernel services. (3) Change AF_ALG still further to use extract_iter_to_sg(). (4) Make af_alg_sendmsg() support MSG_SPLICE_PAGES support and make af_alg_sendpage() just a wrapper around sendmsg(). This has to take refs on the pages pinned for the moment. (5) Make hash_sendmsg() support MSG_SPLICE_PAGES by simply ignoring it. hash_sendpage() is left untouched to be removed later, after the splice core has been changed to call sendmsg(). I've pushed the patches here also: https://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs.git/log/?h=sendpage-4 David ver #2) - Put the "netfs_" prefix removal first to shorten lines and avoid checkpatch 80-char warnings. - Fix a couple of spelling mistakes. - Wrap some lines at 80 chars. Link: https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next.git/commit/?id=51c78a4d532efe9543a4df019ff405f05c6157f6 # part 1 Link: https://lore.kernel.org/r/20230526143104.882842-1-dhowells@redhat.com/ # v1 David Howells (10): Drop the netfs_ prefix from netfs_extract_iter_to_sg() Fix a couple of spelling mistakes Wrap lines at 80 Move netfs_extract_iter_to_sg() to lib/scatterlist.c crypto: af_alg: Pin pages rather than ref'ing if appropriate crypto: af_alg: Use extract_iter_to_sg() to create scatterlists crypto: af_alg: Indent the loop in af_alg_sendmsg() crypto: af_alg: Support MSG_SPLICE_PAGES crypto: af_alg: Convert af_alg_sendpage() to use MSG_SPLICE_PAGES crypto: af_alg/hash: Support MSG_SPLICE_PAGES crypto/af_alg.c | 185 ++++++++++++--------------- crypto/algif_aead.c | 38 +++--- crypto/algif_hash.c | 114 +++++++++++------ crypto/algif_skcipher.c | 10 +- fs/cifs/smb2ops.c | 4 +- fs/cifs/smbdirect.c | 2 +- fs/netfs/iterator.c | 266 --------------------------------------- include/crypto/if_alg.h | 7 +- include/linux/netfs.h | 4 - include/linux/uio.h | 5 + lib/scatterlist.c | 269 ++++++++++++++++++++++++++++++++++++++++ 11 files changed, 459 insertions(+), 445 deletions(-)