From: Dave Hansen Subject: Re: [PATCH v17 18/23] platform/x86: Intel SGX driver Date: Mon, 17 Dec 2018 12:03:17 -0800 Message-ID: <826f6a5a-fdf6-e7e5-d2d8-bcdc57c016fe@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> <16fdd37a-b9cc-1045-1497-2cfff6af176a@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Return-path: In-Reply-To: Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org To: Andy Lutomirski Cc: Jarkko Sakkinen , 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:55 AM, Andy Lutomirski wrote: >> 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 is a bit outside my expertise here, but doesn't > unmap_mapping_range() do exactly what SGX wants? There's no 'struct page' for enclave memory as it stands. That means no page cache, and that means there's no 'struct address_space *mapping' in the first place. Basically, the choice was made a long time ago to have SGX's memory management live outside the core VM. I've waffled back and forth on it, but I do still think this is the right way to do it.