Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp4829305imu; Wed, 19 Dec 2018 00:40:11 -0800 (PST) X-Google-Smtp-Source: AFSGD/WWI7X/o3Qk+cIVfZgAe+sKvEzU/RWGxhiOVOU0rD4AJxvtG67+3E22dTeAyFVUQAWaQpyU X-Received: by 2002:a62:5884:: with SMTP id m126mr19604800pfb.177.1545208811888; Wed, 19 Dec 2018 00:40:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1545208811; cv=none; d=google.com; s=arc-20160816; b=traYkjM425dKd9YbkvNxT8VPD7+FCbh3YbwKHVrtJNMJG3eXDAGv3ABi+Ja1o9S6nf eL99tN9i03y44ox1G1Vy/21jOdxmYP9Ox9PYWDLujMQKZDvOE9lzrNed5mlNrYgejIaJ ylj/29PZGZWCoc2n59XoducFpmJnsYcv9Ftq38GsNS5lcq1BatI+Bl84vWFW0jiL5+1S 0H08FznTiVyhWLWc2kdw/QOzJhHgij5XUBBYFVxvOJw4yhTu3P26hDkFQZYPicOm42Yq s5hYsCZPi5Bed3GtTuMkGnl6XetOAdEZtmJcdbudBsrunUN495MJgUYKXeqvik/S6Iwh HheQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:organization :references:in-reply-to:date:cc:to:from:subject:message-id; bh=xRyz8SAMkN4S5JMvY9tHEEXpG4LVUiykK4w7KTioHbU=; b=t2y3iSbhF4ES31gaa/sU3zJSnRvIHqz3uaNS21vCKNohH9P7Ufsl3hs1XWv4uhyo9Z LLqZqV49svoB0pSuXNp18GS2hGOe2s3aUYrz9N3BU1rVUnD4EfUWszz7h+H/tdb2TuXW OmZvbviK5HU+zmF43c0y6O7sTV3gmkEM/zFQ4sFQweQ0iqxrLm4Bt/os7IjftfqVjkKD pixudJWGMoiKzDu5aN7D9R/fm4yLFb5RpckGGh8PT3c9dEH0Ik2vO/knEl5ylIAatam/ /QN/xvIPqJKye27TyMWlzfSj9OmoCiWy+hn1YXfjkVk19uKjpq8agQWQXN7c2VRkR/R9 mc6A== 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 b1si15696370plc.332.2018.12.19.00.39.56; Wed, 19 Dec 2018 00:40:11 -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 S1728046AbeLSH6i (ORCPT + 99 others); Wed, 19 Dec 2018 02:58:38 -0500 Received: from mga12.intel.com ([192.55.52.136]:49100 "EHLO mga12.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726631AbeLSH6i (ORCPT ); Wed, 19 Dec 2018 02:58:38 -0500 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 18 Dec 2018 23:58:37 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,371,1539673200"; d="h'?scan'208";a="119602633" Received: from quwen-mobl.ccr.corp.intel.com ([10.249.254.215]) by FMSMGA003.fm.intel.com with ESMTP; 18 Dec 2018 23:58:29 -0800 Message-ID: <7706b2aa71312e1f0009958bcab24e1e9d8d1237.camel@linux.intel.com> Subject: x86/sgx: uapi change proposal From: Jarkko Sakkinen To: Andy Lutomirski , Thomas Gleixner , Ingo Molnar , Borislav Petkov , x86@kernel.org, Dave Hansen , Peter Zijlstra , sean.j.christopherson@intel.com Cc: "H. Peter Anvin" , linux-kernel@vger.kernel.org, linux-sgx@vger.kernel.org, Andy Lutomirski , Josh Triplett , Haitao Huang , Jethro Beekman , "Dr . Greg Wettstein" Date: Wed, 19 Dec 2018 09:58:26 +0200 In-Reply-To: <20181214215729.4221-1-sean.j.christopherson@intel.com> References: <20181214215729.4221-1-sean.j.christopherson@intel.com> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo Content-Type: multipart/mixed; boundary="=-Kw50GBTEA/+nFrI57M4Y" User-Agent: Evolution 3.30.1-1build1 Mime-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --=-Kw50GBTEA/+nFrI57M4Y Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit I have pretty much figured out how to change the driver implementation from VMA based to file based. Most of the code in the driver can be reused with not that enormous changes. I think it is a clue that the architecture is somewhat right because changing the driver this radically does not seem to require any changes to the core. Using anon inode is the right choice because it is more robust interface to be able to create multiple enclaves. The only remaining open that I have when it comes to implementing this is the backing storage. From API perspective the most robust choice would be to revert to use shmem file. It would be easy then to create a complete construction flow without any dependencies to mm_struct. I do recognize the issue with accounting but to which process the backing storage should be accounted anyway in this new paradigm. I've attached the new uapi header to this email that I'm going forward with. /Jarkko --=-Kw50GBTEA/+nFrI57M4Y Content-Disposition: attachment; filename="sgx.h" Content-Type: text/x-chdr; name="sgx.h"; charset="UTF-8" Content-Transfer-Encoding: base64 LyogU1BEWC1MaWNlbnNlLUlkZW50aWZpZXI6IChHUEwtMi4wIE9SIEJTRC0zLUNsYXVzZSkgKi8K LyoqCiAqIENvcHlyaWdodChjKSAyMDE2LTE4IEludGVsIENvcnBvcm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