Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp978305imu; Tue, 11 Dec 2018 10:32:14 -0800 (PST) X-Google-Smtp-Source: AFSGD/Vh0gBA+weWzgsIUUAL9Hejx5aeYlW7JDpwPh33gQDVzsVtFcTcOP0fN5VLbRslmc4p2RQR X-Received: by 2002:a62:8dd9:: with SMTP id p86mr17080612pfk.143.1544553134104; Tue, 11 Dec 2018 10:32:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544553134; cv=none; d=google.com; s=arc-20160816; b=qffpm8SvcvxTlm8beDhEU04iG8Lt0KwdDMEe5NKbb5M56aTvdAxqYJMubCapB6K0lV KL+MBvPBovftY3xuTB2XvpINoz8kWd7PgPCyIVUfllOmmaJJV9v397XkKYGOtV1UL3Mj INOWYYNj+LXpNHPb2fqjZiaieV0UPHe9mgXBLiAQ8dYx6azVbr5qv2wU6dmftMSiOpfo U/yWCQNJ9XwxC4/1EvLHqIL0D+6QhQ03VDyUsefkTzKx9688eLHpHwWkl/FY+ykSqPZu EDPgsOw7FFwBDAdKzNTPGwJqXAE+kCMaCn7ZzX17FE/fFrskShOuWXy4H28sbdNy09BV 8Oyw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=T7av9ZMa4mQS77KpbSLsPEzsnDyEymE0ZB5n7MsNqws=; b=adJRImyz+8Bql2fNr+QzYwzN8QHZnjY68weMLwwIASd6P73H/QFuzVCWWM9kLbDOMu P/6Kw+hAAb8VgsGMDPHheDQ362bEwcMT6Sim10BDtONw6wV1V8fLxNSzQNW6MRpY8nh7 PfzxchWzNiO3fgeCFmBdOswm4Vsat8QgePcLj2wv7Au7xxNlSc7QA4OCauB4zGO1cskb LWW6T9UUjqGDVwMdkCpXWzIVt48gzT37FONmqBbwi7oHCvKiNF2JMR+Oc9b3FahJh0u3 TaFpXEoq1TNWJgiwTPETZZc084Ov/G1+a8NaJOKLdXTcGg5POI1+E75cKBNWozl9KdB9 /v9Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h3si12928787pgl.468.2018.12.11.10.31.59; Tue, 11 Dec 2018 10:32:14 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727178AbeLKSbF (ORCPT + 99 others); Tue, 11 Dec 2018 13:31:05 -0500 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 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 11 Dec 2018 10:31:01 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,343,1539673200"; d="scan'208";a="100721643" Received: from sjchrist-coffee.jf.intel.com (HELO linux.intel.com) ([10.54.74.154]) by orsmga008.jf.intel.com with ESMTP; 11 Dec 2018 10:31:01 -0800 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> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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.