All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jarkko Sakkinen <jarkko@kernel.org>
To: David Laight <David.Laight@aculab.com>
Cc: "Michal Hocko" <mhocko@suse.com>,
	zhangyiru <zhangyiru3@huawei.com>,
	"Daniel Vetter" <daniel.vetter@ffwll.ch>,
	"Dave Hansen" <dave.hansen@linux.intel.com>,
	"dri-devel@lists.freedesktop.org"
	<dri-devel@lists.freedesktop.org>,
	"Chris Wilson" <chris@chris-wilson.co.uk>,
	"linux-mm@kvack.org" <linux-mm@kvack.org>,
	"Alexander Mikhalitsyn" <alexander.mikhalitsyn@virtuozzo.com>,
	"Florian Fainelli" <f.fainelli@gmail.com>,
	"linux-unionfs@vger.kernel.org" <linux-unionfs@vger.kernel.org>,
	"Matthew Wilcox" <willy@infradead.org>,
	"codalist@coda.cs.cmu.edu" <codalist@coda.cs.cmu.edu>,
	"'Christoph Hellwig'" <hch@infradead.org>,
	"Matthew Auld" <matthew.auld@intel.com>,
	"Vasily Averin" <vvs@virtuozzo.com>,
	"Thomas Hellström" <thomas.hellstrom@linux.intel.com>,
	"intel-gfx@lists.freedesktop.org"
	<intel-gfx@lists.freedesktop.org>, "G@iki.fi" <G@iki.fi>,
	"linux-mips@vger.kernel.org" <linux-mips@vger.kernel.org>,
	"Shakeel Butt" <shakeelb@google.com>,
	"Reinette Chatre" <reinette.chatre@intel.com>,
	"linux-sgx@vger.kernel.org" <linux-sgx@vger.kernel.org>,
	"Thomas Bogendoerfer" <tsbogend@alpha.franken.de>,
	"Nathaniel McCallum" <nathaniel@profian.com>,
	"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-fsdevel@vger.kernel.org" <linux-fsdevel@vger.kernel.org>,
	"Andrew Morton" <akpm@linux-foundation.org>,
	"Alexey Gladkov" <legion@kernel.org>
Subject: Re: [Intel-gfx] [PATCH RFC 0/3] MAP_POPULATE for device memory
Date: Tue, 8 Mar 2022 12:10:45 +0200	[thread overview]
Message-ID: <YicrpX9K1dSdCK7u@iki.fi> (raw)
In-Reply-To: <5729d03d6a174da6b66d1534ebdb1127@AcuMS.aculab.com>

On Mon, Mar 07, 2022 at 10:11:19PM +0000, David Laight wrote:
> From: Christoph Hellwig
> > Sent: 07 March 2022 15:57
> > 
> > On Mon, Mar 07, 2022 at 03:29:35PM +0200, Jarkko Sakkinen wrote:
> > > So what would you suggest to sort out the issue? I'm happy to go with
> > > ioctl if nothing else is acceptable.
> > 
> > PLenty of drivers treat all mmaps as if MAP_POPULATE was specified,
> > typically by using (io_)remap_pfn_range.  If there any reason to only
> > optionally have the pre-fault semantics for sgx?  If not this should
> > be really simple.  And if we have a real need for it to be optional
> > we'll just need to find a sane way to pass that information to ->mmap.
> 
> Is there any space in vma->vm_flags ?
> 
> That would be better than an extra argument or function.

It's very dense but I'll give a shot for callback route based on Dave's
comments in this thread. I.e. use it as filter inside __mm_populate() and
populate_vma_page_range().

For Enarx, which we are implementing being able to use MAP_POPULATE and get
the full range EAUG'd would be best way to optimize the performance of wasm
JIT (Enarx is a wasm run-time capable of running inside an SGX enclave, AMD
SEV-SNP VM etc.). More so than any predictor (ra_state, madvice etc.) inside
#PF handler, which have been suggested in this thread.

After some research on how we implement user space, I'd rather keep the #PF
handler working on a single page (EAUG a single page) and have either ioctl
or MAP_POPULATE to do the batch fill.

We can still "not trust the user space" i.e. the populate does not have to
guarantee to do the full length since the #PF handler will then fill the
holes. This was one concern in this thread but it is not hard to address.

BR, Jarkko

WARNING: multiple messages have this Message-ID (diff)
From: Jarkko Sakkinen <jarkko@kernel.org>
To: David Laight <David.Laight@aculab.com>
Cc: "'Christoph Hellwig'" <hch@infradead.org>,
	"Matthew Wilcox" <willy@infradead.org>,
	"linux-mm@kvack.org" <linux-mm@kvack.org>,
	"Dave Hansen" <dave.hansen@linux.intel.com>,
	"Nathaniel McCallum" <nathaniel@profian.com>,
	"Reinette Chatre" <reinette.chatre@intel.com>,
	"Andrew Morton" <akpm@linux-foundation.org>,
	"linux-sgx@vger.kernel.org" <linux-sgx@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"Florian Fainelli" <f.fainelli@gmail.com>,
	"Thomas Bogendoerfer" <tsbogend@alpha.franken.de>,
	"Matthew Auld" <matthew.auld@intel.com>,
	"Thomas Hellström" <thomas.hellstrom@linux.intel.com>,
	"Daniel Vetter" <daniel.vetter@ffwll.ch>,
	"Jason Ekstrand" <jason@jlekstrand.net>,
	"Chris Wilson" <chris@chris-wilson.co.uk>, "G@iki.fi" <G@iki.fi>,
	"Maarten Lankhorst" <maarten.lankhorst@linux.intel.com>,
	"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
	"Tvrtko Ursulin" <tvrtko.ursulin@intel.com>,
	"Vasily Averin" <vvs@virtuozzo.com>,
	"Shakeel Butt" <shakeelb@google.com>,
	"Michal Hocko" <mhocko@suse.com>,
	zhangyiru <zhangyiru3@huawei.com>,
	"Alexey Gladkov" <legion@kernel.org>,
	"Alexander Mikhalitsyn" <alexander.mikhalitsyn@virtuozzo.com>,
	"linux-mips@vger.kernel.org" <linux-mips@vger.kernel.org>,
	"intel-gfx@lists.freedesktop.org"
	<intel-gfx@lists.freedesktop.org>,
	"dri-devel@lists.freedesktop.org"
	<dri-devel@lists.freedesktop.org>,
	"codalist@coda.cs.cmu.edu" <codalist@coda.cs.cmu.edu>,
	"linux-unionfs@vger.kernel.org" <linux-unionfs@vger.kernel.org>,
	"linux-fsdevel@vger.kernel.org" <linux-fsdevel@vger.kernel.org>
Subject: Re: [PATCH RFC 0/3] MAP_POPULATE for device memory
Date: Tue, 8 Mar 2022 12:10:45 +0200	[thread overview]
Message-ID: <YicrpX9K1dSdCK7u@iki.fi> (raw)
In-Reply-To: <5729d03d6a174da6b66d1534ebdb1127@AcuMS.aculab.com>

On Mon, Mar 07, 2022 at 10:11:19PM +0000, David Laight wrote:
> From: Christoph Hellwig
> > Sent: 07 March 2022 15:57
> > 
> > On Mon, Mar 07, 2022 at 03:29:35PM +0200, Jarkko Sakkinen wrote:
> > > So what would you suggest to sort out the issue? I'm happy to go with
> > > ioctl if nothing else is acceptable.
> > 
> > PLenty of drivers treat all mmaps as if MAP_POPULATE was specified,
> > typically by using (io_)remap_pfn_range.  If there any reason to only
> > optionally have the pre-fault semantics for sgx?  If not this should
> > be really simple.  And if we have a real need for it to be optional
> > we'll just need to find a sane way to pass that information to ->mmap.
> 
> Is there any space in vma->vm_flags ?
> 
> That would be better than an extra argument or function.

