Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp1112943ybh; Wed, 18 Mar 2020 15:21:29 -0700 (PDT) X-Google-Smtp-Source: ADFU+vuihFpIKtY93S2iD/l1wRyx+2BtdAVMhvv98emjupb2lOJLlhbSC7HMI2FBIq3ViqK0CxJ6 X-Received: by 2002:a9d:de8:: with SMTP id 95mr6048897ots.160.1584570088857; Wed, 18 Mar 2020 15:21:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584570088; cv=none; d=google.com; s=arc-20160816; b=DK1LIiMlD+ENCiWNqdaGKRVZWqGZAtFKJD6d7VaYVgs+SW3S680azuvOycvqknGSJz 0EgmFmdst75zlrbqXvNNXKjou5sxSdpb4Uhb0Wxjr/2sXOQhQPPDnPpbzGzKCAUgm8/u jchwkCEmxyqdEawQW8hAQa35hN7tXPLNHUXruMK6Yn7tYd+9EhQamMOQGl7zZcazbjwZ SkYV9A/GUE8Zp6i6mJxuwK73324em6HtKoRWCm9WIN9SiAkEYEoNSRFEcH+z3xR+ey8N aS46fhCX42kSKvd2nXyMMNlqyieF9zOaugmnHKswp2d9fkXIz7qGUGAMfveAbAGMr4My uiBw== 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=4rEKIe1m48vPNAo/tJT75XkjJ+7jm41BfrZk0sisDvE=; b=VUwo4fh4Pb/gBQvF1NcUqsYe8z0aljJmSWBfc1/8/kNGRyeclGe41tV/yuPIrDZaYY 6fcOH80G3goo9H6ssWAshEGCXf3/QJjZQm/cdKcSapc85XgPm37KmhXkMBl7lTfVs70q mGXqjdGXPEnJ6W+gJjItgBcRpBIGDXV9M9fFcjOuUfBDai3HaY/ChFBckdAZPkZyHylS 90eeGvYQGuJbE4Y/VlaXstYnpwV1sRM2MyW01gWYwiZuPkzmjXuA3YecSrAIfL3bBTKd U77+dbTBTif2Slm2gmE6y5IHOZCZnwdWCMhZhiZY2dHNqk+lhbZESKwDxWyaqM6l7DUE mRIg== 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 67si162722otj.108.2020.03.18.15.21.16; Wed, 18 Mar 2020 15:21:28 -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 S1727132AbgCRWSh (ORCPT + 99 others); Wed, 18 Mar 2020 18:18:37 -0400 Received: from mga18.intel.com ([134.134.136.126]:18929 "EHLO mga18.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726663AbgCRWSh (ORCPT ); Wed, 18 Mar 2020 18:18:37 -0400 IronPort-SDR: sWn4wkDKl7ISxqUUYbHCA7dnt1/NAOR/CQyS/8h2y5NQpj++K6I/0hi0Sjb8wEN1w41cmJxE1/ 9IIn2SRr5Q3A== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Mar 2020 15:18:36 -0700 IronPort-SDR: pzWgpjP8Erned37xWTCxCnBvKO5M/jn/spY20OjxwLyLrxTke/LPFw24o1OkQU4FSJdw7vbDWG KHuW0RTMtAZg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,569,1574150400"; d="scan'208";a="248330371" Received: from mbeldzik-mobl.ger.corp.intel.com (HELO localhost) ([10.252.55.127]) by orsmga006.jf.intel.com with ESMTP; 18 Mar 2020 15:18:25 -0700 Date: Thu, 19 Mar 2020 00:18:24 +0200 From: Jarkko Sakkinen To: "Xing, Cedric" Cc: Sean Christopherson , Jethro Beekman , 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 , Patrick Uiterwijk , Andy Lutomirski , Connor Kuehl , Harald Hoyer , Lily Sturmann Subject: Re: [PATCH v28 21/22] x86/vdso: Implement a vDSO for Intel SGX enclave call Message-ID: <20200318221824.GA55522@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> <7f9f2efe-e9af-44da-6719-040600f5b351@fortanix.com> <20200316225534.GK24267@linux.intel.com> <7634c48d-a8e2-7366-6f04-06a27f8e5eaf@intel.com> <20200318220114.GB52244@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200318220114.GB52244@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 Thu, Mar 19, 2020 at 12:01:26AM +0200, Jarkko Sakkinen wrote: > On Mon, Mar 16, 2020 at 04:56:42PM -0700, Xing, Cedric wrote: > > On 3/16/2020 3:55 PM, Sean Christopherson wrote: > > > On Mon, Mar 16, 2020 at 02:31:36PM +0100, Jethro Beekman wrote: > > > > Can someone remind me why we're not passing TCS in RBX but on the stack? > > > > > > I finally remembered why. It's pulled off the stack and passed into the > > > exit handler. I'm pretty sure the vDSO could take it in %rbx and manually > > > save it on the stack, but I'd rather keep the current behavior so that the > > > vDSO is callable from C (assuming @leaf is changed to be passed via %rcx). > > > > > The idea is that the caller of this vDSO API is C callable, hence it cannot > > receive TCS in %rbx anyway. Then it has to either MOV to %rbx or PUSH to > > stack. Either way the complexity is the same. The vDSO API however has to > > always save it on stack for exit handler. So receiving it via stack ends up > > in simplest code. > > It is never C callable anyway given that not following the ABI so > who cares about being C callable anyway? A direct quote from the documentation: "**Important!** __vdso_sgx_enter_enclave() is **NOT** compliant with the x86-64 ABI, i.e. cannot be called from standard C code." /Jarkko