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: 10040 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp2229414vqr; Tue, 30 May 2023 07:38:26 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6Ld2g6wmafsmclrmmTHV6P0XFUHKi/NITx2dXWU64eBIIXfJjuh0i2zpJv8WZ79JzU7rqn X-Received: by 2002:a17:90a:d181:b0:256:7866:8c06 with SMTP id fu1-20020a17090ad18100b0025678668c06mr7633903pjb.19.1685457505965; Tue, 30 May 2023 07:38:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685457505; cv=none; d=google.com; s=arc-20160816; b=HpVTmZBMO2ErqLQB+btOzQ2U6XsHQ5tdOSB70DX9tHs3vfEE2iofAovDtkdCZNPiUn QagEO3nEjrpxtI+BmcTbudmAzRGfk8pclGI+SLn5qDkRJjD8RliEGtx+pWzmsFJktB7S GI8q2x1US8qJ08kMr6xRYNqE9GRporLihr/AEhzptZn18BP20b8RDGQnPy6bV4BiIA8r vjW+u4QTzy+VNKC+K0Nf9z6/goDiAHD2pRlPNzN5VSCgmQ6ssPB2PgjumRmpjr6iaUNb gqMI5GdV+60qfRZFa6TM8YjN9yGpX/zj+GUOIfcc898z4ithSVnvpfnBy1A2Pb8K1zPO t0/Q== 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=MWi+zmGc/Ddi01/GgCyhiHQp9bA5/4VLjJA2qlX57j4=; b=iQDL+kXvS5grVh9tiY8vRE4+hMxa0BLloXFc9IqZC2M0SCJ6T+FtRk/3MCzQl+jMZM D6sq6HI37ninDgM5XyDGR9DFqm/aFUUrGSgCJRDTbOP2pVhQ461lyfUom7SJn1T1dNKq EKanBZ8TYC3zD3gxf8pbgXa5ERUL+qzlY+qase7h6XXifN+6DxlOlk1ZGKaTSmMi5jtX xWGt/GoQmPHzqmiVTFyE+BC6kKQkE0MGfNsHQtdypW46g38HNqoG85q29RpX4ikGfMc9 nSlImakWEtDWPwTGHBqhEhKmLz3zWRgKau4o7nKhTw5+OQiZMs5MERwPswsyWSjmLs7+ kxTA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="fiGqG/wQ"; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id pi4-20020a17090b1e4400b00256933298absi1686304pjb.84.2023.05.30.07.38.13; Tue, 30 May 2023 07:38:25 -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="fiGqG/wQ"; 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 S232482AbjE3OSc (ORCPT + 99 others); Tue, 30 May 2023 10:18:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59906 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231757AbjE3OS2 (ORCPT ); Tue, 30 May 2023 10:18:28 -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 4B17411D for ; Tue, 30 May 2023 07:17:16 -0700 (PDT) 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-Spam-Status: No, score=-2.3 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=ham 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1767330289632054381?= X-GMAIL-MSGID: =?utf-8?q?1767330289632054381?= 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(-)