From: Jason Gunthorpe <jgg@nvidia.com>
To: Peter Xu <peterx@redhat.com>
Cc: James Houghton <jthoughton@google.com>,
Jerome Marchand <jmarchan@redhat.com>,
"Kim, Dongwon" <dongwon.kim@intel.com>,
David Hildenbrand <david@redhat.com>,
"Chang, Junxiao" <junxiao.chang@intel.com>,
Muchun Song <muchun.song@linux.dev>,
"Kasireddy, Vivek" <vivek.kasireddy@intel.com>,
"dri-devel@lists.freedesktop.org"
<dri-devel@lists.freedesktop.org>,
"linux-mm@kvack.org" <linux-mm@kvack.org>,
"Hocko, Michal" <mhocko@suse.com>,
Gerd Hoffmann <kraxel@redhat.com>,
John Hubbard <jhubbard@nvidia.com>,
Andrew Morton <akpm@linux-foundation.org>,
"Kirill A . Shutemov" <kirill.shutemov@linux.intel.com>,
Mike Kravetz <mike.kravetz@oracle.com>
Subject: Re: [PATCH v1 0/2] udmabuf: Add back support for mapping hugetlb pages
Date: Tue, 27 Jun 2023 13:04:22 -0300 [thread overview]
Message-ID: <ZJsIhqD20pwD2WEq@nvidia.com> (raw)
In-Reply-To: <ZJsHpmNEZH8ZhTAP@x1n>
On Tue, Jun 27, 2023 at 12:00:38PM -0400, Peter Xu wrote:
> On Tue, Jun 27, 2023 at 12:52:34PM -0300, Jason Gunthorpe wrote:
> > On Mon, Jun 26, 2023 at 03:04:21PM -0400, Peter Xu wrote:
> > > On Mon, Jun 26, 2023 at 03:18:48PM -0300, Jason Gunthorpe wrote:
> > > > On Mon, Jun 26, 2023 at 08:14:27PM +0200, David Hildenbrand wrote:
> > > >
> > > > > So we might have to implement the same page migration as gup does on
> > > > > FOLL_LONGTERM here ... maybe there are more such cases/drivers that actually
> > > > > require that handling when simply taking pages out of the memfd, believing
> > > > > they can hold on to them forever.
> > > >
> > > > In general I would like to see an interface to FOLL_LONGTERM pin pages
> > > > from a memfd. I would quite happily use that in iommufd as well.
> > > >
> > > > It solves some problems we have there with fork/exec/etc if the pages
> > > > are not linked to a mm_struct.
> > >
> > > Afaiu any fd based approach should mean it'll never work with private
> > > memories, while mm-based should be able to work on any kind.
> >
> > Is there a significant use case to open a memfd and then use
> > MAP_PRIVATE? Why would anyone want to do that instead of just using
> > normal mmap anonymous memory?
>
> I remember David Hildenbrand somewhere mentioned the use case where one
> wants to snapshot a VM RAM into a file, then start multiple instances by
> loading that VM RAM with MAP_PRIVATE, so it clones a bunch of snapshoted VM
> running with a single RAM file shared as a template. Not a generic use
> case, I guess.
A file I can see, but a file is not a memfd, we are talking
specifically about memfd, aren't we?
> My question applies not only memfd but also in general - qemu by default
> doesn't use memfd afaict, so it boils down to e.g. whether you'll target
> the iommufd project to work in that case, where qemu uses anonymous
> memory.
I think this may change, as I understand it, the approach for
confidential compute is to put the guest memory in a memfd...
> Privately mapped file memory is only one of those kinds.
I think memfd and related shmem-like objects are a reasonable target. We
already know we should not FOLL_LONGTERM pin file backed pages.
Jason
WARNING: multiple messages have this Message-ID (diff)
From: Jason Gunthorpe <jgg@nvidia.com>
To: Peter Xu <peterx@redhat.com>
Cc: David Hildenbrand <david@redhat.com>,
"Kasireddy, Vivek" <vivek.kasireddy@intel.com>,
"dri-devel@lists.freedesktop.org"
<dri-devel@lists.freedesktop.org>,
"linux-mm@kvack.org" <linux-mm@kvack.org>,
Mike Kravetz <mike.kravetz@oracle.com>,
Gerd Hoffmann <kraxel@redhat.com>,
"Kim, Dongwon" <dongwon.kim@intel.com>,
Andrew Morton <akpm@linux-foundation.org>,
James Houghton <jthoughton@google.com>,
Jerome Marchand <jmarchan@redhat.com>,
"Chang, Junxiao" <junxiao.chang@intel.com>,
"Kirill A . Shutemov" <kirill.shutemov@linux.intel.com>,
"Hocko, Michal" <mhocko@suse.com>,
Muchun Song <muchun.song@linux.dev>,
John Hubbard <jhubbard@nvidia.com>
Subject: Re: [PATCH v1 0/2] udmabuf: Add back support for mapping hugetlb pages
Date: Tue, 27 Jun 2023 13:04:22 -0300 [thread overview]
Message-ID: <ZJsIhqD20pwD2WEq@nvidia.com> (raw)
In-Reply-To: <ZJsHpmNEZH8ZhTAP@x1n>
On Tue, Jun 27, 2023 at 12:00:38PM -0400, Peter Xu wrote:
> On Tue, Jun 27, 2023 at 12:52:34PM -0300, Jason Gunthorpe wrote:
> > On Mon, Jun 26, 2023 at 03:04:21PM -0400, Peter Xu wrote:
> > > On Mon, Jun 26, 2023 at 03:18:48PM -0300, Jason Gunthorpe wrote:
> > > > On Mon, Jun 26, 2023 at 08:14:27PM +0200, David Hildenbrand wrote:
> > > >
> > > > > So we might have to implement the same page migration as gup does on
> > > > > FOLL_LONGTERM here ... maybe there are more such cases/drivers that actually
> > > > > require that handling when simply taking pages out of the memfd, believing
> > > > > they can hold on to them forever.
> > > >
> > > > In general I would like to see an interface to FOLL_LONGTERM pin pages
> > > > from a memfd. I would quite happily use that in iommufd as well.
> > > >
> > > > It solves some problems we have there with fork/exec/etc if the pages
> > > > are not linked to a mm_struct.
> > >
> > > Afaiu any fd based approach should mean it'll never work with private
> > > memories, while mm-based should be able to work on any kind.
> >
> > Is there a significant use case to open a memfd and then use
> > MAP_PRIVATE? Why would anyone want to do that instead of just using
> > normal mmap anonymous memory?
>
> I remember David Hildenbrand somewhere mentioned the use case where one
> wants to snapshot a VM RAM into a file, then start multiple instances by
> loading that VM RAM with MAP_PRIVATE, so it clones a bunch of snapshoted VM
> running with a single RAM file shared as a template. Not a generic use
> case, I guess.
A file I can see, but a file is not a memfd, we are talking
specifically about memfd, aren't we?
> My question applies not only memfd but also in general - qemu by default
> doesn't use memfd afaict, so it boils down to e.g. whether you'll target
> the iommufd project to work in that case, where qemu uses anonymous
> memory.
I think this may change, as I understand it, the approach for
confidential compute is to put the guest memory in a memfd...
> Privately mapped file memory is only one of those kinds.
I think memfd and related shmem-like objects are a reasonable target. We
already know we should not FOLL_LONGTERM pin file backed pages.
Jason
next prev parent reply other threads:[~2023-06-27 16:04 UTC|newest]
Thread overview: 46+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-22 7:27 [PATCH v1 0/2] udmabuf: Add back support for mapping hugetlb pages Vivek Kasireddy
2023-06-22 7:27 ` Vivek Kasireddy
2023-06-22 7:27 ` [PATCH v1 1/2] udmabuf: Use vmf_insert_pfn and VM_PFNMAP for handling mmap Vivek Kasireddy
2023-06-22 7:27 ` Vivek Kasireddy
2023-06-22 7:27 ` [PATCH v1 2/2] udmabuf: Add back support for mapping hugetlb pages Vivek Kasireddy
2023-06-22 7:27 ` Vivek Kasireddy
2023-06-22 22:10 ` kernel test robot
2023-06-22 22:10 ` kernel test robot
2023-06-22 8:25 ` [PATCH v1 0/2] " David Hildenbrand
2023-06-22 8:25 ` David Hildenbrand
2023-06-22 21:33 ` Mike Kravetz
2023-06-22 21:33 ` Mike Kravetz
2023-06-23 6:13 ` Kasireddy, Vivek
2023-06-23 6:13 ` Kasireddy, Vivek
2023-06-23 16:35 ` Peter Xu
2023-06-23 16:35 ` Peter Xu
2023-06-23 16:37 ` Jason Gunthorpe
2023-06-23 16:37 ` Jason Gunthorpe
2023-06-23 17:28 ` Peter Xu
2023-06-23 17:28 ` Peter Xu
2023-06-26 12:57 ` Jason Gunthorpe
2023-06-26 12:57 ` Jason Gunthorpe
2023-06-26 7:45 ` Kasireddy, Vivek
2023-06-26 7:45 ` Kasireddy, Vivek
2023-06-26 17:52 ` Peter Xu
2023-06-26 17:52 ` Peter Xu
2023-06-26 18:14 ` David Hildenbrand
2023-06-26 18:14 ` David Hildenbrand
2023-06-26 18:18 ` Jason Gunthorpe
2023-06-26 18:18 ` Jason Gunthorpe
2023-06-26 19:04 ` Peter Xu
2023-06-26 19:04 ` Peter Xu
2023-06-27 15:52 ` Jason Gunthorpe
2023-06-27 15:52 ` Jason Gunthorpe
2023-06-27 16:00 ` Peter Xu
2023-06-27 16:00 ` Peter Xu
2023-06-27 16:04 ` Jason Gunthorpe [this message]
2023-06-27 16:04 ` Jason Gunthorpe
2023-06-27 6:37 ` Kasireddy, Vivek
2023-06-27 6:37 ` Kasireddy, Vivek
2023-06-27 7:10 ` David Hildenbrand
2023-06-27 7:10 ` David Hildenbrand
2023-06-28 8:04 ` Kasireddy, Vivek
2023-06-28 8:04 ` Kasireddy, Vivek
2023-08-08 16:17 ` Daniel Vetter
2023-08-08 16:17 ` Daniel Vetter
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=ZJsIhqD20pwD2WEq@nvidia.com \
--to=jgg@nvidia.com \
--cc=akpm@linux-foundation.org \
--cc=david@redhat.com \
--cc=dongwon.kim@intel.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=jhubbard@nvidia.com \
--cc=jmarchan@redhat.com \
--cc=jthoughton@google.com \
--cc=junxiao.chang@intel.com \
--cc=kirill.shutemov@linux.intel.com \
--cc=kraxel@redhat.com \
--cc=linux-mm@kvack.org \
--cc=mhocko@suse.com \
--cc=mike.kravetz@oracle.com \
--cc=muchun.song@linux.dev \
--cc=peterx@redhat.com \
--cc=vivek.kasireddy@intel.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.