Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp4660839ybi; Mon, 3 Jun 2019 15:02:18 -0700 (PDT) X-Google-Smtp-Source: APXvYqwhsmO1NoMPq9Jok2VoK/1mOKmjawaKvqVxDYaAifMYPoTu0rL8oognS/JeT/6jCmx7KXm0 X-Received: by 2002:a17:90a:ac0e:: with SMTP id o14mr20628032pjq.142.1559599338645; Mon, 03 Jun 2019 15:02:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559599338; cv=none; d=google.com; s=arc-20160816; b=tErUOWJBmmkb3EAbH1yjITMzMhLOp81c0N2ejRq4IyRQ3UTdjSHPZBX1oxOSBHgmHT 76bW/rOxiDu61AvExlL0XWmAOjcJTY+ymY29QVnWgjQ/xCxKPiSI1Ew6FVVLum39tj2g Lzl7rYJ23twWj75OkNj7Oxkrr9sknIM0R0FRbeBljyM8atrt5Qian7gSImwOn/XTrvwV TXnFLcwjwZAxIV9+cJEHGsGsRmXRFQ7j0eHeE/tAPOTzNb/decfX4gdaxKIrSKPRQXkT MHSo0l6tDRz2vw7Hd+19R1pDKHKwWgx0hRCHTAn1OvaQp8/e6BdCwzifUSIMglF+xrnU a3Kg== 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=FPQx+Ws31NxFJxzgs5pv3+WjmBCZ71bsr9aDXtMTCeA=; b=M9A8pOz9VJ87LcfkWpIhE5COc2khPP1+j1CkMA4+4cy5U2JCNDbqtpnJl1abUA5hTN KHHFfTgG3hXVZSNQoW4Np8nppdDh1xIQjPt46EGWKKTmf2N7H0Bfxn5lJXUiiVaXTuHj WeDHh9bABSaRl76vwER/KfrU3SEaJ5/MnZEyBkofK2T5qzNFxg4X9s7J3MZocudE5/Py SthsEyonJqOuwOJ6YZkFp5JrkWZTMd8PULtms38cK3yCG0vteguomnjyZv7aUWvVj8tK zVTduHt6Xa6S/cvcrUnp6EnMuunYKJ+EML5tGjyzbz/shVTonqjaCwIGCZRRiQyDXcY7 6XIg== 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 j22si23166937pfe.43.2019.06.03.15.02.02; Mon, 03 Jun 2019 15:02:18 -0700 (PDT) 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 S1726379AbfFCV7k (ORCPT + 99 others); Mon, 3 Jun 2019 17:59:40 -0400 Received: from mga11.intel.com ([192.55.52.93]:65178 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726572AbfFCV7j (ORCPT ); Mon, 3 Jun 2019 17:59:39 -0400 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 fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 03 Jun 2019 13:37:12 -0700 X-ExtLoop1: 1 Received: from sjchrist-coffee.jf.intel.com (HELO linux.intel.com) ([10.54.74.36]) by orsmga008.jf.intel.com with ESMTP; 03 Jun 2019 13:37:12 -0700 Date: Mon, 3 Jun 2019 13:37:12 -0700 From: Sean Christopherson To: Dave Hansen Cc: Jarkko Sakkinen , Andy Lutomirski , Cedric Xing , Stephen Smalley , James Morris , "Serge E . Hallyn" , LSM List , Paul Moore , Eric Paris , selinux@vger.kernel.org, Jethro Beekman , Thomas Gleixner , Linus Torvalds , LKML , X86 ML , linux-sgx@vger.kernel.org, Andrew Morton , nhorman@redhat.com, npmccallum@redhat.com, Serge Ayoun , Shay Katz-zamir , Haitao Huang , Andy Shevchenko , Kai Svahn , Borislav Petkov , Josh Triplett , Kai Huang , David Rientjes , William Roberts , Philip Tricca Subject: Re: [RFC PATCH 3/9] x86/sgx: Allow userspace to add multiple pages in single ioctl() Message-ID: <20190603203712.GI13384@linux.intel.com> References: <20190531233159.30992-1-sean.j.christopherson@intel.com> <20190531233159.30992-4-sean.j.christopherson@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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 Mon, Jun 03, 2019 at 01:14:45PM -0700, Dave Hansen wrote: > On 5/31/19 4:31 PM, Sean Christopherson wrote: > > -struct sgx_enclave_add_page { > > +struct sgx_enclave_add_pages { > > __u64 addr; > > __u64 src; > > __u64 secinfo; > > + __u32 nr_pages; > > __u16 mrmask; > > } __attribute__((__packed__)); > > IMNHO this follows a user interface anti-pattern: exposing page sizes > where not strictly required. > > Think of how this would look to an application if page size was > variable. With this interface, they always need to scale their > operations by page size instead of just aligning it. I briefly considered taking size in bytes, but I took a shortcut because EPC pages are architecturally defined to be 4k sized and aligned. That being said, I don't necessarily disagree, especially if nr_pages isn't squeezed into a u32. > BTW, why is nr_pages a u32? Do we never envision a case where you can > add more than 4TB of memory to an enclave? ;) Heh, fair enough. IIRC, a while back someone posted about having problems building a 512gb enclave in a 92mb EPC... How about this for the intermediate patch: struct sgx_enclave_add_region { __u64 addr; __u64 src; __u64 size; __u64 secinfo; __u16 mrmask; __u16 reserved16; __u32 reserved; } and with the flags field: struct sgx_enclave_add_region { __u64 addr; __u64 src; __u64 size; __u64 secinfo; __u16 mrmask; __u16 flags; __u32 reserved; }