Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp3659431imm; Mon, 25 Jun 2018 02:23:07 -0700 (PDT) X-Google-Smtp-Source: ADUXVKL2aB5iGpWT8Gkwi+pBbgQOfHsusSV1pm+y+nD8fP6E9S1jsSax8HOzQFJieXCNL/g/9145 X-Received: by 2002:a63:4244:: with SMTP id p65-v6mr9999044pga.432.1529918587738; Mon, 25 Jun 2018 02:23:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529918587; cv=none; d=google.com; s=arc-20160816; b=JtXXrpp/gQcaWgsmU3leZPs3X+dg47vxCvzXcF5L8TiEmIUEKzAH+qNdEy29BWuFuT ZIWw0b+BaPo9yNn0WclnuV0HuXcl3EGvhW3XEGHme8lNK6dEHD3yuliSOcp29p9XmnHE PBpZcgnWfmNQMFakOEv0u0gIitXKTrWAGYXEmvc/FaXcHXA8nLTJN/npqE4GGrVKVXZN x5PlHj6WNSE2amvgIJrF4NgKQUr6gCbMbmvIvXZQ9wZ8bA/WObbvPf9rn/92vU2iOmnS RzuOk72XoHn7ikD8gCUJKfg6syxKsN6UVdOw613J/vYcVYCDnvWW3p8Njhzj/Zr5YiFn WIug== 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 :organization:references:in-reply-to:date:cc:to:from:subject :message-id:arc-authentication-results; bh=HpOshzciXHlE9KbvPWUhh06nEO0vCdU8jEre6c/m2c8=; b=KST/jybErQnTxZRgoIxJLjMEbJN0yp5FtoIcZ0PfiZxQ+3Sc68H2djldh2RAG7ls7f ZjlhhwDDLQ6zE87Ci9azfb5+Eyy2EYya78Pm294L2WeTSQ/KBtt2MVj/4ipBkywJRl3p dgiak2IMqIhxiuAXBrqTdEpUz8hRyjGNwhyUR+sGJUF7yEMfEFiVP//vgCXgudkSDXuR N6F9PyAOEJui+VY9eppGA/455M5BfmeOHbXjLdi/LvfRvebrZpDQabuuzDDGLbLEwHwd iifuqZN5ScerhQeAJ11e4B6yg6698s5Di5BlMTi4CnpY8OvvmuAll11JcJ3ZyXLhbKLj /10g== 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 w4-v6si389622pgr.549.2018.06.25.02.22.53; Mon, 25 Jun 2018 02:23:07 -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 S1754920AbeFYJWA (ORCPT + 99 others); Mon, 25 Jun 2018 05:22:00 -0400 Received: from mga11.intel.com ([192.55.52.93]:58857 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754537AbeFYJV6 (ORCPT ); Mon, 25 Jun 2018 05:21:58 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 25 Jun 2018 02:21:58 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,269,1526367600"; d="scan'208";a="210901333" Received: from jsakkine-mobl1.tm.intel.com (HELO sfriis-mobl.ger.corp.intel.com) ([10.237.50.42]) by orsmga004.jf.intel.com with ESMTP; 25 Jun 2018 02:21:55 -0700 Message-ID: Subject: Re: [PATCH v11 09/13] x86, sgx: basic routines for enclave page cache From: Jarkko Sakkinen To: Sean Christopherson , x86@kernel.org, platform-driver-x86@vger.kernel.org Cc: dave.hansen@intel.com, nhorman@redhat.com, npmccallum@redhat.com, Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , "open list:X86 ARCHITECTURE (32-BIT AND 64-BIT)" , "open list:INTEL SGX" Date: Mon, 25 Jun 2018 12:21:55 +0300 In-Reply-To: <1529508365.9779.63.camel@intel.com> References: <20180608171216.26521-1-jarkko.sakkinen@linux.intel.com> <20180608171216.26521-10-jarkko.sakkinen@linux.intel.com> <1529508365.9779.63.camel@intel.com> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.28.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 Wed, 2018-06-20 at 08:26 -0700, Sean Christopherson wrote: > > bool sgx_enabled __ro_after_init = false; > > EXPORT_SYMBOL(sgx_enabled); > > +bool sgx_lc_enabled __ro_after_init; > > +EXPORT_SYMBOL(sgx_lc_enabled); > > +atomic_t sgx_nr_free_pages = ATOMIC_INIT(0); > > +EXPORT_SYMBOL(sgx_nr_free_pages); > > +struct sgx_epc_bank sgx_epc_banks[SGX_MAX_EPC_BANKS]; > > +EXPORT_SYMBOL(sgx_epc_banks); > > +int sgx_nr_epc_banks; > > +EXPORT_SYMBOL(sgx_nr_epc_banks); > > +LIST_HEAD(sgx_active_page_list); > > +EXPORT_SYMBOL(sgx_active_page_list); > > +DEFINE_SPINLOCK(sgx_active_page_list_lock); > > +EXPORT_SYMBOL(sgx_active_page_list_lock); > > I don't think we should be exporting anything other than sgx_enabled > and sgx_lc_enabled. The only external use of a symbol that can't be > trivially (re)moved is in the driver's sgx_pm_suspend() in sgx_main.c, > which uses the sgx_active_page_list to invalidate enclaves. And that > behavior seems unsafe, e.g. an enclave could theoretically have zero > pages on the active list and so could be missed in the suspend flow. Fully agreed. Just forgotten cruft... /Jarkko