All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: Mina Almasry <almasrymina@google.com>,
	Yunsheng Lin <linyunsheng@huawei.com>
Cc: davem@davemloft.net, pabeni@redhat.com, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	Willem de Bruijn <willemb@google.com>,
	Kaiyuan Zhang <kaiyuanz@google.com>,
	Jesper Dangaard Brouer <hawk@kernel.org>,
	Ilias Apalodimas <ilias.apalodimas@linaro.org>,
	Eric Dumazet <edumazet@google.com>
Subject: Re: [PATCH RFC 3/8] memory-provider: dmabuf devmem memory provider
Date: Mon, 13 Nov 2023 18:05:54 -0500	[thread overview]
Message-ID: <20231113180554.1d1c6b1a@kernel.org> (raw)
In-Reply-To: <CAHS8izMjmj0DRT_vjzVq5HMQyXtZdVK=o4OP0gzbaN=aJdQ3ig@mail.gmail.com>

On Mon, 13 Nov 2023 05:42:16 -0800 Mina Almasry wrote:
> You're doing exactly what I think you're doing, and what was nacked in RFC v1.
> 
> You've converted 'struct page_pool_iov' to essentially become a
> duplicate of 'struct page'. Then, you're casting page_pool_iov* into
> struct page* in mp_dmabuf_devmem_alloc_pages(), then, you're calling
> mm APIs like page_ref_*() on the page_pool_iov* because you've fooled
> the mm stack into thinking dma-buf memory is a struct page.
> 
> RFC v1 was almost exactly the same, except instead of creating a
> duplicate definition of struct page, it just allocated 'struct page'
> instead of allocating another struct that is identical to struct page
> and casting it into struct page.
> 
> I don't think what you're doing here reverses the nacks I got in RFC
> v1. You also did not CC any dma-buf or mm people on this proposal that
> would bring up these concerns again.

Right, but the mirror struct has some appeal to a non-mm person like
myself. The problem IIUC is that this patch is the wrong way around, we
should be converting everyone who can deal with non-host mem to struct
page_pool_iov. Using page_address() on ppiov which hns3 seems to do in
this series does not compute for me.

Then we can turn the existing non-iov helpers to be a thin wrapper with
just a cast from struct page to struct page_pool_iov, and a call of the
iov helper. Again - never cast the other way around.

Also I think this conversion can be done completely separately from the
mem provider changes. Just add struct page_pool_iov and start using it.

Does that make more sense?

  reply	other threads:[~2023-11-13 23:06 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-13 13:00 [PATCH RFC 0/8] A possible proposal for intergating dmabuf to page pool Yunsheng Lin
2023-11-13 13:00 ` [PATCH RFC 1/8] net: page_pool: factor out releasing DMA from releasing the page Yunsheng Lin
2023-11-13 13:00 ` [PATCH RFC 2/8] net: page_pool: create hooks for custom page providers Yunsheng Lin
2023-11-13 13:00 ` [PATCH RFC 3/8] memory-provider: dmabuf devmem memory provider Yunsheng Lin
2023-11-13 13:42   ` Mina Almasry
2023-11-13 23:05     ` Jakub Kicinski [this message]
2023-11-14  8:23       ` Yunsheng Lin
2023-11-14 12:21         ` Mina Almasry
2023-11-14 12:49           ` Yunsheng Lin
2023-11-14 12:58             ` Mina Almasry
2023-11-14 13:19               ` Yunsheng Lin
2023-11-14 15:41                 ` Willem de Bruijn
2023-11-15  9:29                   ` Yunsheng Lin
2023-11-15 18:07                     ` Mina Almasry
2023-11-15 19:05                       ` Mina Almasry
2023-11-16 11:12                         ` Yunsheng Lin
2023-11-16 11:30                           ` Mina Almasry
2023-11-14 13:16           ` Jason Gunthorpe
2023-11-15  6:46             ` Christian König
2023-11-15  9:21             ` Yunsheng Lin
2023-11-15 13:38               ` Jason Gunthorpe
2023-11-16 11:10                 ` Yunsheng Lin
2023-11-16 15:31                   ` Jason Gunthorpe
2023-11-15 17:44               ` Mina Almasry
2023-11-16 11:11                 ` Yunsheng Lin
2023-11-15 17:57               ` David Ahern
2023-11-16 11:12                 ` Yunsheng Lin
2023-11-16 15:58                   ` David Ahern
2023-11-17 11:27                     ` Yunsheng Lin
2023-11-14 22:25         ` Jakub Kicinski
2023-11-15  9:33           ` Yunsheng Lin
2023-11-13 13:00 ` [PATCH RFC 4/8] skbuff: explicitize the semantics of skb_frag_fill_page_desc() Yunsheng Lin
2023-11-13 13:00 ` [PATCH RFC 5/8] skbuff: remove compound_head() related function calling Yunsheng Lin
2023-11-13 13:00 ` [PATCH RFC 6/8] skbuff: always try to do page pool frag reference counting Yunsheng Lin
2023-11-13 13:00 ` [PATCH RFC 7/8] net: hns3: temp hack for hns3 to use dmabuf memory provider Yunsheng Lin
2023-11-13 13:00 ` [PATCH RFC 8/8] net: temp hack for dmabuf page in __skb_datagram_iter() Yunsheng Lin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231113180554.1d1c6b1a@kernel.org \
    --to=kuba@kernel.org \
    --cc=almasrymina@google.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=hawk@kernel.org \
    --cc=ilias.apalodimas@linaro.org \
    --cc=kaiyuanz@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linyunsheng@huawei.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=willemb@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.