Return-Path: Received: from mga01.intel.com ([192.55.52.88]:10758 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726435AbeLKSbC (ORCPT ); Tue, 11 Dec 2018 13:31:02 -0500 Date: Tue, 11 Dec 2018 10:31:01 -0800 From: Sean Christopherson To: Dave Hansen Cc: Josh Triplett , Pavel Machek , Jarkko Sakkinen , x86@kernel.org, platform-driver-x86@vger.kernel.org, nhorman@redhat.com, npmccallum@redhat.com, Alexei Starovoitov , Andi Kleen , Andrew Morton , Andy Lutomirski , Borislav Petkov , "David S. Miller" , David Woodhouse , Greg Kroah-Hartman , "H. Peter Anvin" , Ingo Molnar , "open list:INTEL SGX" , Janakarajan Natarajan , "Kirill A. Shutemov" , Konrad Rzeszutek Wilk , "open list:KERNEL VIRTUAL MACHINE FOR X86 (KVM/x86)" , Len Brown , Linus Walleij , "open list:CRYPTO API" , "open list:DOCUMENTATION" , open list , "open list:SPARSE CHECKER" , Mauro Carvalho Chehab , Peter Zijlstra , "Rafael J. Wysocki" , Randy Dunlap , Ricardo Neri , Thomas Gleixner , Tom Lendacky , Vikas Shivappa Subject: Re: [PATCH v11 00/13] Intel SGX1 support Message-ID: <20181211183101.GE14731@linux.intel.com> References: <20180608171216.26521-1-jarkko.sakkinen@linux.intel.com> <20180612105011.GA26931@amd> <20180619145943.GC8034@linux.intel.com> <20180619200414.GA3143@amd> <20180619214833.GA5873@localhost> <20181209200600.GA11608@amd> <20181210074717.GA9880@localhost> <20181210082704.GA14594@amd> <20181210231159.GA10718@localhost> <12301623-0a63-10ac-1d5e-828569a953e5@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <12301623-0a63-10ac-1d5e-828569a953e5@intel.com> Sender: linux-crypto-owner@vger.kernel.org List-ID: On Tue, Dec 11, 2018 at 10:10:38AM -0800, Dave Hansen wrote: > On 12/10/18 3:12 PM, Josh Triplett wrote: > >> Or maybe even python/shell scripts? It looked to me like virtual > >> memory will be "interesting" for enclaves. > > Memory management doesn't seem that hard to deal with. > > The problems are: > > 1. SGX enclave memory (EPC) is statically allocated at boot and can't > grow or shrink > 2. EPC is much smaller than regular RAM > 3. The core VM has no comprehension of EPC use, thus can not help > with its algorithms, like the LRU > 4. The SGX driver implements its own VM which is substantially simpler > than the core VM, but less feature-rich, fast, or scalable I'd also add: 5. Swapping EPC pages can only be done through SGX specific ISA that has strict concurrency requirements and enforces TLB flushing. 6. There are specialized types of EPC pages that have different swapping requirements than regular EPC pages. 7. EPC pages that are exposed to a KVM guest have yet another set of swapping requirements. In other words, extending the core VM to SGX EPC is painfully difficult.