Re: [net-next v1 08/16] memory-provider: dmabuf devmem memory provider

2023-12-19 Thread Pavel Begunkov
On 12/14/23 20:03, Mina Almasry wrote: On Mon, Dec 11, 2023 at 12:37 PM Pavel Begunkov wrote: ... If you remove the branch, let it fall into ->release and rely on refcounting there, then the callback could also fix up release_cnt or ask pp to do it, like in the patch I linked above Sadly I

Re: [net-next v1 08/16] memory-provider: dmabuf devmem memory provider

2023-12-14 Thread Mina Almasry
On Mon, Dec 11, 2023 at 12:37 PM Pavel Begunkov wrote: ... > >> If you remove the branch, let it fall into ->release and rely > >> on refcounting there, then the callback could also fix up > >> release_cnt or ask pp to do it, like in the patch I linked above > >> > > > > Sadly I don't think this

Re: [net-next v1 08/16] memory-provider: dmabuf devmem memory provider

2023-12-13 Thread Yinjun Zhang
On Thu, 7 Dec 2023 16:52:39 -0800, Mina Almasry wrote: <...> > +static int mp_dmabuf_devmem_init(struct page_pool *pool) > +{ > + struct netdev_dmabuf_binding *binding = pool->mp_priv; > + > + if (!binding) > + return -EINVAL; > + > + if (!(pool->p.flags &

Re: [net-next v1 08/16] memory-provider: dmabuf devmem memory provider

2023-12-12 Thread David Ahern
On 12/12/23 6:09 PM, Mina Almasry wrote: > OK, I imagine this is not that hard to implement - it's really whether > the change is acceptable to reviewers. > > I figure I can start by implementing a no-op abstraction to page*: > > typedef struct page netmem_t > > and replace the page* in the

Re: [net-next v1 08/16] memory-provider: dmabuf devmem memory provider

2023-12-12 Thread Mina Almasry
On Tue, Dec 12, 2023 at 7:08 AM Jason Gunthorpe wrote: > > On Tue, Dec 12, 2023 at 06:58:17AM -0800, Mina Almasry wrote: > > > Jason, we set the LSB on page_pool_iov pointers before casting it to > > struct page pointers. The resulting pointers are not useable as page > > pointers at all. > > I

Re: [net-next v1 08/16] memory-provider: dmabuf devmem memory provider

2023-12-12 Thread Jason Gunthorpe
On Tue, Dec 12, 2023 at 06:58:17AM -0800, Mina Almasry wrote: > Jason, we set the LSB on page_pool_iov pointers before casting it to > struct page pointers. The resulting pointers are not useable as page > pointers at all. I understand that, the second ask is about maintainability of the mm by

Re: [net-next v1 08/16] memory-provider: dmabuf devmem memory provider

2023-12-12 Thread Mina Almasry
On Tue, Dec 12, 2023 at 6:39 AM Jason Gunthorpe wrote: > > On Tue, Dec 12, 2023 at 06:26:51AM -0800, Mina Almasry wrote: > > On Tue, Dec 12, 2023 at 4:25 AM Jason Gunthorpe wrote: > > > > > > On Thu, Dec 07, 2023 at 04:52:39PM -0800, Mina Almasry wrote: > > > > > > > +static inline struct

Re: [net-next v1 08/16] memory-provider: dmabuf devmem memory provider

2023-12-12 Thread Jason Gunthorpe
On Tue, Dec 12, 2023 at 06:26:51AM -0800, Mina Almasry wrote: > On Tue, Dec 12, 2023 at 4:25 AM Jason Gunthorpe wrote: > > > > On Thu, Dec 07, 2023 at 04:52:39PM -0800, Mina Almasry wrote: > > > > > +static inline struct page_pool_iov *page_to_page_pool_iov(struct page > > > *page) > > > +{ > >

Re: [net-next v1 08/16] memory-provider: dmabuf devmem memory provider

2023-12-12 Thread Mina Almasry
On Tue, Dec 12, 2023 at 4:25 AM Jason Gunthorpe wrote: > > On Thu, Dec 07, 2023 at 04:52:39PM -0800, Mina Almasry wrote: > > > +static inline struct page_pool_iov *page_to_page_pool_iov(struct page > > *page) > > +{ > > + if (page_is_page_pool_iov(page)) > > + return (struct

Re: [net-next v1 08/16] memory-provider: dmabuf devmem memory provider

2023-12-12 Thread Jason Gunthorpe
On Thu, Dec 07, 2023 at 04:52:39PM -0800, Mina Almasry wrote: > +static inline struct page_pool_iov *page_to_page_pool_iov(struct page *page) > +{ > + if (page_is_page_pool_iov(page)) > + return (struct page_pool_iov *)((unsigned long)page & ~PP_IOV); > + > +

Re: [net-next v1 08/16] memory-provider: dmabuf devmem memory provider

2023-12-11 Thread Pavel Begunkov
On 12/11/23 02:30, Mina Almasry wrote: On Sat, Dec 9, 2023 at 7:05 PM Pavel Begunkov wrote: On 12/8/23 23:25, Mina Almasry wrote: On Fri, Dec 8, 2023 at 2:56 PM Pavel Begunkov wrote: On 12/8/23 00:52, Mina Almasry wrote: ... + if (pool->p.queue) + binding =

Re: [net-next v1 08/16] memory-provider: dmabuf devmem memory provider

2023-12-10 Thread Mina Almasry
On Sat, Dec 9, 2023 at 7:05 PM Pavel Begunkov wrote: > > On 12/8/23 23:25, Mina Almasry wrote: > > On Fri, Dec 8, 2023 at 2:56 PM Pavel Begunkov > > wrote: > >> > >> On 12/8/23 00:52, Mina Almasry wrote: > > ... > >>> + if (pool->p.queue) > >>> + binding =

Re: [net-next v1 08/16] memory-provider: dmabuf devmem memory provider

2023-12-09 Thread Pavel Begunkov
On 12/8/23 23:25, Mina Almasry wrote: On Fri, Dec 8, 2023 at 2:56 PM Pavel Begunkov wrote: On 12/8/23 00:52, Mina Almasry wrote: ... + if (pool->p.queue) + binding = READ_ONCE(pool->p.queue->binding); + + if (binding) { + pool->mp_ops = _devmem_ops; +

Re: [net-next v1 08/16] memory-provider: dmabuf devmem memory provider

2023-12-08 Thread Mina Almasry
On Fri, Dec 8, 2023 at 2:56 PM Pavel Begunkov wrote: > > On 12/8/23 00:52, Mina Almasry wrote: ... > > + if (pool->p.queue) > > + binding = READ_ONCE(pool->p.queue->binding); > > + > > + if (binding) { > > + pool->mp_ops = _devmem_ops; > > +

Re: [net-next v1 08/16] memory-provider: dmabuf devmem memory provider

2023-12-08 Thread Pavel Begunkov
On 12/8/23 00:52, Mina Almasry wrote: Implement a memory provider that allocates dmabuf devmem page_pool_iovs. The provider receives a reference to the struct netdev_dmabuf_binding via the pool->mp_priv pointer. The driver needs to set this pointer for the provider in the page_pool_params. The

Re: [net-next v1 08/16] memory-provider: dmabuf devmem memory provider

2023-12-08 Thread Pavel Begunkov
On 12/8/23 00:52, Mina Almasry wrote: Implement a memory provider that allocates dmabuf devmem page_pool_iovs. The provider receives a reference to the struct netdev_dmabuf_binding via the pool->mp_priv pointer. The driver needs to set this pointer for the provider in the page_pool_params. The

[net-next v1 08/16] memory-provider: dmabuf devmem memory provider

2023-12-07 Thread Mina Almasry
Implement a memory provider that allocates dmabuf devmem page_pool_iovs. The provider receives a reference to the struct netdev_dmabuf_binding via the pool->mp_priv pointer. The driver needs to set this pointer for the provider in the page_pool_params. The provider obtains a reference on the