linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Yunsheng Lin <linyunsheng@huawei.com>
To: David Ahern <dsahern@kernel.org>,
	Jason Gunthorpe <jgg@nvidia.com>,
	Mina Almasry <almasrymina@google.com>
Cc: "Jakub Kicinski" <kuba@kernel.org>,
	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>,
	"Christian König" <christian.koenig@amd.com>,
	"Matthew Wilcox" <willy@infradead.org>,
	Linux-MM <linux-mm@kvack.org>
Subject: Re: [PATCH RFC 3/8] memory-provider: dmabuf devmem memory provider
Date: Fri, 17 Nov 2023 19:27:45 +0800	[thread overview]
Message-ID: <f70b2a3f-692c-dfcf-22d2-c688360c3dda@huawei.com> (raw)
In-Reply-To: <d5672499-ce5b-45c0-b47a-e5bb188f6c7f@kernel.org>

On 2023/11/16 23:58, David Ahern wrote:
> On 11/16/23 4:12 AM, Yunsheng Lin wrote:
>> On 2023/11/16 1:57, David Ahern wrote:
>>> On 11/15/23 2:21 AM, Yunsheng Lin wrote:
>>>> On 2023/11/14 21:16, Jason Gunthorpe wrote:
>>>>> On Tue, Nov 14, 2023 at 04:21:26AM -0800, Mina Almasry wrote:
>>>>>
>>>>>> Actually because you put the 'strtuct page for devmem' in
>>>>>> skb->bv_frag, the net stack will grab the 'struct page' for devmem
>>>>>> using skb_frag_page() then call things like page_address(), kmap,
>>>>>> get_page, put_page, etc, etc, etc.
>>>>>
>>>>> Yikes, please no. If net has its own struct page look alike it has to
>>>>> stay entirely inside net. A non-mm owned struct page should not be
>>>>> passed into mm calls. It is just way too hacky to be seriously
>>>>> considered :(
>>>>
>>>> Yes, that is something this patchset is trying to do, defining its own
>>>> struct page look alike for page pool to support devmem.
>>>>
>>>
>>> Networking needs to be able to move away from struct page references.
>>> The devmem and host memory for Rx use cases do not need to be page based.
>>
>> Yes, I am agreed the ultimate goal is to move away from struct page
>> references. But I am not sure if we can do it right away as there
>> still are different types of existing 'struct page' in the netstack,
>> see:
>>
>> https://lore.kernel.org/all/8b7d25eb-1f10-3e37-8753-92b42da3fb34@huawei.com/
> 
> yes, that is the point of a blended approach -- pages and buffers (or
> iov) -- leveraging the LSB of the address. That proposal is the right

I am not sure leveraging the LSB of the address is necessary yet, as it
does not seems to provide the type check protection, it seems to just
provide a way to demux between pages(including page pool owned page and
non-page pool owned page) and page pool owned buffer.
That info is avaliable through the page->pp_magic and page->pp->mp_*
too if we mirror the page pool specific union in 'struct page'.

> direction to be moving for co-existence. Adding fake struct page
> instances is the wrong direction.

Perhaps a fake struct page with type check protection is the right
direction?

Intergrating devmem to page pool without a unified metadata between
pages and buffers or without a proper abstract layer does not seems
like the good direction either.

> .
> 


  reply	other threads:[~2023-11-17 11:27 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20231113130041.58124-1-linyunsheng@huawei.com>
     [not found] ` <20231113130041.58124-4-linyunsheng@huawei.com>
     [not found]   ` <CAHS8izMjmj0DRT_vjzVq5HMQyXtZdVK=o4OP0gzbaN=aJdQ3ig@mail.gmail.com>
     [not found]     ` <20231113180554.1d1c6b1a@kernel.org>
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 [this message]
2023-11-14 22:25         ` Jakub Kicinski
2023-11-15  9:33           ` 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=f70b2a3f-692c-dfcf-22d2-c688360c3dda@huawei.com \
    --to=linyunsheng@huawei.com \
    --cc=almasrymina@google.com \
    --cc=christian.koenig@amd.com \
    --cc=davem@davemloft.net \
    --cc=dsahern@kernel.org \
    --cc=edumazet@google.com \
    --cc=hawk@kernel.org \
    --cc=ilias.apalodimas@linaro.org \
    --cc=jgg@nvidia.com \
    --cc=kaiyuanz@google.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=willemb@google.com \
    --cc=willy@infradead.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox