Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp1128092ybh; Wed, 18 Mar 2020 15:40:41 -0700 (PDT) X-Google-Smtp-Source: ADFU+vsIRrSsTuICFt12IpvV3aijxkoxs/QY/0wdtCZgeiXhKUSJ+LqaQgiTWsF7NjyxnHAJ1QYa X-Received: by 2002:a9d:5e9:: with SMTP id 96mr5841772otd.307.1584571241288; Wed, 18 Mar 2020 15:40:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584571241; cv=none; d=google.com; s=arc-20160816; b=ZjiVRuqYY1N82wHmo6hm5etfmaZRJa3zH7CHoLDx31gRvQUH7MH648A5s885748IIa eTxbwWo1U66SYzLue6xoOg4dEYnjIg5+egqx8Od0oNd5b5ktowvhDNCn8UqyqMzgRR/Q ugGqeF1fMJyXYDBHkzoaslp1lwFbaJqdsUkHGvjouMpgyaWm5IgI5cSDejuqtMztJyY5 A+OALnjcgE5EHS4PGzH3vLAvCNO8cVhhLM71lxPynuM9WZKixkHOpg/JDSlk8qkRx5O3 thuleYPEWe/mZaOXjqf0vi7xwHOL3xflajNpza9Y472AwShES+/4v4DOCOXaTUCbtemI oSAg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:organization:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:ironport-sdr:ironport-sdr; bh=gpbwm4hoCRDLGToVollFuS/DviHTfdwgTZ7dhdjelsA=; b=c4rOMzvszNoLze/oKPw6aQ6WqSCglEFtIjAWZ4T43bb7lRMx/u+nHcusy6gHYAY1FS qCuqiz3ql4Uf37LBuJzA6X2RXNmzPkGU5enbwPZdBT1TAL23rpiolnKBiZoLTk8bGJC4 6a5wIjt4PB+oUoXN/RwwAm4I3Qc8wqP8zxU5PZm8Wz0BWDIBoOkiJmF9YB3khiQeFIBI T/xxOpOaaW+8ZVmrLT/MUQftSC1pfuqE33dhdH24FXAVFOdhwuCp3B6tJB8p6UB2Zc0M iyR5IHYP9hfrS3DAkojWjbDWQ4noycpIo9sZGLAWYh5sxv3M8fRx/jpu2FpHH7h8MOdO WwcA== 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 q26si186671otn.296.2020.03.18.15.40.28; Wed, 18 Mar 2020 15:40:41 -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 S1727317AbgCRWjw (ORCPT + 99 others); Wed, 18 Mar 2020 18:39:52 -0400 Received: from mga06.intel.com ([134.134.136.31]:41336 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726777AbgCRWju (ORCPT ); Wed, 18 Mar 2020 18:39:50 -0400 IronPort-SDR: 16vwUxItd219oym/u9uvTyHEr+eEG2ECLFxyN89lVOd0dthG9sPvLDxLr0OQC2uUIuQSHIwH6y ndoE5swUfJPQ== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Mar 2020 15:39:49 -0700 IronPort-SDR: OIZt4/Bulq5VM9kt6gz93SuZccv60eWXlc2inejhm2wUCfLxduTFCDDxrd8BuexZGUz7Mwo9Py fiNQdjwwpBsw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,569,1574150400"; d="scan'208";a="355843989" Received: from mbeldzik-mobl.ger.corp.intel.com (HELO localhost) ([10.252.55.127]) by fmsmga001.fm.intel.com with ESMTP; 18 Mar 2020 15:39:39 -0700 Date: Thu, 19 Mar 2020 00:39:37 +0200 From: Jarkko Sakkinen To: Sean Christopherson Cc: Nathaniel McCallum , 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 , cedric.xing@intel.com, Patrick Uiterwijk , Andy Lutomirski , Jethro Beekman , Connor Kuehl , Harald Hoyer , Lily Sturmann Subject: Re: [PATCH v28 21/22] x86/vdso: Implement a vDSO for Intel SGX enclave call Message-ID: <20200318223937.GC52244@linux.intel.com> References: <20200303233609.713348-1-jarkko.sakkinen@linux.intel.com> <20200303233609.713348-22-jarkko.sakkinen@linux.intel.com> <20200315012523.GC208715@linux.intel.com> <94ce05323c4de721c4a6347223885f2ad9f541af.camel@linux.intel.com> <5dc2ec4bc9433f9beae824759f411c32b45d4b74.camel@linux.intel.com> <20200316225322.GJ24267@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200316225322.GJ24267@linux.intel.com> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Mar 16, 2020 at 03:53:22PM -0700, Sean Christopherson wrote: > Yes and no. If we wanted to minimize the amount of wrapping around the > vDSO's ENCLU then we wouldn't have the exit handler shenanigans in the > first place. The whole process has been about balancing the wants of each > use case against the overall quality of the API and code. Minimizing is not something that happens in a void. Given the user base for the SDK having the handler was a necessity. Otherwise, we would not have that handler in the first place. > Up until Nathaniel joined the party, the only stakeholder in terms of the > exit handler was the Intel SDK. There was a general consensus to pass > registers as-is when there isn't a strong reason to do otherwise. Note > that Nathaniel has also expressed approval of that approach. OK, great. > The major benefits being that the vDSO would be callable from C and that > the kernel could define a legitimate prototype instead of a frankenstein > prototype that's half assembly and half C. For me, those are significant I was not aware that there was a plot to make it callable by C. OK, so right now A. @leaf = %eax B. @tcs = 8(%rsp) C. @e = 0x10(%rsp) D. @handler = 0x18(%rsp) On x86-64 Linux C calling convention means DI/SI/DX/CX type of thing. So what is the thing that we are referring to C calling convetion in this email discussion? > benefits and well worth the extra MOV, PUSH and POP. For some use cases > it would eliminate the need for an assembly wrapper. For runtimes that > need an assembly wrapper for whatever reason, it's probably still a win as > a well designed runtime can avoid register shuffling in the wrapper. And > if there is a runtime that isn't covered by the above, it's at worst an > extra MOV. Is it cool if I rip of the documentation from vsgx_enter_enclave.S and move it to Documentation/ ? It is nasty to keep and update it where it is right now. How it is right now, it is destined to rotten. /Jarkko