linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Jason Gunthorpe <jgg@nvidia.com>
To: Yunsheng Lin <linyunsheng@huawei.com>
Cc: "Mina Almasry" <almasrymina@google.com>,
	"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: Thu, 16 Nov 2023 11:31:47 -0400	[thread overview]
Message-ID: <ZVY14zBmi1wgZBiw@nvidia.com> (raw)
In-Reply-To: <0a1cdd5a-c4c5-3d77-20a2-2beb8e3a6411@huawei.com>

On Thu, Nov 16, 2023 at 07:10:01PM +0800, Yunsheng Lin wrote:
> On 2023/11/15 21:38, Jason Gunthorpe wrote:
> > On Wed, Nov 15, 2023 at 05:21:02PM +0800, Yunsheng Lin wrote:
> > 
> >>>>> I would expect net stack, page pool, driver still see the 'struct page',
> >>>>> only memory provider see the specific struct for itself, for the above,
> >>>>> devmem memory provider sees the 'struct page_pool_iov'.
> >>>>>
> >>>>> The reason I still expect driver to see the 'struct page' is that driver
> >>>>> will still need to support normal memory besides devmem.
> >>>
> >>> I wouldn't say this approach is unreasonable, but it does have to be
> >>> done carefully to isolate the mm. Keeping the struct page in the API
> >>> is going to make this very hard.
> >>
> >> I would expect that most of the isolation is done in page pool, as far as
> >> I can see:
> > 
> > It is the sort of thing that is important enough it should have
> > compiler help via types to prove that it is being done
> > properly. Otherwise it will be full of mistakes over time.
> 
> Yes, agreed.
> 
> I have done something similar as willy has done for some of
> folio conversion as below:

That is not at all what I mean, I mean you should not use
struct page * types at all in code that flows from the _iov version
except via limited accessors that can be audited and have appropriate
assertions.

Just releasing struct page * that is not a struct page * everywhere
without type safety will never be correct long term.

Jason


  reply	other threads:[~2023-11-16 15:32 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 [this message]
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

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=ZVY14zBmi1wgZBiw@nvidia.com \
    --to=jgg@nvidia.com \
    --cc=almasrymina@google.com \
    --cc=christian.koenig@amd.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=hawk@kernel.org \
    --cc=ilias.apalodimas@linaro.org \
    --cc=kaiyuanz@google.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linyunsheng@huawei.com \
    --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