Received: by 2002:ab2:6991:0:b0:1f7:f6c3:9cb1 with SMTP id v17csp535402lqo; Wed, 8 May 2024 07:25:51 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCU9ooH7YSSg3qSWvuDCtDMu1fntgHVxzyPViRbDL33wNpHET4HDEB6PA+DrWtgFrD+5yNPE4rWJE/6D5piXAbZxURXcwUKs2dshrg7MYg== X-Google-Smtp-Source: AGHT+IG33GFYJgQbqakTzVmQzVjFFlYwHsKKA5yDmjouaJT27qizZahpdurQosAY3Pe8CzJMXH2G X-Received: by 2002:a05:6214:d09:b0:6a0:ada7:1fee with SMTP id 6a1803df08f44-6a151444036mr26496076d6.17.1715178350819; Wed, 08 May 2024 07:25:50 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715178350; cv=pass; d=google.com; s=arc-20160816; b=vVRl8KgKqXQkJzgRCAketVvdyk/j0m0K/SZZBOP2N4PCgA7F3FuG/eAXIXk916P+4D dt6atMLE/1MSSbKAvuUbTN6Dn5P6L/2LG6qtPA8FRbSlQTSO43qMRDf+/8kkgUryfmeT ykkEwk0vU9HlWXBbJsd9QF28aj/mDIXFTVuzBDlt5X2fVH1OOV5liltaW3MVBPxHND6M IiuXX4YDhcEKWXZnbQZaXy19zMF87jmWO/rZwrpfsCuXNggMLBGzDMM58zdpyWarP5BR Wfx62aZoNKjgLmu4mCqNqg51SEJue74OCJf3obfFaafRgXVIon9JbIw2ZuyveieVm5pd q+nw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=AgrD1WoYkdj8wg28imEY2ANZlllvJHBViF8cNCfVJ94=; fh=uvjsnzaNeheH3MKX7/uNTwrFIc9uH+jK1RMK+73txwc=; b=y/RDPZgQIaI2dTtZRf1eCuQ1kUYkifDlWhSJGEWTwHH2fQiw6UhAHVQloU9sRR/TfJ qpPcmg0wN5IRVb52ZfTF06Wu90o4CHIOISULaXsSMqiJlL0Uzwz5MFyiiksNNDDfKbxf vK8xRopADnIOWNYWQJo3mdBf42T8hSpylAOQrANK7wP6qcxJh7J+vI/3YSxyrBk6sKt6 N/5LLHJPtcfIKVeFpSMnwi3zGIjAVc3ipMILuAOYdfeO+3mzwSYgIRKE+liUTdM2Z0ix 6yUeybuhiNxPC0MNTw5zjYZ9BWhny2fdVOOFMyxkD2PcrBReNZ/EmDz/F9p/kwJy0ZN3 KjAA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ziepe.ca header.s=google header.b=PkSz5ZIr; arc=pass (i=1 spf=pass spfdomain=ziepe.ca dkim=pass dkdomain=ziepe.ca); spf=pass (google.com: domain of linux-kernel+bounces-173394-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-173394-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id 10-20020ad45baa000000b006a0c784a87bsi13919465qvq.100.2024.05.08.07.25.50 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 May 2024 07:25:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-173394-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@ziepe.ca header.s=google header.b=PkSz5ZIr; arc=pass (i=1 spf=pass spfdomain=ziepe.ca dkim=pass dkdomain=ziepe.ca); spf=pass (google.com: domain of linux-kernel+bounces-173394-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-173394-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 615011C2165B for ; Wed, 8 May 2024 14:25:50 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4A9FC85644; Wed, 8 May 2024 14:25:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ziepe.ca header.i=@ziepe.ca header.b="PkSz5ZIr" Received: from mail-oo1-f50.google.com (mail-oo1-f50.google.com [209.85.161.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 14C5A8562E for ; Wed, 8 May 2024 14:25:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.161.50 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715178335; cv=none; b=d+Z992t+jWi6BWJZPjPAUGF70szpmV/2Qgo1IEtLpd6g10+yGKiGvuf8D5VMT9DeC9AeDQSJM2mZrbVcxKLrRqv1wFUlIh5nWYZDn+Ufr0WXfK7W0HW0ePMjgKDDYpW8d7+biGRBeJqiv1Z7lmcLFbLRQbwWBizNegogdKoHneY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715178335; c=relaxed/simple; bh=4BjthKjlyBrv7qlqiwaK/PtT8pzCfUhJT3JhHavFgDI=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Wuly9rerEquYBnImyv1wmkRtFyD5GpbA5NXzqlIuwASg71JSXTmAxUQXv8H/Riw6HzY8JIWs8obIJtv6V3exgMKAqn5PakSzXd4G5lDkEEWPsFBJLfW+7rsB0U5KagqULoWFD3BVuxVNtfPBMAPfd/dUryEDAtekais7PD/5wm8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ziepe.ca; spf=pass smtp.mailfrom=ziepe.ca; dkim=pass (2048-bit key) header.d=ziepe.ca header.i=@ziepe.ca header.b=PkSz5ZIr; arc=none smtp.client-ip=209.85.161.50 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ziepe.ca Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ziepe.ca Received: by mail-oo1-f50.google.com with SMTP id 006d021491bc7-5b203c9933dso2366193eaf.3 for ; Wed, 08 May 2024 07:25:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; t=1715178332; x=1715783132; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=AgrD1WoYkdj8wg28imEY2ANZlllvJHBViF8cNCfVJ94=; b=PkSz5ZIrJA+JdKLTG1OfJOpsC3pIK9p0Yyyccg0hoyFx4nX+QslSRwMwI4DVdChRJP izW8bkDiT9CPlsFn6NWC8ObqLmJqHdv9dPY0oT30ErifiuP39AlKPuvD7Yf+BkCaa7Sb Te00sjo5KeKCTCzDG2Db1vLaDVs3d6arHQrZ1bw9QDP+92DwkxA9EYsv7pLYZJCoOqPF uZtQ58ltzdg1IK0HMjEk0b7ojsbJFvvU8qgxGk4eLmdxoYaDj295d2YoNoZssCzplhTt gIWCjBnmhmKaQvlqOK/z5YS7LMtFLbkb/MYrvH7dBUqJkFBFDaeqoCDz0sPa37MSs4wn v6AQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715178332; x=1715783132; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=AgrD1WoYkdj8wg28imEY2ANZlllvJHBViF8cNCfVJ94=; b=LkhYlMWS8KErcKa2O+VE1A5a1OQSVDuyrt6ycISpjqAv7mCsLs4fZa+CsMvnRep00c WHRr4IUAUTgnQqyuMDFc0Faowv0V7PS4xvTd1/WLFi53dGUNM7FoAIxeI2jhaGHe+/wA tnOCD4daekFI8Wd+Vhw4yjnulUmjEY6PkLrTDsY9XbabwVyXJAyZOv8ZcUfbjoI1LTXf +LL6Dv1O7XdSJKEGksXM0Ldrz6431wjiG9KyCJalKAkPj5ceHSCB0eO4BVCbRH0k7xk8 oyB/4OE8M7QW/IydzaGm1iGHVPy0Ucv2pmUq70hu+O+U7hizu2/p/dgDoWLCZH1mSKNH 43nw== X-Forwarded-Encrypted: i=1; AJvYcCU2mhpdYsP/JMttoNU2sIXIr1EizI0/tJwgHOc4VECrrXGFGqAS0A32f7C5D6ivL6FZpT8TyOB1jGplvjtF+DIw0rLIaMHxuYnXhVqI X-Gm-Message-State: AOJu0YxlN0VsLliim6Mg5ITAFln+sqzFmvlKmcVyOS6c850Zu/KrDlNL 4rWtj6S1MZ2DHrZO6nXuDspKveA0qZKTzXgolrCl7SjT8Hjlw+GiMMkokJ9xICU= X-Received: by 2002:a4a:8c24:0:b0:5aa:538a:ed60 with SMTP id 006d021491bc7-5b24d28fdb4mr2495842eaf.3.1715178331994; Wed, 08 May 2024 07:25:31 -0700 (PDT) Received: from ziepe.ca (hlfxns017vw-142-68-80-239.dhcp-dynamic.fibreop.ns.bellaliant.net. [142.68.80.239]) by smtp.gmail.com with ESMTPSA id o18-20020ac86992000000b0043d4245dd4csm4389539qtq.84.2024.05.08.07.25.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 May 2024 07:25:31 -0700 (PDT) Received: from jgg by wakko with local (Exim 4.95) (envelope-from ) id 1s4iEc-0016QI-DE; Wed, 08 May 2024 11:25:30 -0300 Date: Wed, 8 May 2024 11:25:30 -0300 From: Jason Gunthorpe To: Pavel Begunkov Cc: Mina Almasry , Christoph Hellwig , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, linux-alpha@vger.kernel.org, linux-mips@vger.kernel.org, linux-parisc@vger.kernel.org, sparclinux@vger.kernel.org, linux-trace-kernel@vger.kernel.org, linux-arch@vger.kernel.org, bpf@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-media@vger.kernel.org, dri-devel@lists.freedesktop.org, "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Jonathan Corbet , Richard Henderson , Ivan Kokshaysky , Matt Turner , Thomas Bogendoerfer , "James E.J. Bottomley" , Helge Deller , Andreas Larsson , Jesper Dangaard Brouer , Ilias Apalodimas , Steven Rostedt , Masami Hiramatsu , Mathieu Desnoyers , Arnd Bergmann , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin KaFai Lau , Eduard Zingerman , Song Liu , Yonghong Song , John Fastabend , KP Singh , Stanislav Fomichev , Hao Luo , Jiri Olsa , Steffen Klassert , Herbert Xu , David Ahern , Willem de Bruijn , Shuah Khan , Sumit Semwal , Christian =?utf-8?B?S8O2bmln?= , Amritha Nambiar , Maciej Fijalkowski , Alexander Mikhalitsyn , Kaiyuan Zhang , Christian Brauner , Simon Horman , David Howells , Florian Westphal , Yunsheng Lin , Kuniyuki Iwashima , Jens Axboe , Arseniy Krasnov , Aleksander Lobakin , Michael Lass , Jiri Pirko , Sebastian Andrzej Siewior , Lorenzo Bianconi , Richard Gobert , Sridhar Samudrala , Xuan Zhuo , Johannes Berg , Abel Wu , Breno Leitao , David Wei , Shailend Chand , Harshitha Ramamurthy , Shakeel Butt , Jeroen de Borst , Praveen Kaligineedi Subject: Re: [RFC PATCH net-next v8 02/14] net: page_pool: create hooks for custom page providers Message-ID: <20240508142530.GR4718@ziepe.ca> References: <20b1c2d9-0b37-414c-b348-89684c0c0998@gmail.com> <20240507161857.GA4718@ziepe.ca> <20240507164838.GG4718@ziepe.ca> <0d5da361-cc7b-46e9-a635-9a7a4c208444@gmail.com> <20240507175644.GJ4718@ziepe.ca> <6a50d01a-b5b9-4699-9d58-94e5f8f81c13@gmail.com> <20240507233247.GK4718@ziepe.ca> <54830914-1ec9-4312-96ad-423ac0aeb233@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <54830914-1ec9-4312-96ad-423ac0aeb233@gmail.com> On Wed, May 08, 2024 at 12:30:07PM +0100, Pavel Begunkov wrote: > > I'm not going to pretend to know about page pool details, but dmabuf > > is the way to get the bulk of pages into a pool within the net stack's > > allocator and keep that bulk properly refcounted while.> An object like > > dmabuf is needed for the general case because there are > > not going to be per-page references or otherwise available. > > They are already pinned, memory is owned by the provider, io_uring > in this case, and it should not be freed circumventing io_uring, > and at this stage calling release_pages() is not such a hassle, > especially comparing to introducing an additional object. Something needs to co-ordinate when the net stack's allocator is done with the bulk of pages and when io_uring and do the final put_user_page() to free it. DMABUF is not an unreasonable choice for this. > > topic to me, and honestly hacking into the allocator free function > > seems a bit weird.. > > Do you also think that DMA_BUF_IOCTL_SYNC is a weird hack, because > it "delays free" by pinning the dmabuf object and letting the user > read memory instead of copying it? I can find many examples It seems to me the flow you want is for the driver to allocate a page, put it on a rx ring, process it through the netstack, and deliver it to io_uring. io_uring would then sit on the allocation until userspace it done and return it back to the netstack allocator. Hooking the free of the netstack allocator and then defering it seems like a weird and indirect way to get there. Why can't io_uring just be the entity that does the final free and not mess with the logic allocator? Jason