Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp4296236rwl; Mon, 3 Apr 2023 02:56:16 -0700 (PDT) X-Google-Smtp-Source: AKy350Yofgrak9M/F3XEYOX1dbUU+2luiLjl7d024ILUMfZwP/K21H9ijhQlgJIp2AEYfLzKek7A X-Received: by 2002:a17:907:f90:b0:8fd:2f01:86c0 with SMTP id kb16-20020a1709070f9000b008fd2f0186c0mr40473026ejc.2.1680515776220; Mon, 03 Apr 2023 02:56:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680515776; cv=none; d=google.com; s=arc-20160816; b=Hfl3AKRSdHSu94qxMzMLAnNBnit3uazxN+74XydxNmBZaUMehBSBMGVjWdzg3Dq6BF /ym0Vq1Sv2zlAJdBdt/CGFftFirrEJAeSEScdJaJl+GM4BdIyCuC3QLgq3TdzkzEuBxl IWKzf7uY70PRWFJ87vjQK0anJlLRfkZy3Exg+grn5zhMF1zeic8N3v6AE0tqmxPqpTrV /Ca+qicOyI8zj3yu+czL2RWyhySR4oWeu4OUTd8C7szlH+f3HRJ3bP/aTea+1zcOWWII Sm+enjA2k2Lkg4iBtU2utk8/7wzYTHy+CoUGji20pNpE2swfGWYzy8BRwX9d3wobWY/1 FLiA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:content-id:mime-version:subject :cc:to:references:in-reply-to:from:organization:dkim-signature; bh=fhMzb4M7buCw/z89I96CjAU7IGJVjjKJKkPGs/PZ09w=; b=uX1qHun+eddg5Hw0WjjeS1k/qatxV6MqPRt5sw5pvORYxbhavMZdmZPbTOKsGh1DBi wrUbINMpC84IPDuXt5zbKNze8BDwwZup04QxZscV/+uFZJkAQZOAGUVXEFlykVvjTC+L MHy4C4DvOCefU23mIAMNwQeLF60niW4KF0cb3q5CNIF0DM7g/PFogJIEIU0flXRC4ghs K9NECy1w5O1siSV/JlRw7nWSbpHBX2f1KcGwgRO6ywErgPSgLo8u69WULNEW+U+KY9rK ym++JBnnnCTrofmn2xlzJ3Pk81zoiTvHV5wniV/q78p/8OVYoTHMOR4cPWiaz/JgfAEV r3AQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=G7slEEDA; 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 f22-20020a170906049600b009332ffacd59si6771946eja.765.2023.04.03.02.55.52; Mon, 03 Apr 2023 02:56:16 -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=G7slEEDA; 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 S231321AbjDCJyW (ORCPT + 99 others); Mon, 3 Apr 2023 05:54:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60612 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231794AbjDCJyK (ORCPT ); Mon, 3 Apr 2023 05:54:10 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 83B58EFAC for ; Mon, 3 Apr 2023 02:52:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1680515453; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=fhMzb4M7buCw/z89I96CjAU7IGJVjjKJKkPGs/PZ09w=; b=G7slEEDAMruZ7G9z/a9Es+Apl9zIXGbX+hXqeSIHv5Lo6qL8exM/j1w8AxeJafiS+7PMrD WENgRugehiJOe7cYXVG95zG5KH1LP3ZNjytjSgkU7zkPjzUY3sVc+PhXQZDTO7gliDmHpH IltxnHVVHZ4GHb6idSpc1/RNH3MGrQA= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-39-4-IXX9ZSPZipH8aFkS7Z8Q-1; Mon, 03 Apr 2023 05:50:50 -0400 X-MC-Unique: 4-IXX9ZSPZipH8aFkS7Z8Q-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 416BE1C05147; Mon, 3 Apr 2023 09:50:49 +0000 (UTC) Received: from warthog.procyon.org.uk (unknown [10.33.36.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id 52E2BC15BA0; Mon, 3 Apr 2023 09:50:47 +0000 (UTC) Organization: Red Hat UK Ltd. Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SI4 1TE, United Kingdom. Registered in England and Wales under Company Registration No. 3798903 From: David Howells In-Reply-To: <64299af9e8861_2d2a20208e6@willemb.c.googlers.com.notmuch> References: <64299af9e8861_2d2a20208e6@willemb.c.googlers.com.notmuch> <20230331160914.1608208-1-dhowells@redhat.com> <20230331160914.1608208-16-dhowells@redhat.com> To: Willem de Bruijn Cc: dhowells@redhat.com, Matthew Wilcox , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Al Viro , Christoph Hellwig , Jens Axboe , Jeff Layton , Christian Brauner , Chuck Lever III , Linus Torvalds , netdev@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: Re: [PATCH v3 15/55] ip, udp: Support MSG_SPLICE_PAGES MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1818503.1680515446.1@warthog.procyon.org.uk> Date: Mon, 03 Apr 2023 10:50:46 +0100 Message-ID: <1818504.1680515446@warthog.procyon.org.uk> X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE 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 Willem de Bruijn wrote: > > + } else if ((flags & MSG_SPLICE_PAGES) && length) { > > + if (inet->hdrincl) > > + return -EPERM; > > + if (rt->dst.dev->features & NETIF_F_SG) > > + /* We need an empty buffer to attach stuff to */ > > + initial_length = transhdrlen; > > I still don't entirely understand what initial_length means. > > More importantly, transhdrlen can be zero. If not called for UDP > but for RAW. Or if this is a subsequent call to a packet that is > being held with MSG_MORE. > > This works fine for existing use-cases, which go to alloc_new_skb. > Not sure how this case would be different. But the comment alludes > that it does. The problem is that in the non-MSG_ZEROCOPY case, __ip_append_data() assumes that it's going to copy the data it is given and will allocate sufficient space in the skb in advance to hold it - but I don't want to do that because I want to splice in the pages holding the data instead. However, I do need to allocate space to hold the transport header. Maybe I should change 'initial_length' to 'initial_alloc'? It represents the amount I think we should allocate. Or maybe I should have a separate allocation clause for MSG_SPLICE_PAGES? I also wonder if __ip_append_data() really needs two places that call getfrag(). David