RE: [RFC PATCH 3/9] x86/sgx: Allow userspace to add multiple pages in single ioctl()

2019-06-04 Thread Xing, Cedric
> From: Andy Lutomirski [mailto:l...@kernel.org] > Sent: Tuesday, June 04, 2019 1:18 PM > > On Mon, Jun 3, 2019 at 1:39 PM Sean Christopherson > wrote: > > > > On Mon, Jun 03, 2019 at 01:08:04PM -0700, Sean Christopherson wrote: > > > On Sun, Jun 02, 2019 at 11:26:09PM -0700, Xing, Cedric wrote:

Re: [RFC PATCH 3/9] x86/sgx: Allow userspace to add multiple pages in single ioctl()

2019-06-04 Thread Andy Lutomirski
On Mon, Jun 3, 2019 at 1:39 PM Sean Christopherson wrote: > > On Mon, Jun 03, 2019 at 01:08:04PM -0700, Sean Christopherson wrote: > > On Sun, Jun 02, 2019 at 11:26:09PM -0700, Xing, Cedric wrote: > > > > From: Christopherson, Sean J > > > > Sent: Friday, May 31, 2019 4:32 PM > > > > > > > > +/**

Re: [RFC PATCH 3/9] x86/sgx: Allow userspace to add multiple pages in single ioctl()

2019-06-04 Thread Jarkko Sakkinen
On Fri, May 31, 2019 at 04:31:53PM -0700, Sean Christopherson wrote: > ...to improve performance when building enclaves by reducing the number > of user<->system transitions. Rather than provide arbitrary batching, > e.g. with per-page SECINFO and mrmask, take advantage of the fact that > any

Re: [RFC PATCH 3/9] x86/sgx: Allow userspace to add multiple pages in single ioctl()

2019-06-03 Thread Sean Christopherson
On Mon, Jun 03, 2019 at 04:48:47PM -0700, Xing, Cedric wrote: > > How about this for the intermediate patch: > > > > struct sgx_enclave_add_region { > > __u64 addr; > > __u64 src; > > __u64 size; > > __u64 secinfo; > > __u16

Re: [RFC PATCH 3/9] x86/sgx: Allow userspace to add multiple pages in single ioctl()

2019-06-03 Thread Sean Christopherson
On Mon, Jun 03, 2019 at 04:45:45PM -0700, Xing, Cedric wrote: > > From: Christopherson, Sean J > > Sent: Monday, June 03, 2019 1:40 PM > > > > On Mon, Jun 03, 2019 at 01:08:04PM -0700, Sean Christopherson wrote: > > > On Sun, Jun 02, 2019 at 11:26:09PM -0700, Xing, Cedric wrote: > > > > > From:

RE: [RFC PATCH 3/9] x86/sgx: Allow userspace to add multiple pages in single ioctl()

2019-06-03 Thread Xing, Cedric
dy Shevchenko > ; Svahn, Kai ; > Borislav Petkov ; Josh Triplett ; > Huang, Kai ; David Rientjes ; > Roberts, William C ; Tricca, Philip B > > Subject: Re: [RFC PATCH 3/9] x86/sgx: Allow userspace to add multiple > pages in single ioctl() > > On Mon, Jun 03, 2019 at 01:14

RE: [RFC PATCH 3/9] x86/sgx: Allow userspace to add multiple pages in single ioctl()

2019-06-03 Thread Xing, Cedric
> From: Christopherson, Sean J > Sent: Monday, June 03, 2019 1:40 PM > > On Mon, Jun 03, 2019 at 01:08:04PM -0700, Sean Christopherson wrote: > > On Sun, Jun 02, 2019 at 11:26:09PM -0700, Xing, Cedric wrote: > > > > From: Christopherson, Sean J > > > > Sent: Friday, May 31, 2019 4:32 PM > > > > >

Re: [RFC PATCH 3/9] x86/sgx: Allow userspace to add multiple pages in single ioctl()

2019-06-03 Thread Dave Hansen
On 6/3/19 1:37 PM, Sean Christopherson wrote: > Heh, fair enough. IIRC, a while back someone posted about having problems > building a 512gb enclave in a 92mb EPC... > > How about this for the intermediate patch: > > struct sgx_enclave_add_region { > __u64 addr; >

Re: [RFC PATCH 3/9] x86/sgx: Allow userspace to add multiple pages in single ioctl()

2019-06-03 Thread Sean Christopherson
On Mon, Jun 03, 2019 at 01:08:04PM -0700, Sean Christopherson wrote: > On Sun, Jun 02, 2019 at 11:26:09PM -0700, Xing, Cedric wrote: > > > From: Christopherson, Sean J > > > Sent: Friday, May 31, 2019 4:32 PM > > > > > > +/** > > > + * sgx_ioc_enclave_add_pages - handler for

Re: [RFC PATCH 3/9] x86/sgx: Allow userspace to add multiple pages in single ioctl()

2019-06-03 Thread Sean Christopherson
On Mon, Jun 03, 2019 at 01:14:45PM -0700, Dave Hansen wrote: > On 5/31/19 4:31 PM, Sean Christopherson wrote: > > -struct sgx_enclave_add_page { > > +struct sgx_enclave_add_pages { > > __u64 addr; > > __u64 src; > > __u64 secinfo; > > + __u32 nr_pages; > > __u16 mrmask;

Re: [RFC PATCH 3/9] x86/sgx: Allow userspace to add multiple pages in single ioctl()

2019-06-03 Thread Dave Hansen
On 5/31/19 4:31 PM, Sean Christopherson wrote: > -struct sgx_enclave_add_page { > +struct sgx_enclave_add_pages { > __u64 addr; > __u64 src; > __u64 secinfo; > + __u32 nr_pages; > __u16 mrmask; > } __attribute__((__packed__)); IMNHO this follows a user

Re: [RFC PATCH 3/9] x86/sgx: Allow userspace to add multiple pages in single ioctl()

2019-06-03 Thread Sean Christopherson
On Sun, Jun 02, 2019 at 11:26:09PM -0700, Xing, Cedric wrote: > > From: Christopherson, Sean J > > Sent: Friday, May 31, 2019 4:32 PM > > > > +/** > > + * sgx_ioc_enclave_add_pages - handler for %SGX_IOC_ENCLAVE_ADD_PAGES > > + * > > + * @filep: open file to /dev/sgx > > + * @cmd: the command

RE: [RFC PATCH 3/9] x86/sgx: Allow userspace to add multiple pages in single ioctl()

2019-06-03 Thread Xing, Cedric
> From: Christopherson, Sean J > Sent: Friday, May 31, 2019 4:32 PM > > +/** > + * sgx_ioc_enclave_add_pages - handler for %SGX_IOC_ENCLAVE_ADD_PAGES > + * > + * @filep: open file to /dev/sgx > + * @cmd: the command value > + * @arg: pointer to an _enclave_add_page instance > + * > + *

[RFC PATCH 3/9] x86/sgx: Allow userspace to add multiple pages in single ioctl()

2019-05-31 Thread Sean Christopherson
...to improve performance when building enclaves by reducing the number of user<->system transitions. Rather than provide arbitrary batching, e.g. with per-page SECINFO and mrmask, take advantage of the fact that any sane enclave will have large swaths of pages with identical properties, e.g.