Received: by 2002:a25:ef43:0:0:0:0:0 with SMTP id w3csp18822ybm; Wed, 27 May 2020 17:56:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxFnlmZVgAnCcXzTLI3AaX7U7K79orzvkAVvF2TwVHLOGFWn+iTM0AXa9YP/Rr/41dqcG+a X-Received: by 2002:a05:6402:129a:: with SMTP id w26mr709157edv.41.1590627395528; Wed, 27 May 2020 17:56:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590627395; cv=none; d=google.com; s=arc-20160816; b=L5LUqz1UbUNO2aSBUv734mgzz8HZ94mOKpsnYE4GmjMCQ65MMi1EiPhNyUk76WD8ws gr/1uf90ytQvv6YrSP4donDutIt0YiYDNR+vHdY+K4BKO9a2TK3Wxvtz4o6feMkApw1v jCJpBGH649xfmIioLsP4T2pjHwtHmuAJCw+eYpucstNGqBCabjKUT3FDvBlkjwcUhS3o ogV5oDHokOcDHMs2lR+3x3IwAk0dq+/jkbizASy0bFsNWRV1D/CFGrgLj+5XLz9d282o XJk+OzXLSudAsVFCAOG5gELn3aQeuK4zlkIS6cN80pBdiqGP0aW/dc9SId9i/T6l+0Tk F/PA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:ironport-sdr:ironport-sdr; bh=1gvu6z9BsbYQGm3DLrl+HFyHfVg+M3/VweazyBgJeQM=; b=Dt71EH+W0Y8oWONaS89JggDBSTJOZfJt6vqDhfEO8oRn4ueIK+RM09aa612CV//xBt pi8k6nUq2scUCItYlIwIEM+BRxiauwhp29Rr8R7SCS2k4ths1AuvFI3AH9SJmA2KgNgS 5jcwdUQg2+Cgz4btfUPYLRg6GCL9rLTkuPAhMSNO7cNGrX11KyuROv3ppnFRdKZ0iesA XUN6opVQjCaANXBStLM2ToAubykQkJViBevVrMjfdGTgjW7dByVvWJEMeJhJNSPcchDr XMXOtA21DlsCzabW0I2MPMAAqU+PdQFGJf4iXweGrEYIQTsn/UoHMWgKsBk0EwNlMJO6 gFFQ== 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 c25si2342779edw.456.2020.05.27.17.56.10; Wed, 27 May 2020 17:56:35 -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 S1725815AbgE1AwS (ORCPT + 99 others); Wed, 27 May 2020 20:52:18 -0400 Received: from mga03.intel.com ([134.134.136.65]:1024 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725267AbgE1AwS (ORCPT ); Wed, 27 May 2020 20:52:18 -0400 IronPort-SDR: EKks5ebqe/U7NxJgRc8VGiEGkoupNVpSOY+f1b79SSsnPO0RGFDVH77RFtIfYxrvk/2UEQNR1V oMDXnexj93Dw== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 May 2020 17:52:17 -0700 IronPort-SDR: oQi8CNCBU1mRyQiLvHGTY0sdjHVbPPzBwBiLK+1bHcCsONAX7XiFWU3zeEGRAYzzBZd+072pL7 BiP73rM1aW7g== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,443,1583222400"; d="scan'208";a="267033001" Received: from sjchrist-coffee.jf.intel.com (HELO linux.intel.com) ([10.54.74.152]) by orsmga003.jf.intel.com with ESMTP; 27 May 2020 17:52:17 -0700 Date: Wed, 27 May 2020 17:52:17 -0700 From: Sean Christopherson To: Borislav Petkov Cc: Jarkko Sakkinen , linux-kernel@vger.kernel.org, x86@kernel.org, linux-sgx@vger.kernel.org, akpm@linux-foundation.org, dave.hansen@intel.com, nhorman@redhat.com, npmccallum@redhat.com, haitao.huang@intel.com, andriy.shevchenko@linux.intel.com, tglx@linutronix.de, kai.svahn@intel.com, josh@joshtriplett.org, luto@kernel.org, kai.huang@intel.com, rientjes@google.com, cedric.xing@intel.com, puiterwijk@redhat.com, Jethro Beekman Subject: Re: [PATCH v30 08/20] x86/sgx: Add functions to allocate and free EPC pages Message-ID: <20200528005217.GB25962@linux.intel.com> References: <20200515004410.723949-1-jarkko.sakkinen@linux.intel.com> <20200515004410.723949-9-jarkko.sakkinen@linux.intel.com> <20200526125207.GE28228@zn.tnic> <20200527042111.GI31696@linux.intel.com> <20200527204638.GG1721@zn.tnic> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200527204638.GG1721@zn.tnic> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, May 27, 2020 at 10:46:38PM +0200, Borislav Petkov wrote: > On Tue, May 26, 2020 at 09:21:11PM -0700, Sean Christopherson wrote: > > In other words, sgx_alloc_epc_section() is poorly named. It doesn't > > actually allocate EPC, it allocates kernel structures to map and track EPC. > > sgx_(un)map_epc_section() would be more accurate and would hopefully > > alleviate some of the confusion. > > Makes sense. > > > I have no objection to renaming __sgx_alloc_try_alloc_page() to something > > like sgx_alloc_epc_page_section or whatever, but IMO using get/put will be > > horrendously confusing. > > Ok. My only issue is that the naming nomenclature sounds strange and > confusing as it is. "try" in an "alloc" function is kinda tautological - > of course the function will try to do its best. :) Heh, so what you're saying is we should add __sgx_really_try_alloc_page()? > And there are three functions having "alloc" in the name so I can > imagine someone getting very confused when having to stare at that code. > > So at least naming them in a way so that it is clear what kind of pages > they "allocate" - i.e., what they actually do - would be a step in the > right direction... Ya, and things will only get more confusing when actual NUMA awareness gets thrown into the mix. Jarkko, splicing in the NUMA awareness code, what do you think about: sgx_alloc_epc_section -> sgx_map_epc_section sgx_free_epc_section -> sgx_unmap_epc_section sgx_alloc_page -> sgx_alloc_epc_page sgx_free_page -> sgx_free_epc_page sgx_try_alloc_page -> sgx_alloc_epc_page_node __sgx_try_alloc_page -> sgx_alloc_epc_page_section