It's very dense but I'll give a shot for callback route based on Dave's
comments in this thread. I.e. use it as filter inside __mm_populate() and
populate_vma_page_range().

For Enarx, which we are implementing being able to use MAP_POPULATE and get
the full range EAUG'd would be best way to optimize the performance of wasm
JIT (Enarx is a wasm run-time capable of running inside an SGX enclave, AMD
SEV-SNP VM etc.). More so than any predictor (ra_state, madvice etc.) inside
#PF handler, which have been suggested in this thread.

After some research on how we implement user space, I'd rather keep the #PF
handler working on a single page (EAUG a single page) and have either ioctl
or MAP_POPULATE to do the batch fill.

We can still "not trust the user space" i.e. the populate does not have to
guarantee to do the full length since the #PF handler will then fill the
holes. This was one concern in this thread but it is not hard to address.

BR, Jarkko

WARNING: multiple messages have this Message-ID (diff)
From: Jarkko Sakkinen <jarkko@kernel.org>
To: David Laight <David.Laight@aculab.com>
Cc: "Michal Hocko" <mhocko@suse.com>,
	zhangyiru <zhangyiru3@huawei.com>,
	"Daniel Vetter" <daniel.vetter@ffwll.ch>,
	"Dave Hansen" <dave.hansen@linux.intel.com>,
	"dri-devel@lists.freedesktop.org"
	<dri-devel@lists.freedesktop.org>,
	"Chris Wilson" <chris@chris-wilson.co.uk>,
	"linux-mm@kvack.org" <linux-mm@kvack.org>,
	"Jason Ekstrand" <jason@jlekstrand.net>,
	"Alexander Mikhalitsyn" <alexander.mikhalitsyn@virtuozzo.com>,
	"Florian Fainelli" <f.fainelli@gmail.com>,
	"linux-unionfs@vger.kernel.org" <linux-unionfs@vger.kernel.org>,
	"Matthew Wilcox" <willy@infradead.org>,
	"codalist@coda.cs.cmu.edu" <codalist@coda.cs.cmu.edu>,
	"'Christoph Hellwig'" <hch@infradead.org>,
	"Matthew Auld" <matthew.auld@intel.com>,
	"Vasily Averin" <vvs@virtuozzo.com>,
	"Thomas Hellström" <thomas.hellstrom@linux.intel.com>,
	"intel-gfx@lists.freedesktop.org"
	<intel-gfx@lists.freedesktop.org>, "G@iki.fi" <G@iki.fi>,
	"linux-mips@vger.kernel.org" <linux-mips@vger.kernel.org>,
	"Shakeel Butt" <shakeelb@google.com>,
	"Reinette Chatre" <reinette.chatre@intel.com>,
	"linux-sgx@vger.kernel.org" <linux-sgx@vger.kernel.org>,
	"Thomas Bogendoerfer" <tsbogend@alpha.franken.de>,
	"Nathaniel McCallum" <nathaniel@profian.com>,
	"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
	"Tvrtko Ursulin" <tvrtko.ursulin@intel.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-fsdevel@vger.kernel.org" <linux-fsdevel@vger.kernel.org>,
	"Andrew Morton" <akpm@linux-foundation.org>,
	"Alexey Gladkov" <legion@kernel.org>
Subject: Re: [PATCH RFC 0/3] MAP_POPULATE for device memory
Date: Tue, 8 Mar 2022 12:10:45 +0200	[thread overview]
Message-ID: <YicrpX9K1dSdCK7u@iki.fi> (raw)
In-Reply-To: <5729d03d6a174da6b66d1534ebdb1127@AcuMS.aculab.com>

On Mon, Mar 07, 2022 at 10:11:19PM +0000, David Laight wrote:
> From: Christoph Hellwig
> > Sent: 07 March 2022 15:57
> > 
> > On Mon, Mar 07, 2022 at 03:29:35PM +0200, Jarkko Sakkinen wrote:
> > > So what would you suggest to sort out the issue? I'm happy to go with
> > > ioctl if nothing else is acceptable.
> > 
> > PLenty of drivers treat all mmaps as if MAP_POPULATE was specified,
> > typically by using (io_)remap_pfn_range.  If there any reason to only
> > optionally have the pre-fault semantics for sgx?  If not this should
> > be really simple.  And if we have a real need for it to be optional
> > we'll just need to find a sane way to pass that information to ->mmap.
> 
> Is there any space in vma->vm_flags ?
> 
> That would be better than an extra argument or function.

It's very dense but I'll give a shot for callback route based on Dave's
comments in this thread. I.e. use it as filter inside __mm_populate() and
populate_vma_page_range().

For Enarx, which we are implementing being able to use MAP_POPULATE and get
the full range EAUG'd would be best way to optimize the performance of wasm
JIT (Enarx is a wasm run-time capable of running inside an SGX enclave, AMD
SEV-SNP VM etc.). More so than any predictor (ra_state, madvice etc.) inside
#PF handler, which have been suggested in this thread.

After some research on how we implement user space, I'd rather keep the #PF
handler working on a single page (EAUG a single page) and have either ioctl
or MAP_POPULATE to do the batch fill.

We can still "not trust the user space" i.e. the populate does not have to
guarantee to do the full length since the #PF handler will then fill the
holes. This was one concern in this thread but it is not hard to address.

BR, Jarkko

  reply	other threads:[~2022-03-08 12:51 UTC|newest]

Thread overview: 68+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-06  5:32 [Intel-gfx] [PATCH RFC 0/3] MAP_POPULATE for device memory Jarkko Sakkinen
2022-03-06  5:32 ` Jarkko Sakkinen
2022-03-06  5:32 ` Jarkko Sakkinen
2022-03-06  5:32 ` [Intel-gfx] [PATCH RFC 1/3] mm: Add f_ops->populate() Jarkko Sakkinen
2022-03-06  5:32   ` Jarkko Sakkinen
2022-03-06  5:32   ` Jarkko Sakkinen
2022-03-06 10:01   ` [Intel-gfx] " Greg Kroah-Hartman
2022-03-06 10:01     ` Greg Kroah-Hartman
2022-03-06 10:01     ` Greg Kroah-Hartman
2022-03-06 17:02     ` [Intel-gfx] " Jarkko Sakkinen
2022-03-06 17:02       ` Jarkko Sakkinen
2022-03-06 17:02       ` Jarkko Sakkinen
2022-03-06 17:03       ` [Intel-gfx] " Jarkko Sakkinen
2022-03-06 17:03         ` Jarkko Sakkinen
2022-03-06 17:03         ` Jarkko Sakkinen
2022-03-06 22:43       ` [Intel-gfx] " Matthew Wilcox
2022-03-06 22:43         ` Matthew Wilcox
2022-03-06 22:43         ` Matthew Wilcox
2022-03-07 13:16         ` [Intel-gfx] " Jarkko Sakkinen
2022-03-07 13:16           ` Jarkko Sakkinen
2022-03-07 13:16           ` Jarkko Sakkinen
2022-03-07 13:26           ` [Intel-gfx] " Jarkko Sakkinen
2022-03-07 13:26             ` Jarkko Sakkinen
2022-03-07 13:26             ` Jarkko Sakkinen
2022-03-06  5:32 ` [Intel-gfx] [PATCH RFC 2/3] x86/sgx: Export sgx_encl_page_alloc() Jarkko Sakkinen
2022-03-06  5:32   ` Jarkko Sakkinen
2022-03-06  5:32   ` Jarkko Sakkinen
2022-03-06  5:32 ` [Intel-gfx] [PATCH RFC 3/3] x86/sgx: Implement EAUG population with MAP_POPULATE Jarkko Sakkinen
2022-03-06  5:32   ` Jarkko Sakkinen
2022-03-06  5:32   ` Jarkko Sakkinen
2022-03-06  8:30 ` [Intel-gfx] [PATCH RFC 0/3] MAP_POPULATE for device memory David Laight
2022-03-06  8:30   ` David Laight
2022-03-06  8:30   ` David Laight
2022-03-06 16:52   ` [Intel-gfx] " 'Jarkko Sakkinen'
2022-03-06 16:52     ` 'Jarkko Sakkinen'
2022-03-06 16:52     ` 'Jarkko Sakkinen'
2022-03-06 11:33 ` [Intel-gfx] " Matthew Wilcox
2022-03-06 11:33   ` Matthew Wilcox
2022-03-06 11:33   ` Matthew Wilcox
2022-03-07  7:48   ` [Intel-gfx] " Christoph Hellwig
2022-03-07  7:48     ` Christoph Hellwig
2022-03-07 13:29     ` [Intel-gfx] " Jarkko Sakkinen
2022-03-07 13:29       ` Jarkko Sakkinen
2022-03-07 13:29       ` Jarkko Sakkinen
2022-03-07 15:56       ` [Intel-gfx] " Christoph Hellwig
2022-03-07 15:56         ` Christoph Hellwig
2022-03-07 15:58         ` [Intel-gfx] " Jarkko Sakkinen
2022-03-07 15:58           ` Jarkko Sakkinen
2022-03-07 15:58           ` Jarkko Sakkinen
2022-03-07 22:11         ` [Intel-gfx] " David Laight
2022-03-07 22:11           ` David Laight
2022-03-07 22:11           ` David Laight
2022-03-08 10:10           ` Jarkko Sakkinen [this message]
2022-03-08 10:10             ` Jarkko Sakkinen
2022-03-08 10:10             ` Jarkko Sakkinen
2022-03-07 10:12 ` [Intel-gfx] " David Hildenbrand
2022-03-07 10:12   ` David Hildenbrand
2022-03-07 10:12   ` David Hildenbrand
2022-03-07 14:22   ` [Intel-gfx] " Jarkko Sakkinen
2022-03-07 14:22     ` Jarkko Sakkinen
2022-03-07 14:22     ` Jarkko Sakkinen
2022-03-07 14:33     ` [Intel-gfx] " David Hildenbrand
2022-03-07 14:33       ` David Hildenbrand
2022-03-07 14:33       ` David Hildenbrand
2022-03-07 15:49       ` [Intel-gfx] " Jarkko Sakkinen
2022-03-07 15:49         ` Jarkko Sakkinen
2022-03-07 15:49         ` Jarkko Sakkinen
2022-03-07 14:23 ` [Intel-gfx] ✗ Fi.CI.BUILD: failure for " Patchwork

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=YicrpX9K1dSdCK7u@iki.fi \
    --to=jarkko@kernel.org \
    --cc=David.Laight@aculab.com \
    --cc=G@iki.fi \
    --cc=akpm@linux-foundation.org \
    --cc=alexander.mikhalitsyn@virtuozzo.com \
    --cc=chris@chris-wilson.co.uk \
    --cc=codalist@coda.cs.cmu.edu \
    --cc=daniel.vetter@ffwll.ch \
    --cc=dave.hansen@linux.intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=f.fainelli@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=hch@infradead.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=legion@kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux-sgx@vger.kernel.org \
    --cc=linux-unionfs@vger.kernel.org \
    --cc=matthew.auld@intel.com \
    --cc=mhocko@suse.com \
    --cc=nathaniel@profian.com \
    --cc=reinette.chatre@intel.com \
    --cc=shakeelb@google.com \
    --cc=thomas.hellstrom@linux.intel.com \
    --cc=tsbogend@alpha.franken.de \
    --cc=vvs@virtuozzo.com \
    --cc=willy@infradead.org \
    --cc=zhangyiru3@huawei.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.