Received: by 2002:ab2:6991:0:b0:1f7:f6c3:9cb1 with SMTP id v17csp98069lqo; Tue, 7 May 2024 13:24:58 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWm5mdFYiv6SQykf21N0DzBLG7QKzNmkF3RIUygYDxyPoemzmXfe8In/iy2zUsyMx58vtwWlF+BZnNL/R7t04Nz+ZB1TFrhfX6ra4r0Cw== X-Google-Smtp-Source: AGHT+IHF27mpwU2w3ZJdgsi+7LazziWwtJgETaWu4+9AafwoEBsbQ6n5uHlyi9BQJmjDocrygaqp X-Received: by 2002:a17:903:11c3:b0:1e3:c9f6:c4b with SMTP id d9443c01a7336-1eeb049b302mr9502515ad.10.1715113498268; Tue, 07 May 2024 13:24:58 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715113498; cv=pass; d=google.com; s=arc-20160816; b=gATs09hgIWHuK5mmvxNezsS30eT4JKgRziru/4HeylvawHVKWoZrQ6L1dRE3Oo+gD7 Gi8iXlK0Ugtf5RO9zCP4cLymA+cjUW0o8HU/T6W6qWLHnbggb2h3hrrYSHS1vcjNoFqM Hj+91T/4SWQfR/7AIDZRTBNf5sIcCvZ1WEtUUN3xYREx+izgqN6PjL4AugOmGCG18Thv +z+1MpoqyzIJIIkQY0ApEgW4de90t23tfhJ7cX1DlXJnelvz7//iIZgETtUp1oQmlFeS lg5OXWa3O/yqrUX75GiYpuuzAGHNMw7z3jiSxgqF3kl/+++W/iH5WrWdBfCTHolg9k3X VOqQ== 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=bM/Dw+slNgawZzGt48alAXy5N8w9IYCinYKDze4Obec=; fh=xtKBSN6RRAZ2v9PKGSwjmfJg533QUk7uBDCLPSaMOd0=; b=gZvcK93daczFDFuQgioszMRVAobJz/szAzvQBvZuGQ6A8Ck33A+MwKppFR1vQLARsJ nsqMJTG/9UVk8np3HYWtcRa1IfFPQZ2P8gg7BSZnhF29FCzkf3gC+y1texd/RrOAaA5V PrdRQBOJ6aKTMf9KvhDZNR+tv6QLIfx2PhWfXVJ123mbyEY4V7rQrfnnuA6Vgiq5Tqnt J3JEQac3EgmjcIjBvqtx3VCIAgL1/fET8wSw1xU67hvF71Ux4iqIppyXGAxCrRmr5tfC xhXS+SapchYH4aU/K/hsdBApBjJcgyToU1UmBntMBQSd2CD+m7K7GhUzMJXwEzxqvr6L 3RXg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ffwll.ch header.s=google header.b=DbOoRlzU; arc=pass (i=1 dkim=pass dkdomain=ffwll.ch); spf=pass (google.com: domain of linux-kernel+bounces-171906-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-171906-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 ma11-20020a170903094b00b001eb510e09ffsi11649902plb.576.2024.05.07.13.24.57 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 May 2024 13:24:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-171906-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=DbOoRlzU; arc=pass (i=1 dkim=pass dkdomain=ffwll.ch); spf=pass (google.com: domain of linux-kernel+bounces-171906-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-171906-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 C9006282508 for ; Tue, 7 May 2024 17:20:10 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D9FB916C845; Tue, 7 May 2024 17:19:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ffwll.ch header.i=@ffwll.ch header.b="DbOoRlzU" Received: from mail-wm1-f47.google.com (mail-wm1-f47.google.com [209.85.128.47]) (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 C2D7C1635A6 for ; Tue, 7 May 2024 17:19:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.47 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715102394; cv=none; b=gFovRFDqFi2IDKH5i+N+PJ5Q1Zj4WuLnJkUK3GYH1+7phnWSWkH1TwcQxOuU76uEDPReZ72LPbOkQWfSSUCuzr4HtGrqjdhhlJdVc3nzwp80VBBmjrJ5ufyfFSKk1GvosYW32wMb9OqyLk+0V7X+5n1cSnKDcoFY48qyNU+714I= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715102394; c=relaxed/simple; bh=hki5D+Qvj+YNsq8Oqb0RxIzlOFGOD1jr6olQST48t2Q=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=EpRmK3CGo9eeg2HnNRZM22+djng06IzJotM18yCTclZHMn8uiT7EFzblSG7xM7UOff0+mElYe8f5Zt7oWaRF+BA8nxjylWUrHPzOMQoZtysz4injqGe2XjUSz3IR3FqhbwgpFTmx2GXU7PCSHrTEvuIaVhTe4vmjEkP4e9npUGs= 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=DbOoRlzU; arc=none smtp.client-ip=209.85.128.47 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-wm1-f47.google.com with SMTP id 5b1f17b1804b1-41bf7889de1so110735e9.2 for ; Tue, 07 May 2024 10:19:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; t=1715102391; x=1715707191; 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=bM/Dw+slNgawZzGt48alAXy5N8w9IYCinYKDze4Obec=; b=DbOoRlzUXnytxDtn5IiQed5xXYB0O51ofSNRbsp+JOs7CXqXMLIyzOwIJWjhzXYDrN jab9rWWBG2ZgohVzF80qh858zCy5Uaok54YjNATrQYoaVqrfh3kwV4r0mcPk2fNR4Zuo Ypa2f4r6YSgVN8RtieAjGX59c1LrTCnlGhQsI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715102391; x=1715707191; 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=bM/Dw+slNgawZzGt48alAXy5N8w9IYCinYKDze4Obec=; b=t9kknHTjwn7MBOp0LaWgrSG37D2TeXtO7MIDVal9SnEPfoYpvFqB0BVrgPqaaPdmCs XYWKz5RYbsk4m5nAJ94e3m4p/QiVjEjoHlbqP1vfLn6cgbJTEdfIhPVeNWBf8Z5NYa63 anAXQb81l3FDlxWt4VXloYVlLjRuV+Rskc4WUOm47C3gupU9mZ8n10UNv+XFcmuTkMzu VNpqb/Rt89oZ7D8C5OdntUMa2PMaMO4zW3n2Sl/mhDmoO8MHWtW5c8lM6PkEqvdgzG2J +Rj9KOy93ccSbX7NdfgU6IlNQBGnwTy+Sh+kSbD1admcG+0kGe62JUsC985+Jdyp2F15 TRxA== X-Forwarded-Encrypted: i=1; AJvYcCVtp2oc4Kwtt5wS8L4olzH1nj8QSg9Wzmx5GiG3yx7wKSh0yhNMxBpARvU1MRAL67MnRmYaNkirUN8vk/FhP1Fg9m1Kpx8Bl+0hKukx X-Gm-Message-State: AOJu0YxXW/o2LN7ME6PeG4RZ4DvP0QEzYbVbxkPKcddVDzQxCN9WVAgw PvPQSBOZhkNbt9mG9bD9CsQssF5jSu+Sfqtdef8C05mmI5jLwTabzI0+Fb4lztI= X-Received: by 2002:a05:600c:1ca0:b0:41a:bc88:b84 with SMTP id 5b1f17b1804b1-41f71cc26f6mr3013945e9.1.1715102390920; Tue, 07 May 2024 10:19:50 -0700 (PDT) Received: from phenom.ffwll.local ([2a02:168:57f4:0:efd0:b9e5:5ae6:c2fa]) by smtp.gmail.com with ESMTPSA id c10-20020adfef4a000000b0034a3a0a753asm13300068wrp.100.2024.05.07.10.19.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 May 2024 10:19:50 -0700 (PDT) Date: Tue, 7 May 2024 19:19:46 +0200 From: Daniel Vetter To: Jason Gunthorpe Cc: Mina Almasry , Christoph Hellwig , Pavel Begunkov , 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 , Mina Almasry , Christoph Hellwig , Pavel Begunkov , 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: <20240403002053.2376017-1-almasrymina@google.com> <20240403002053.2376017-3-almasrymina@google.com> <20b1c2d9-0b37-414c-b348-89684c0c0998@gmail.com> <20240507161857.GA4718@ziepe.ca> <20240507164838.GG4718@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: <20240507164838.GG4718@ziepe.ca> X-Operating-System: Linux phenom 6.6.15-amd64 On Tue, May 07, 2024 at 01:48:38PM -0300, 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. > > If io_uring wants to take its existing memory pre-registration it can > wrap that in a dmbauf, and somehow pass it to the netstack. Userspace > doesn't need to know a dmabuf is being used in the background. So roughly the current dma-buf design considerations for the users of the dma-api interfaces: - It's a memory buffer of fixed length. - Either that memory is permanently nailed into place with dma_buf_pin (and if we add more users than just drm display then we should probably figure out the mlock account question for these). For locking hierarchy dma_buf_pin uses dma_resv_lock which nests within mmap_sem/vma locks but outside of any reclaim/alloc contexts. - Or the memory is more dynamic, in which case case you need to be able to dma_resv_lock when you need the memory and make a promise (as a dma_fence) that you'll release the memory within finite time and without any further allocations once you've unlocked the dma_buf (because dma_fence is in GFP_NORECLAIM). That promise can be waiting for memory access to finish, but it can also be a pte invalidate+tlb flush, or some kind of preemption, or whatever your hw can do really. Also, if you do this dynamic model and need to atomically reserve more than one dma_buf, you get to do the wait/wound mutex dance, but that's really just a bunch of funny looking error handling code and not really impacting the overall design or locking hierarchy. Everything else we can adjust, but I think the above three are not really changeable or dma-buf becomes unuseable for gpu drivers. Note that exporters of dma-buf can pretty much do whatever they feel like, including rejecting all the generic interfaces/ops, because we also use dma-buf as userspace handles for some really special memory. -Sima -- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch