From mboxrd@z Thu Jan 1 00:00:00 1970 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 8A6C2C77B73 for ; Fri, 26 May 2023 14:31:25 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D14D76B0074; Fri, 26 May 2023 10:31:24 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id CC5A46B0075; Fri, 26 May 2023 10:31:24 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BB3C2900002; Fri, 26 May 2023 10:31:24 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id ADE536B0074 for ; Fri, 26 May 2023 10:31:24 -0400 (EDT) Received: from smtpin27.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 7B178C0EC1 for ; Fri, 26 May 2023 14:31:24 +0000 (UTC) X-FDA: 80832644088.27.63DBFAF Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf07.hostedemail.com (Postfix) with ESMTP id 2B1674000C for ; Fri, 26 May 2023 14:31:14 +0000 (UTC) Authentication-Results: imf07.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=ZyXippAL; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf07.hostedemail.com: domain of dhowells@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=dhowells@redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1685111475; 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=AN3wUYIRzonhCzYuNraybexj9Op6B4f47YxRrWuA7cY=; b=mV6gz0fW4Pq1uwcSUdc2eQmyFMb7zlxuNB+b/QSUIskgCffO8R2hze7i8u14Hn/8njdNHe R4eGoafUe7IahuHpz9wp5pjrGzhWnxyEAptmzf2QPhMR4Ml9lu7i+ycCV+B/iTkyCeLlux 34XViy4lrMU+CTN4JnFBTWHYoA3Of18= ARC-Authentication-Results: i=1; imf07.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=ZyXippAL; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf07.hostedemail.com: domain of dhowells@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=dhowells@redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1685111475; a=rsa-sha256; cv=none; b=LAg8vPEyXyfvI3oH7APHf2BhdNfMEAYUQ/UpcunpLEjjRrC2DvPN/rFzaLw5awU2sripVM F+lI8xHkkVl6lF1zDe2mqdTB571S70WcIrZ7/YeLYGV+5dZpownxWteEPx40HcKONgi40X ZE1S3iKlq5RC50xWk0wrVtY43jHbczw= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1685111473; 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=AN3wUYIRzonhCzYuNraybexj9Op6B4f47YxRrWuA7cY=; b=ZyXippAL/0hYv9UnT9p20hLzLKK1JSY1Qjh8QYX/B0Rty5LYv+e42+JZayyexH3IvALvLV Od8cIAyqzXNvX2DDbkAPSeD9xP7AhP4evbFnzUBuCqOwiPLrPQTYy7XKS+OfoHvToSez6P FHgWLmhTl3ddCtAXwUhvyUkBLaduCYI= 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-264-kDUtvQS7PwezkQVOO1pcxw-1; Fri, 26 May 2023 10:31:10 -0400 X-MC-Unique: kDUtvQS7PwezkQVOO1pcxw-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id C755C811E91; Fri, 26 May 2023 14:31:09 +0000 (UTC) Received: from warthog.procyon.org.uk (unknown [10.39.192.68]) by smtp.corp.redhat.com (Postfix) with ESMTP id 88ABC2166B2B; Fri, 26 May 2023 14:31:07 +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 0/8] crypto, splice, net: Make AF_ALG handle sendmsg(MSG_SPLICE_PAGES) Date: Fri, 26 May 2023 15:30:56 +0100 Message-Id: <20230526143104.882842-1-dhowells@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 X-Rspamd-Queue-Id: 2B1674000C X-Rspam-User: X-Rspamd-Server: rspam02 X-Stat-Signature: qu3ejbz5ufyn9567yb1um4wjt7tajgg5 X-HE-Tag: 1685111474-361780 X-HE-Meta: U2FsdGVkX18P8CqOC1aCrsONIimrZRrejotmACa3P+hgq4Rco/lANWG7/E3mLSkzvG+E6eZ8XxQ3ZeL/k7HsMQO221JdmQw+/CDdPXXudgJhn7QMH29R1YbljNpwKLkNWQAwAgeP5ZGPPKhbcrFjlwNVowkDtNNyDRMFC83mB9iMqQaSOD3cZw6ViC6mI3CHLmB7UyizxpqcY5YEdXEK88pD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7TPduqY4uKrIf9ItM= 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 Link: https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next.git/commit/?id=51c78a4d532efe9543a4df019ff405f05c6157f6 # part 1 David Howells (8): Move netfs_extract_iter_to_sg() to lib/scatterlist.c Drop the netfs_ prefix from netfs_extract_iter_to_sg() 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 | 183 +++++++++++------------- crypto/algif_aead.c | 34 ++--- crypto/algif_hash.c | 110 +++++++++------ 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/scatterlist.h | 1 + include/linux/uio.h | 5 + lib/scatterlist.c | 267 ++++++++++++++++++++++++++++++++++++ 12 files changed, 449 insertions(+), 444 deletions(-)