Received: by 2002:ab2:6991:0:b0:1f7:f6c3:9cb1 with SMTP id v17csp535058lqo; Wed, 8 May 2024 07:25:18 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCW1tWNx78zQ9RYvkYYaeSmTZHMBzmrr6kZlsPRrkYrV6s+RY66jWFFg96fEvx7imUfT6qZZQg7qhmuUPPLQTplIf3/07+DB6myL9DgwHg== X-Google-Smtp-Source: AGHT+IFP+xjh3HYODatv8c1cRBf9W1MbhDp5wAKGZSieTNTR2oXYuLQDQCR5K1V5Z25Gy8KXb7yA X-Received: by 2002:a05:6a20:9494:b0:1af:ad00:b2dd with SMTP id adf61e73a8af0-1afc8d96e33mr2992872637.43.1715178317789; Wed, 08 May 2024 07:25:17 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715178317; cv=pass; d=google.com; s=arc-20160816; b=TqoQadfVqWCECY3XV+9zZWv0WZtgnmLKxqvBHszGQPe+epoDm94QB0BsR+uHVf3CGN Y0ouSS63qKfwFjyBjml8brrujbIwOWTMe0TjQ7BvXfGK4/AmCFdndC8ckbSFGYJQYDNt QDovV9Mts4LRhWixUBp5kA17rIH45/kX6gWx4D8Nkr0JkXT1UXzwdeuYEVHxjaE9WNpj R+VwplCgxDU+52uHCtWOUlShFcPPnrppgPXeae1/BZmfV9HT+FGev6h073q14U6/syCw NeR6MBuKNvMAIRT3ymClo2DuJWmxR/yjUPKfAQxYXFQPitIJyaPi5eaXzevTGJ2jmXMu Pe6A== 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:mail-followup-to :message-id:subject:cc:to:from:date:dkim-signature; bh=CeBqT9Zed0z1jUGrfvGp1XN4J6QgdBnyIkuy1n0h3cY=; fh=OUY+rvukSJmi62U9PpoCN1o4xSE3EbT5mSfrePAH1d4=; b=IQDQ7o+BEyRgH0muMI/YWinN2bvta2eikvlFE89Nm5safJPNrNca60X5iSUq8WEVpu L0BhkQzpzgVfoj064q3sX+VT+Qs+yi8voAgLtAzC5ZfVKtH4W2bAjtymCwzygzf5BbxJ B2NTmPHkLRSre50amv/VZSx5JWMBFkHfxZgI3ANuZzKOIrvb2Knaa4732JLTAFiW4yol DRgtpy2zmosnksG5nxlekFcsCyzWBtLAfiycJyTmJBUyWmfFRp+DT9uqGHfP6mkdxYNm uxE7W6uXzNSwGIbZkoT75KCzkrVbm8AiarqL2YMdlmgFiT3qFycjNUc3JkI+MtdzGNbI m3sg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ffwll.ch header.s=google header.b=MroJbJ8q; arc=pass (i=1 dkim=pass dkdomain=ffwll.ch); spf=pass (google.com: domain of linux-kernel+bounces-172791-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-172791-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id p9-20020a056a000b4900b006f462ea3810si8533413pfo.49.2024.05.08.07.25.17 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 May 2024 07:25:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-172791-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@ffwll.ch header.s=google header.b=MroJbJ8q; arc=pass (i=1 dkim=pass dkdomain=ffwll.ch); spf=pass (google.com: domain of linux-kernel+bounces-172791-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-172791-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id C08CE284D96 for ; Wed, 8 May 2024 07:17:14 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id EC3532BD1C; Wed, 8 May 2024 07:16:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ffwll.ch header.i=@ffwll.ch header.b="MroJbJ8q" Received: from mail-ej1-f45.google.com (mail-ej1-f45.google.com [209.85.218.45]) (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 EEA3D2745E for ; Wed, 8 May 2024 07:16:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.45 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715152613; cv=none; b=ngm43rKBhSTmNamUT79SYsXi/aBt9Lvyp9xokr2arX37t+rm/13YnKnU1e1XQA6VSs5LRZGVzu5U7leZtcFalxX8P5IL9x48+P9F5jNbYbrIeDVaKIRpxB3y16s3nJArvTXgB4wBgBn/PKYwhHRAl7hVxDGv0hB2bL4vyeQwaSE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715152613; c=relaxed/simple; bh=f0m34QhDPAosJyYZmjdMVXrVYo1qtPAsG7RWUe2/wXY=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=PEsnbgqLBqLYLaifTC0+hXHi1DAVLmAvOj/p4sSHQTUExocM/Ne7vuEkuqyi7er9rsxBv5lTeMt9p6ZrykNDEp/TbBLvLv+HJQwtN7aUCYayHMo55uH0oaOz+QBVYb16BsQ+cClsxtO19ItRktDjSLAKW2anJePJNrOg6ncOiKM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ffwll.ch; spf=none smtp.mailfrom=ffwll.ch; dkim=pass (1024-bit key) header.d=ffwll.ch header.i=@ffwll.ch header.b=MroJbJ8q; arc=none smtp.client-ip=209.85.218.45 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ffwll.ch Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=ffwll.ch Received: by mail-ej1-f45.google.com with SMTP id a640c23a62f3a-a59cac06ec3so80474066b.0 for ; Wed, 08 May 2024 00:16:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; t=1715152610; x=1715757410; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references :mail-followup-to:message-id:subject:cc:to:from:date:from:to:cc :subject:date:message-id:reply-to; bh=CeBqT9Zed0z1jUGrfvGp1XN4J6QgdBnyIkuy1n0h3cY=; b=MroJbJ8qrt1lWtQl9CkIOA2S2/0/Rhz+N8DSshEjcDJkwLiOBB10BYEH8HBRVgEogf aproeU1tIF8tqQahdssZIDdOG5v17aE1qXU1Efu55FGbbP739+/7KY5q49fLqgFTZdy9 E3mqH2mJI76tWpPg8ek0CnV201zdpFmeUQeyQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715152610; x=1715757410; h=in-reply-to:content-disposition:mime-version:references :mail-followup-to:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=CeBqT9Zed0z1jUGrfvGp1XN4J6QgdBnyIkuy1n0h3cY=; b=BXDosC6wNgUCf+gyr+0oV/tui1DjETqmDXpw0+839N7zGSZ6by9enjEZKMP3L0HYrU YPtOYb+vQt79wEzCzI5UJbBPpwQZCim+JpuZquWUTTR8MHTSh0yFexo4X7eOg4nqm1Ld HsM+wP1ATmI9uuSHywGlLfMKuw9NLCxtx7tEMFXTWk+LuTzzFuXJAt73uHXaie/weMQ6 EU7nJ/QAlSIuP2l/slFqOKoIXLAHWpheVPjCwZvVqQTcC0AMlrFGNbLf2GsBsx3GgB0f H6dSj0jvLaq0DxXcEdGqmMZRQ++FsTTIXT0GP5ZiBmKjbVqjtCl4RygLi7KI+zZ1BSod DkZw== X-Forwarded-Encrypted: i=1; AJvYcCW8AZhBFAvs8dqfnwzOcpFyaOu3VGt5SXVEmSVtVJjJW9bZwMHoRzFhidDcfxI+4KNE2D1bc0tyUWANaOk7q9Nekq6MytabonaaP6ci X-Gm-Message-State: AOJu0YyKKK3GNPjsdg5IIqv8qk9yycyb2LmmkSA+F5KAuYXDd/BodPWG rtjkDnzwx5HKSlZFElGtV8E9tnCuMo8lu1E2Q0xz2yBI1ylo4nPFBlZv7HHVKCs= X-Received: by 2002:a05:6402:378a:b0:572:d841:1189 with SMTP id 4fb4d7f45d1cf-5731da624efmr899529a12.3.1715152610093; Wed, 08 May 2024 00:16:50 -0700 (PDT) Received: from phenom.ffwll.local ([2a02:168:57f4:0:efd0:b9e5:5ae6:c2fa]) by smtp.gmail.com with ESMTPSA id n18-20020a05640205d200b00572f0438b02sm4124571edx.6.2024.05.08.00.16.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 May 2024 00:16:49 -0700 (PDT) Date: Wed, 8 May 2024 09:16:46 +0200 From: Daniel Vetter To: Jason Gunthorpe Cc: Pavel Begunkov , 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 =?iso-8859-1?Q?K=F6nig?= , 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: Mail-Followup-To: Jason Gunthorpe , Pavel Begunkov , 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 =?iso-8859-1?Q?K=F6nig?= , 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 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> 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: <20240507233247.GK4718@ziepe.ca> X-Operating-System: Linux phenom 6.6.15-amd64 On Tue, May 07, 2024 at 08:32:47PM -0300, Jason Gunthorpe wrote: > On Tue, May 07, 2024 at 08:35:37PM +0100, Pavel Begunkov wrote: > > On 5/7/24 18:56, Jason Gunthorpe wrote: > > > On Tue, May 07, 2024 at 06:25:52PM +0100, Pavel Begunkov wrote: > > > > On 5/7/24 17:48, Jason Gunthorpe wrote: > > > > > On Tue, May 07, 2024 at 09:42:05AM -0700, Mina Almasry wrote: > > > > > > > > > > > 1. Align with devmem TCP to use udmabuf for your io_uring memory. I > > > > > > think in the past you said it's a uapi you don't link but in the face > > > > > > of this pushback you may want to reconsider. > > > > > > > > > > dmabuf does not force a uapi, you can acquire your pages however you > > > > > want and wrap them up in a dmabuf. No uapi at all. > > > > > > > > > > The point is that dmabuf already provides ops that do basically what > > > > > is needed here. We don't need ops calling ops just because dmabuf's > > > > > ops are not understsood or not perfect. Fixup dmabuf. > > > > > > > > Those ops, for example, are used to efficiently return used buffers > > > > back to the kernel, which is uapi, I don't see how dmabuf can be > > > > fixed up to cover it. > > > > > > Sure, but that doesn't mean you can't use dma buf for the other parts > > > of the flow. The per-page lifetime is a different topic than the > > > refcounting and access of the entire bulk of memory. > > > > Ok, so if we're leaving uapi (and ops) and keep per page/sub-buffer as > > is, the rest is resolving uptr -> pages, and passing it to page pool in > > a convenient to page pool format (net_iov). > > 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. > > What you seem to want is to alter how the actual allocation flow works > from that bulk of memory and delay the free. It seems like a different > topic to me, and honestly hacking into the allocator free function > seems a bit weird.. Also I don't see how it's an argument against dma-buf as the interface for all these, because e.g. ttm internally does have a page pool because depending upon allocator, that's indeed beneficial. Other drm drivers have more buffer-based concepts for opportunistically memory around, usually by marking buffers that are just kept as cache as purgeable (which is a concept that goes all the way to opengl/vulkan). But these are all internals of the dma-buf exporter, the dma-buf api users don't ever need to care. -Sima -- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch