Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp3866475pxk; Tue, 22 Sep 2020 04:53:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzfbBXt7r6fn4Hxuh/ZK5igrXIQsSsihb8pF0SOjov2IeYdodQksR9Du2+bwtE6ik7pjfGM X-Received: by 2002:a17:907:728e:: with SMTP id dt14mr4295073ejc.505.1600775613110; Tue, 22 Sep 2020 04:53:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600775613; cv=none; d=google.com; s=arc-20160816; b=eJbcqbeQ4Y9vMHLz6gj7BhPybgcfChrnqZkm/nKx3MvYyRyO10hJ5UTnayD5lL79U3 tTFVRG50JDD247oNwCnX/g18o1f1Bo5W2GQn2ogaebNOwA9MI3uU01uYgPukyHBFs+SS Oo63Rugf0Z2PfqbSAU76x58nRQI9p/Ob76AK/ktpC1oJjlPgAhAvU7561NruHMAQ38bB Ao9UXsR+xS4rYtkj3qiexO5LgNpSgsnR0yCPDyt8EiBVHPE4nFnk8hu7f3NQPzADnDZZ rSKCkeg5TtwRtCq0ychgy81BdtcDkHbjbJEPLFLeMmqh38HMsPq6OZ4mAO8LiGI5aa8t DBuw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:organization:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :ironport-sdr:ironport-sdr; bh=wcT0UN1x2J58v7TrWCBTLoozM3SyL7NivvH11aBcHFk=; b=JuccJmCTCwbx1kInGVj5gKShAk9wIVZjqxa5YCepX8XnLTWnso/sU7WtU6yRo7/Da6 EWrGX0iY7hpY14XITdVreXgiOTwNhrE6Cbm0lsl8pYaht1SI1abNC1Ktui+1sc+/zG8g Wx9OPgu/isRywgWTwwNYOkm2NX9HU5PdbXIJUrUTUVzgKjcAYpZSXehJmhIeop4jYu0J XbI3nrzUhjMyt3x0CXZKpEgdFGHrLxHLmZUBvukJuxf312TYGj8kAjzolF/5jjh2P4jL BR7Zs/PcDsxrh4e47OaUl2ve2IqRS17UazM0/x4PQnaYVQq0jOtaHFDv9TWC/zRwEQTu WnRg== 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 s15si10632103ejy.634.2020.09.22.04.53.09; Tue, 22 Sep 2020 04:53:33 -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 S1726780AbgIVLu1 (ORCPT + 99 others); Tue, 22 Sep 2020 07:50:27 -0400 Received: from mga09.intel.com ([134.134.136.24]:21220 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726918AbgIVLuW (ORCPT ); Tue, 22 Sep 2020 07:50:22 -0400 IronPort-SDR: +vnWP6gHv46+XF9acqS/a1+eG0n03FgEFcRIlezk97IAX9OzBE4MxJ36oF/r3SnivvmD812vV0 zCWvBlR/UCxw== X-IronPort-AV: E=McAfee;i="6000,8403,9751"; a="161511978" X-IronPort-AV: E=Sophos;i="5.77,290,1596524400"; d="scan'208";a="161511978" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Sep 2020 04:50:20 -0700 IronPort-SDR: lIwk2gZMiibyudb/P/DyKaKvhifqKwT0UqtUFS0BoCQhCdO3upAFOcrz6ug+BVR7XiRRMyLp9j B40oc8E1aZyQ== X-IronPort-AV: E=Sophos;i="5.77,290,1596524400"; d="scan'208";a="485924412" Received: from krodolf-mobl1.ger.corp.intel.com (HELO localhost) ([10.252.49.25]) by orsmga005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Sep 2020 04:50:12 -0700 Date: Tue, 22 Sep 2020 14:50:10 +0300 From: Jarkko Sakkinen To: Borislav Petkov Cc: Sean Christopherson , x86@kernel.org, linux-sgx@vger.kernel.org, linux-kernel@vger.kernel.org, Jethro Beekman , Haitao Huang , Chunyang Hui , Jordan Hand , Nathaniel McCallum , Seth Moore , Darren Kenny , Suresh Siddha , akpm@linux-foundation.org, andriy.shevchenko@linux.intel.com, asapek@google.com, cedric.xing@intel.com, chenalexchen@google.com, conradparker@google.com, cyhanish@google.com, dave.hansen@intel.com, haitao.huang@intel.com, josh@joshtriplett.org, kai.huang@intel.com, kai.svahn@intel.com, kmoy@google.com, ludloff@google.com, luto@kernel.org, nhorman@redhat.com, puiterwijk@redhat.com, rientjes@google.com, tglx@linutronix.de, yaozhangx@google.com Subject: Re: [PATCH v38 14/24] x86/sgx: Add SGX_IOC_ENCLAVE_INIT Message-ID: <20200922115010.GA102220@linux.intel.com> References: <20200915112842.897265-1-jarkko.sakkinen@linux.intel.com> <20200915112842.897265-15-jarkko.sakkinen@linux.intel.com> <20200921173514.GI5901@zn.tnic> <20200921181021.GA24481@linux.intel.com> <20200921182753.GK5901@zn.tnic> <20200921191658.GA24823@linux.intel.com> <20200922082918.GC22660@zn.tnic> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200922082918.GC22660@zn.tnic> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Sep 22, 2020 at 10:29:18AM +0200, Borislav Petkov wrote: > On Mon, Sep 21, 2020 at 12:17:00PM -0700, Sean Christopherson wrote: > > That was effectively my original suggestion as well, check for a stale cache > > and retry indefinitely. I capitulated because it did feel like I was being > > overly paranoid. I'm obviously ok going the retry indefinitely route :-). > > > > https://lkml.kernel.org/r/20180904163546.GA5421@linux.intel.com > > Right, so if EINIT is so expensive, why does it matter how many cyccles > WRMSR has? I.e., you don't really need to cache - you simply write the 4 > MSRs and you're done. Simple. > > As to "indefinitely" - caller can increment a counter which counts > how many times it returned SGX_INVALID_EINITTOKEN. I guess when it > reaches some too high number which should not be reached during normal > usage patterns, you can give up and issue a message to say that counter > reached max retries or so but other than that, you should be ok. That > thing is running interruptible in a loop anyway... The way I see it after reading the thread is: 1. Start with simpler always-update-MSRs in this patch set. 2. If this ever causes a bottleneck, then we will fix it. > Thx. > > -- > Regards/Gruss, > Boris. > > https://people.kernel.org/tglx/notes-about-netiquette /Jarkko