Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp2995251ybk; Mon, 18 May 2020 13:06:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx+nMd3UETF/qM0FLFtHg9z/RRwsndAu21qzujbpeVmoSnj7bDCQYr+jYyXoKEGRRtK/Bh8 X-Received: by 2002:aa7:d98f:: with SMTP id u15mr14559222eds.42.1589832382543; Mon, 18 May 2020 13:06:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589832382; cv=none; d=google.com; s=arc-20160816; b=u3acrXtGYSy9tSunMTcHUTmOHRNE622eSdH4wObknoEkdfYiSW0b6iG8Wvy1mV9kbd GiABux2wjaOad8LLzPyz/gCuI30lqRkJucbAJS02zYgcwVh4JLZdwRMVikdXfVYNyV7T tToJsuYtK8YT9kuIewzNT/tjQfjOPqraAum55RoMeOePghrK8tNUX+lIbibGLLjIqFnH H/IKkzDLU8BdtKi5jZE08JMAWbRXL76y6ifUiGGhIr7SWwa4/B7pNIsGvewfmsxM5Fs8 +Ee6RB/v1Zg5eNNbnmydfMmXCFrzhuTUlp+grGdtVrEy0lGdI2BCLYXhaKWp81Y0gB2S rNNw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:organization:references:in-reply-to:date:cc:to:from :subject:message-id:ironport-sdr:ironport-sdr; bh=sA4b8B21WaXukAAwTWYiuhhGrhJ92lQ40fdIsOyhkm8=; b=BKQq1aRD09hZ4P1BKti7VZTlws36OlPHrd8BzvNrHyA/M5x2JjITy06dTRpzCKIN5b VkqE382sIFMAI6O2/PoEoffLQUKXuhsz2TLXJuoEne8O5zs07XRzrWfUEAOmK1txKKKj Gmt6tCQaL5DmVLQXAOLFy3iycpnQUSd/Q1gztaJQ71Wg/0xDztcGBznLbDPI4KUWc51l cjYbrtKZ6cEDqxGcQqpl0xlOXpIdwdOfdYTYqbswusEh3oO1t8z/7OpSDv0LF8c9dVOW 2FlU/YspY81IRcUcPc2AxpMx86HKZM4NX0grStjsiB7xb7ithCaOAMZmNODagCkLP5VB e7LQ== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id lr24si6832072ejb.383.2020.05.18.13.05.59; Mon, 18 May 2020 13:06:22 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726539AbgERUBT (ORCPT + 99 others); Mon, 18 May 2020 16:01:19 -0400 Received: from mga06.intel.com ([134.134.136.31]:9690 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726367AbgERUBS (ORCPT ); Mon, 18 May 2020 16:01:18 -0400 IronPort-SDR: dRsUXzK0oTH5Ju1HZCDl76t9qTlbfY3ZGox7G5hlx5L68PJrzjiejdnItnVm1+sd/kj8KJbg41 o1yi9gkDhTpg== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 May 2020 13:01:18 -0700 IronPort-SDR: 3qfK7AynXe71zqJ5Bvdl7NRf5LA+A3fwZINumvmqUc80o4Kmt1AbGwzME3vhvh+M/rbouZPkaX sO/Y6TuT18uA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,407,1583222400"; d="scan'208";a="267637992" Received: from afloress-mobl2.amr.corp.intel.com ([10.252.56.85]) by orsmga006.jf.intel.com with ESMTP; 18 May 2020 13:01:12 -0700 Message-ID: <371e6a92cad25cbe7a8489785efa7d3457ecef3b.camel@linux.intel.com> Subject: Re: [PATCH v12 00/18] Enable FSGSBASE instructions From: Jarkko Sakkinen To: Andi Kleen Cc: Sasha Levin , linux-kernel@vger.kernel.org, tglx@linutronix.de, bp@alien8.de, luto@kernel.org, hpa@zytor.com, dave.hansen@intel.com, tony.luck@intel.com, ravi.v.shankar@intel.com, chang.seok.bae@intel.com Date: Mon, 18 May 2020 23:01:11 +0300 In-Reply-To: <20200518153407.GA499505@tassilo.jf.intel.com> References: <20200511045311.4785-1-sashal@kernel.org> <0186c22a8a6be1516df0703c421faaa581041774.camel@linux.intel.com> <20200515164013.GF29995@sasha-vm> <20200518153407.GA499505@tassilo.jf.intel.com> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.36.1-2 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 2020-05-18 at 08:34 -0700, Andi Kleen wrote: > > Yes, for SGX this is functional feature because enclave entry points, > > thread control structures (aka TCS's), reset FSBASE and GSBASE registers > > to fixed (albeit user defined) values. And syscall's can be done only > > outside of enclave. > > > > This is a required feature for fancier runtimes (such as Graphene). > > Can you please explain a bit more? What do they need GS for? Apparently, uses only wrfsbase: https://raw.githubusercontent.com/oscarlab/graphene/master/Pal/src/host/Linux-SGX/db_misc.c I'm not too familiar with the codebase yet but by reading some research papers in the past the idea is to multiplex one TCS for multiple virtual threads inside the enclave. E.g. TCS could represent a vcpu for a libos type of container and on entry would pick on a thread and set fsbase accordingly for a thread control block. /Jarkko