Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp2516824rwd; Fri, 26 May 2023 07:34:24 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6Q7LBSiUSpArDDlpe3Ru+/ise7/WNu0nDNnEu7vSXnFU2a6NxOj7bClCCfh1wvGPKNB41L X-Received: by 2002:a17:902:cec7:b0:1ad:c736:2090 with SMTP id d7-20020a170902cec700b001adc7362090mr3072222plg.3.1685111663979; Fri, 26 May 2023 07:34:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685111663; cv=none; d=google.com; s=arc-20160816; b=cSggY9ix39PAgLgicQBZfEfe/4SHEYyoTMbTER/1VmoRVxSwmtnDpBICfojvtNH8ot 46N9WvMJoHSs+azcrnbq4/LMfCWnw9hsKg1arytVRbm8Qe8RrIe+2YATIFwRcP9DihfS UU7BnZ0sB87iLpQC9Uxd2Lp6dPiqiDEhd9jG8sHe4CInJYmHSuUChDHOYaABQ4VgJTLG pmsQQHn2Q/Kux9tHxHdQS2doyvQ4wCXYwbcJlmO8E6O9pCm8wB/PTRRF9ii1Fmn8hrVj g/in2iun+4oKT0auw38fBaojwyjnZxLzoFORwfv4U6aCqx3X4ICoSreMudciDpngMsPN DlzQ== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=AN3wUYIRzonhCzYuNraybexj9Op6B4f47YxRrWuA7cY=; b=ACGStEHc4HpwbNWtzrhy2z4yB7n07ejwrQeyI3Vgr3LZ0hYeWaK7hEHCF5aNCWedZT /Ahkx51XlTwCSkzJFAbUNPAm2aCHNuYfohPDfxMWWgLZeuuLoOyLQz/2Z5wWIGQS32Rs UDxg+/Fg2n8TgVouPJGwBvsnBw3FHhJy2RgOhc6h2oFyqdYQVmF611s8m7D9CaYfT+8m wYJfq7do9mV2O3xqlldumN70QyKZGeqJkZDLNxR/VK3ZNIUrhXpYFkP2J9xHGj9edvlD futxf0g+gRVPgID36yOV1p4sUGpgLjnBE3LVwKrJrmKYFjPCZcdoKwNI0SerFUhU4tOH /0Ig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=ZyXippAL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k13-20020a170902c40d00b001ae59169f18si4790218plk.414.2023.05.26.07.33.49; Fri, 26 May 2023 07:34:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=ZyXippAL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231530AbjEZOcK (ORCPT + 99 others); Fri, 26 May 2023 10:32:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54972 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230167AbjEZOcI (ORCPT ); Fri, 26 May 2023 10:32:08 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A68D6187 for ; Fri, 26 May 2023 07:31:14 -0700 (PDT) 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-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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(-)