From: Dave Hansen Subject: Re: [PATCH v17 18/23] platform/x86: Intel SGX driver Date: Mon, 17 Dec 2018 11:53:28 -0800 Message-ID: <16fdd37a-b9cc-1045-1497-2cfff6af176a@intel.com> References: <20181116010412.23967-1-jarkko.sakkinen@linux.intel.com> <20181116010412.23967-19-jarkko.sakkinen@linux.intel.com> <7d5cde02-4649-546b-0f03-2d6414bb80b5@intel.com> <20181217180102.GA12560@linux.intel.com> <20181217183613.GD12491@linux.intel.com> <20181217184333.GA26920@linux.intel.com> <20181217194913.GD29785@linux.intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Return-path: In-Reply-To: <20181217194913.GD29785@linux.intel.com> Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org To: Jarkko Sakkinen Cc: Andy Lutomirski , Sean Christopherson , X86 ML , Platform Driver , linux-sgx@vger.kernel.org, nhorman@redhat.com, npmccallum@redhat.com, "Ayoun, Serge" , shay.katz-zamir@intel.com, Haitao Huang , Andy Shevchenko , Thomas Gleixner , "Svahn, Kai" , mark.shanahan@intel.com, Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , Darren Hart , Andy Shevchenko , "open list:X86 ARCHITECTURE (32-BIT AND 64-BIT)" List-Id: platform-driver-x86.vger.kernel.org On 12/17/18 11:49 AM, Jarkko Sakkinen wrote: >> Yeah, the code is built to have one VMA and only one VMA per enclave. >> You need to go over the origin of this restriction and what enforces this. > It is before ECREATE but after that you can split it with mprotect(). > > Lets take an example. I'm not sure how we would acquire mm efficiently > in sgx_encl_page_reclaim() otherwise than having it as a field in encl. You're effectively rebuilding reverse-mapping infrastructure here. It's a frequent thing for the core VM to need to go from 'struct page' back to the page tables mapping it. For that we go (logically) page->{anon_vma,mapping}->vma->vm_mm->pagetable. This, on the other hand, is trying to do page->encl->mm->pagetable. You could very easily have a VMA analog in there instead of jumping straight to the mm.