From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 692F67F4 for ; Thu, 9 Nov 2023 01:00:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=davidwei-uk.20230601.gappssmtp.com header.i=@davidwei-uk.20230601.gappssmtp.com header.b="twBcydj1" Received: from mail-pl1-x631.google.com (mail-pl1-x631.google.com [IPv6:2607:f8b0:4864:20::631]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 02B31258A for ; Wed, 8 Nov 2023 17:00:44 -0800 (PST) Received: by mail-pl1-x631.google.com with SMTP id d9443c01a7336-1cc3bc5df96so2306825ad.2 for ; Wed, 08 Nov 2023 17:00:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=davidwei-uk.20230601.gappssmtp.com; s=20230601; t=1699491643; x=1700096443; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=g+m1/eec3BAI+VxQgeWP5nozlTdhs+GvhhRREFgPtnw=; b=twBcydj177gEe6trQmjXVoEAVUA814gQxanP2tNi0bC3WYu6GFBi1NTJRuGFMc7qcb N1KFTTsThKZvuYzaT5/e43BdLn98gA4KcYLDiodnOM9uamizS8mZ9pXr73tQHJjWEjHi g9H1P6xpegWWj9yuDLHtWitsfInUyguJwyoGEy8ZNIbkP0BgIllWYEhtXdtsjPAqaAV7 5jjzjuj9NNgm7m2bXKd8/ghLRdWG1Lf80THlMHFiVTNR9MpuDFRZUIrpZDMmqvafM0jH rzsw88LY2cGiakpGyVwhgep1rMZP8RoXur38b63NkiS9x71ETQvVDbUGwbahhix27iXP W6Mw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699491643; x=1700096443; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=g+m1/eec3BAI+VxQgeWP5nozlTdhs+GvhhRREFgPtnw=; b=KJWHm7JH1YEU7BekNi6BDcHiZQNcJ8g9yNUkcrSg+yeuImKKf+7BuTqbJK/LAJdWac u/sToNnYL7TIbaA8+Koxe2c/bnKuXl3BSbXZqVyMctpgScQyKMWh36s+exhxXVcgJ5LY iWILhBQAREddpD7wplmYaRCTGCPivywPCC8Lb98o11hvS9JJ6sl1K4QbgNzMkSlATjtR vDTEe4C7W68E9bO/2LB2+tcrIwIXaL+w9fjRe7M0qNaC5iiclI3RvSv2YlwZjeAZ9gWj A77GUn4yFN2np0xPSsPHxFCnjKYlilryCKVfJaepKjshy/jTIcehzuCruKqXCz1RUKvk QvcQ== X-Gm-Message-State: AOJu0YzHYyA28tO5Afc19nh8R4yYNwM6juZ2PX5Lzj0jYZohJx/D7vpp mUv61G94COUHOOnulpyJDI8b6A== X-Google-Smtp-Source: AGHT+IGqOk5pLGreahWyU5Tyhch5OGepp+ms2LPYRQxo1oPkx1W4LYvgzN77Bieh5CFVk1MoPdYbhQ== X-Received: by 2002:a17:902:d2cf:b0:1cc:6acc:8fa4 with SMTP id n15-20020a170902d2cf00b001cc6acc8fa4mr4025647plc.32.1699491643400; Wed, 08 Nov 2023 17:00:43 -0800 (PST) Received: from ?IPV6:2a03:83e0:1256:2:c51:2090:e106:83fa? ([2620:10d:c090:500::5:887f]) by smtp.gmail.com with ESMTPSA id g10-20020a170902934a00b001b0358848b0sm2287468plp.161.2023.11.08.17.00.40 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 08 Nov 2023 17:00:43 -0800 (PST) Message-ID: Date: Wed, 8 Nov 2023 17:00:39 -0800 Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [RFC PATCH v3 05/12] netdev: netdevice devmem allocator Content-Language: en-GB To: David Ahern , Mina Almasry Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arch@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 , Jesper Dangaard Brouer , Ilias Apalodimas , Arnd Bergmann , Willem de Bruijn , Shuah Khan , Sumit Semwal , =?UTF-8?Q?Christian_K=C3=B6nig?= , Shakeel Butt , Jeroen de Borst , Praveen Kaligineedi , Willem de Bruijn , Kaiyuan Zhang , Pavel Begunkov References: <20231106024413.2801438-1-almasrymina@google.com> <20231106024413.2801438-6-almasrymina@google.com> <3b0d612c-e33b-48aa-a861-fbb042572fc9@kernel.org> From: David Wei In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On 2023-11-07 14:55, David Ahern wrote: > On 11/7/23 3:10 PM, Mina Almasry wrote: >> On Mon, Nov 6, 2023 at 3:44 PM David Ahern wrote: >>> >>> On 11/5/23 7:44 PM, Mina Almasry wrote: >>>> diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h >>>> index eeeda849115c..1c351c138a5b 100644 >>>> --- a/include/linux/netdevice.h >>>> +++ b/include/linux/netdevice.h >>>> @@ -843,6 +843,9 @@ struct netdev_dmabuf_binding { >>>> }; >>>> >>>> #ifdef CONFIG_DMA_SHARED_BUFFER >>>> +struct page_pool_iov * >>>> +netdev_alloc_devmem(struct netdev_dmabuf_binding *binding); >>>> +void netdev_free_devmem(struct page_pool_iov *ppiov); >>> >>> netdev_{alloc,free}_dmabuf? >>> >> >> Can do. >> >>> I say that because a dmabuf can be host memory, at least I am not aware >>> of a restriction that a dmabuf is device memory. >>> >> >> In my limited experience dma-buf is generally device memory, and >> that's really its use case. CONFIG_UDMABUF is a driver that mocks >> dma-buf with a memfd which I think is used for testing. But I can do >> the rename, it's more clear anyway, I think. > > config UDMABUF > bool "userspace dmabuf misc driver" > default n > depends on DMA_SHARED_BUFFER > depends on MEMFD_CREATE || COMPILE_TEST > help > A driver to let userspace turn memfd regions into dma-bufs. > Qemu can use this to create host dmabufs for guest framebuffers. > > > Qemu is just a userspace process; it is no way a special one. > > Treating host memory as a dmabuf should radically simplify the io_uring > extension of this set. That the io_uring set needs to dive into > page_pools is just wrong - complicating the design and code and pushing > io_uring into a realm it does not need to be involved in. I think our io_uring proposal will already be vastly simplified once we rebase onto Kuba's page pool memory provider API. Using udmabuf means depending on a driver designed for testing, vs io_uring's registered buffers API that's been tried and tested. I don't have an intuitive understanding of the trade offs yet, and would need to try out udmabuf and compare vs say using our own page pool memory provider. > > Most (all?) of this patch set can work with any memory; only device > memory is unreadable. > >