Subject: Re: [PATCH v13 09/13] x86/sgx: Enclave Page Cache (EPC) memory manager To: Sean Christopherson References: <20180827185507.17087-1-jarkko.sakkinen@linux.intel.com> <20180827185507.17087-10-jarkko.sakkinen@linux.intel.com> <7c5df14e-3028-46b3-fe93-aa6ba8352317@intel.com> <20180828083540.GH15508@linux.intel.com> <132d309d-77e2-52ed-7251-abb2c80cdf49@intel.com> <20180828212244.GA29488@linux.intel.com> CC: Jarkko Sakkinen , , , , , , Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , Suresh Siddha , Serge Ayoun , "open list:X86 ARCHITECTURE (32-BIT AND 64-BIT)" From: Dave Hansen Message-ID: <81adf7e1-b9c2-e906-95a3-c6e08cbcc52a@intel.com> Date: Tue, 28 Aug 2018 14:26:36 -0700 In-Reply-To: <20180828212244.GA29488@linux.intel.com> Content-Type: text/plain; charset="utf-8" Return-Path: dave.hansen@intel.com MIME-Version: 1.0 List-ID: On 08/28/2018 02:22 PM, Sean Christopherson wrote: > On Tue, Aug 28, 2018 at 07:07:33AM -0700, Dave Hansen wrote: >> On 08/28/2018 01:35 AM, Jarkko Sakkinen wrote: >>> On Mon, Aug 27, 2018 at 02:15:34PM -0700, Dave Hansen wrote: >>>> On 08/27/2018 11:53 AM, Jarkko Sakkinen wrote: >>>>> +struct sgx_epc_page_ops { >>>>> + bool (*get)(struct sgx_epc_page *epc_page); >>>>> + void (*put)(struct sgx_epc_page *epc_page); >>>>> + bool (*reclaim)(struct sgx_epc_page *epc_page); >>>>> + void (*block)(struct sgx_epc_page *epc_page); >>>>> + void (*write)(struct sgx_epc_page *epc_page); >>>>> +}; >>>> Why do we need a fancy, slow (retpoline'd) set of function pointers when >>>> we only have one user of these (the SGX driver)? >>> KVM has its own implementation for these operations. >> >> That belongs in the changelog. >> >> Also, where is the implementation? How can we assess this code that was >> built to create an abstraction without both of the users? > > I can provide an early preview of the KVM reclaim code, but honestly > I think that would do more harm than good. The VMX architecture for > EPC reclaim is complex, even for SGX standards. Opening that can of > worms would likely derail this discussion. That being said, this > abstraction isn't exactly what KVM will need, but it's pretty close > and gives us something to build on. Please remove the abstraction code. We don't introduce infrastructure which no one will use.