[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAAywjhRb0Lb9fJocWBU1r01521sy71hLOaH=92gqceXqUOGHJg@mail.gmail.com>
Date: Fri, 22 Nov 2024 14:10:28 -0800
From: Samiullah Khawaja <skhawaja@...gle.com>
To: Jason Gunthorpe <jgg@...pe.ca>
Cc: Mina Almasry <almasrymina@...gle.com>, netdev@...r.kernel.org,
Jakub Kicinski <kuba@...nel.org>, Pavel Begunkov <asml.silence@...il.com>,
Willem de Bruijn <willemb@...gle.com>, Kaiyuan Zhang <kaiyuanz@...gle.com>, linux-kernel@...r.kernel.org,
"David S. Miller" <davem@...emloft.net>, Eric Dumazet <edumazet@...gle.com>,
Paolo Abeni <pabeni@...hat.com>, Simon Horman <horms@...nel.org>,
Jesper Dangaard Brouer <hawk@...nel.org>, Ilias Apalodimas <ilias.apalodimas@...aro.org>
Subject: Re: [PATCH net-next v2 4/5] page_pool: disable sync for cpu for
dmabuf memory provider
On Thu, Nov 14, 2024 at 5:59 PM Jason Gunthorpe <jgg@...pe.ca> wrote:
>
> On Fri, Nov 08, 2024 at 11:01:21AM -0800, Mina Almasry wrote:
>
> > > If you do this you may want to block accepting dmabufs that have CPU
> > > pages inside them.
I believe we should be following the dmabuf API for this purpose, if
we really want to sync for CPU in. page_pool, and should not assume
the behaviour of the backing memory.
The dmabuf exporters are supposed to implement the begin_cpu_access
(optional) and the sync for cpu is done based on the exporter
implementation.
For example udmabuf implementation calls `dma_sync_sg_for_cpu` on the
underlying pages.
I think following dmabuf APIs can be used to ensure the backing memory
is synced:
Before cpu access to sync for cpu
`dma_buf_begin_cpu_access`
After cpu access to be synced for device
`dma_buf_end_cpu_access`
Sami
> > >
> >
> > How do I check if the dmabuf has CPU pages inside of it? The only way
> > I can think to do that is to sg_page a scatterlist entry, then
> > !is_zone_device_page() the page. Or something like that, but I thought
> > calling sg_page() on the dmabuf scatterlist was banned now.
>
> I don't know. Many dmabuf scenarios abuse scatter list and the CPU
> list is invalid, so you can't reference sg_page().
>
> I think you'd need to discuss with the dmabuf maintainers.
>
> Jason
Powered by blists - more mailing lists