Received: by 2002:a25:23cc:0:0:0:0:0 with SMTP id j195csp889399ybj; Thu, 7 May 2020 09:54:23 -0700 (PDT) X-Google-Smtp-Source: APiQypKbJkiy3vjM3qMRKtDU7nkD9KwCZfd5t0Fmgljw0vJZ9AF38eQNpMH0uE/QkmOp2btyXCu3 X-Received: by 2002:a05:6402:1008:: with SMTP id c8mr12257118edu.242.1588870463562; Thu, 07 May 2020 09:54:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588870463; cv=none; d=google.com; s=arc-20160816; b=g1r0JW57AOYu3Z7BXEpLQzM6QNN8dV4Czo8R8SAOVE/5v7EncRMo8BRr2pMb7JuMki 9YL5ib6/cOiC2aZwZUJIqvEanDWA0H2FjXoOFsfNgDFyJOw4UJXvGntYXj718vMPcF4d KlG9ePuAG+fXT+MLnxAb3lQr2m9T/b2AzrLv1Qae9OjCbGfCw0hqOK8Iy7k5W3NNewya GD5gPXXZVTd5+pDePjAHDsI9djjzszXNqm/19gXiJ65sNDDRCH8Nhbrt6T3cDEwt7rTg ilOzALC3FPItrEPOrRp5zEV0SlC7U6xpTQLBsJ5msn4D5GO+iqMfqThIe1JNLNooXE5j HrBA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=J3eMS0q6Ky8AS+NYfRImuhd7GvbGAICUz7ULX5bxR6k=; b=yd/RZyMc9Kb/EY1s1vXrzKzAlQdRWF7vOTWvsZdWhWvuSXOoX347jeLzirw4y5TdxF T9yzwx0e+ZmiIKBWwbwG++4eNOFzFFfS7ob667DoN7U8C2uIW1VtCnq0HWVHGOfdnVXp ZeN8zULK/BY56Si8KzbRhuyuN0GItupv6zIN837mw7malEkwvgTFYerhzA58vnUxvnH3 +CoFI//bHPmfR0x5ou6sYQPgsJfHrvZDOxNl8sFyAhvykP/F7+9OIctMxhK2byPDNRy5 8OSlQHrk9v/gPeWTVtt0tczxRvgYv1OlVxaOGqdkRKMDlFNumd6xMublHAeABFP0dF1g 4JKw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="L6kBF/1Y"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l3si3458592edr.46.2020.05.07.09.53.55; Thu, 07 May 2020 09:54:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="L6kBF/1Y"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727783AbgEGQtc (ORCPT + 99 others); Thu, 7 May 2020 12:49:32 -0400 Received: from us-smtp-2.mimecast.com ([207.211.31.81]:32469 "EHLO us-smtp-delivery-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726222AbgEGQta (ORCPT ); Thu, 7 May 2020 12:49:30 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1588870169; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=J3eMS0q6Ky8AS+NYfRImuhd7GvbGAICUz7ULX5bxR6k=; b=L6kBF/1YK0K1N6Hr51sU6l00DXLKvd2HV06qiSH8XI5NVmU5OXHYV5y2g2jpm9e2zWBAOt qS/KKfe8WGay51qGO+tRyZgwVUHZtN+DNLh81/6B24ac4FxAm5csAwQJL+IZxF2iQWSp5w jJF5jcOOXr6g28Vvylcg9ht3eQEeaF4= Received: from mail-il1-f198.google.com (mail-il1-f198.google.com [209.85.166.198]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-433-bwJfyro3OVKct_D3kxM1Zg-1; Thu, 07 May 2020 12:49:26 -0400 X-MC-Unique: bwJfyro3OVKct_D3kxM1Zg-1 Received: by mail-il1-f198.google.com with SMTP id i2so6578707ile.15 for ; Thu, 07 May 2020 09:49:26 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=J3eMS0q6Ky8AS+NYfRImuhd7GvbGAICUz7ULX5bxR6k=; b=bPOYFdEA4YMaoL0YgPijK9EgwA4Mc7B9OynyE7Pw5mhb+DThnBs5hfhnXs9pcRw6B5 6rtOztYnCshgrEjzrV5ger/FfcLJwjuM1tBJkSCK7whQhBr4HsniWbpsMuukUrkZ3iIi M1JG5PItyskX8jwKxosCsFDKiWfkEGhIYSMXHM047PZK0Fc1p3k1oU+XDNpRnz9GLXMm 8tZbJFeFE8Yds6QEM+dBmhMt+FZJ51GkT5O8bpsB1ZB1OpPIwviBku0mVMavluoCRxZN HsA5qSjnKhge1QM4Fc3tKwlifA9qDkSkc5I3Bfe7o08YX9DXJPcucnBv95dsChnllYp5 sZyg== X-Gm-Message-State: AGi0PubIE9IK0Fkkhthy/zOrF1g6RxwvbMdibjx4+o/TeAZG5U9wZYHG r1N0/NRrBueHTT2tTMEQY2DD5NbEDQPGcv4Bdmwaqafd64juZt+i00tueJi+3hDN8czckduM1or QzNrVqFTZqOF5nNl43d3n6IkSezi/3nNTSvqZAQWZ X-Received: by 2002:a92:84c1:: with SMTP id y62mr15525295ilk.116.1588870165911; Thu, 07 May 2020 09:49:25 -0700 (PDT) X-Received: by 2002:a92:84c1:: with SMTP id y62mr15525255ilk.116.1588870165638; Thu, 07 May 2020 09:49:25 -0700 (PDT) MIME-Version: 1.0 References: <20200421215316.56503-1-jarkko.sakkinen@linux.intel.com> <20200506221422.GK3329@linux.intel.com> In-Reply-To: From: Nathaniel McCallum Date: Thu, 7 May 2020 12:49:15 -0400 Message-ID: Subject: Re: [PATCH v29 00/20] Intel SGX foundations To: Haitao Huang Cc: Sean Christopherson , Jarkko Sakkinen , linux-kernel@vger.kernel.org, x86@kernel.org, linux-sgx@vger.kernel.org, akpm@linux-foundation.org, dave.hansen@intel.com, Neil Horman , "Huang, Haitao" , andriy.shevchenko@linux.intel.com, tglx@linutronix.de, "Svahn, Kai" , bp@alien8.de, Josh Triplett , luto@kernel.org, kai.huang@intel.com, David Rientjes , "Xing, Cedric" , Patrick Uiterwijk Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, May 7, 2020 at 1:03 AM Haitao Huang wrote: > > On Wed, 06 May 2020 17:14:22 -0500, Sean Christopherson > wrote: > > > On Wed, May 06, 2020 at 05:42:42PM -0400, Nathaniel McCallum wrote: > >> Tested on Enarx. This requires a patch[0] for v29 support. > >> > >> Tested-by: Nathaniel McCallum > >> > >> However, we did uncover a small usability issue. See below. > >> > >> [0]: > >> https://github.com/enarx/enarx/pull/507/commits/80da2352aba46aa7bc6b4d1fccf20fe1bda58662 > > > > ... > > > >> > * Disallow mmap(PROT_NONE) from /dev/sgx. Any mapping (e.g. > >> anonymous) can > >> > be used to reserve the address range. Now /dev/sgx supports only > >> opaque > >> > mappings to the (initialized) enclave data. > >> > >> The statement "Any mapping..." isn't actually true. > >> > >> Enarx creates a large enclave (currently 64GiB). This worked when we > >> created a file-backed mapping on /dev/sgx/enclave. However, switching > >> to an anonymous mapping fails with ENOMEM. We suspect this is because > >> the kernel attempts to allocate all the pages and zero them but there > >> is insufficient RAM available. We currently work around this by > >> creating a shared mapping on /dev/zero. > > > > Hmm, the kernel shouldn't actually allocate physical pages unless they're > > written. I'll see if I can reproduce. > > > > For larger size mmap, I think it requires enabling vm overcommit mode 1: > echo 1 | sudo tee /proc/sys/vm/overcommit_memory Which means the default experience isn't good.