Received: by 2002:a25:ef43:0:0:0:0:0 with SMTP id w3csp175483ybm; Wed, 27 May 2020 23:16:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwgg183C5wBGiShSyBij/C7XB5bQpMXOh9CASddQ2IY9BJrvHBoSNsOKC+p7cHEc7VjG6nm X-Received: by 2002:a05:6402:1c1e:: with SMTP id ck30mr1470251edb.154.1590646615883; Wed, 27 May 2020 23:16:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590646615; cv=none; d=google.com; s=arc-20160816; b=053BPmaclesxLLBrxUBjivwZmI2A86AR0WcIyMMatwfXo2Jq6PJgQ3sug8EKNdC7qV vkDeGWQsSQbyHeH572DUaYQo1FwK1M6jpfMoRTNGvf9LLxK7j0qFqGhWCs8iFQ1Xy65H wLD25DPXDKu0nECP7Pe8xgnKQ4cSEjJnaYWS2Xd9X3n1KgrbmLTMr2ei4k22mvh9+54H nyhp44q3ZfA5CIPR7Ab1IODE4LVY64CYMzwc54XClKumIrwFowYVliBhxZ+g0tEfBKmI uL4pEU5j/dM2kfB/Bgznq1uy1g0OD9Bz8MhF6jNGc7QAANhqFWTgYvfE93yyn5yFs6cs jiUw== 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=gEnZsDJVB/EQ3faZMAW14IQe+QOF0Rw+NlTW+/MfwoA=; b=jmfb9GdUhEaoOV54gexSo584gWoCXHINHrBonOMciWbAvlWpGlSGafh8dP1ynN43BR mQxROHxAXRvrlwKz6votwtumnbUtWJvOdRZAq/OsC3WPC+fpuyildR01AmHMZcUYZn8o gQ5LGyWhKLbDOymW1k3UNEBJWZ/QPwGuAHHjgg+19Fmak9X6k+aplKQQWK2pcayNpLhx 8Y1A3xqScTYZk52a3yABmOwwM9nTzZDBkai7FlgcGNs37O7sE50im//pkOuH4bBXxnQb jmNiNu2L6gLJ3L8iu9bhhoWV/I1DEYNNrATUSjGSiIsWxp8I1tkowWQTz/pvAKMAnzU4 eQtg== 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 i8si3345442ejj.264.2020.05.27.23.16.33; Wed, 27 May 2020 23:16:55 -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 S1727875AbgE1GOo (ORCPT + 99 others); Thu, 28 May 2020 02:14:44 -0400 Received: from mga05.intel.com ([192.55.52.43]:23196 "EHLO mga05.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725859AbgE1GOn (ORCPT ); Thu, 28 May 2020 02:14:43 -0400 IronPort-SDR: kVtkBgSsmE7RPaxFPT4tPkFnzKh9HlJJXCYhwNM9y1pUxEkBrnlne/5ACBHvWDuUlCZFFwFjZf dGRG4ra6lkig== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 May 2020 23:14:43 -0700 IronPort-SDR: qU+S+XPIRIzvPrO04XQYiVDxBepTXvwHMUeFYv4h0tfwCcO5KmnpXCRL7DuQLNFdy6AZNH9WGk OjrpBqJtEIEA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,443,1583222400"; d="scan'208";a="414495246" Received: from dmescala-mobl1.amr.corp.intel.com (HELO localhost) ([10.252.59.102]) by orsmga004.jf.intel.com with ESMTP; 27 May 2020 23:14:34 -0700 Date: Thu, 28 May 2020 09:14:32 +0300 From: Jarkko Sakkinen To: Sean Christopherson Cc: Borislav Petkov , 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, Serge Ayoun , Jethro Beekman Subject: Re: [PATCH v30 07/20] x86/sgx: Enumerate and track EPC sections Message-ID: <20200528061432.GA102386@linux.intel.com> References: <20200515004410.723949-1-jarkko.sakkinen@linux.intel.com> <20200515004410.723949-8-jarkko.sakkinen@linux.intel.com> <20200525092304.GD25636@zn.tnic> <20200527035613.GH31696@linux.intel.com> <20200528052532.GA63435@linux.intel.com> <20200528053515.GA64796@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200528053515.GA64796@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, May 28, 2020 at 08:35:15AM +0300, Jarkko Sakkinen wrote: > On Thu, May 28, 2020 at 08:25:43AM +0300, Jarkko Sakkinen wrote: > > On Tue, May 26, 2020 at 08:56:14PM -0700, Sean Christopherson wrote: > > > On Mon, May 25, 2020 at 11:23:04AM +0200, Borislav Petkov wrote: > > > > On Fri, May 15, 2020 at 03:43:57AM +0300, Jarkko Sakkinen wrote: > > > > > +struct sgx_epc_section sgx_epc_sections[SGX_MAX_EPC_SECTIONS]; > > > > > +int sgx_nr_epc_sections; > > > > > > > > We have become very averse against global stuff. What is going to use > > > > those, only sgx code I assume...? > > > > > > Yes, only SGX code. The reclaim/swap code needs access to the sections, > > > and that code is in a different file, reclaim.c. I don't have a super > > > strong objection to sucking reclaim.c into main.c, but I'm somewhat > > > indifferent on code organization as a whole. Jarkko likely has a stronger > > > opinion. > > > > I'll change it. > > > > It's not quite as easy as just "sucking the file in". All the commits > > that touch the file need to be reworked: > > > > $ git --no-pager log --format="%H %s" arch/x86/kernel/cpu/sgx/reclaim.c > > 5aeca6dabf767e9350ee3188ba25ceb21f3162b4 x86/sgx: Add a page reclaimer > > de9b1088959f36ffdaf43a49bfea1c7f9f81cac7 x86/sgx: Linux Enclave Driver > > 08d8fcb74fe268059ee58fcc2a0833b244e1f22a x86/sgx: Enumerate and track EPC sections > > Not that I haven't done this a lot last few years. A proven approach > is to do it in two "git rebase -i mainline/master" sweeps: > > 1. For each commit, remove reclaim.c entry from the Makefile and import > reclaim.c contents to main.c. > 2. For each commit, delete reclaim.c. > > I've tried quite a few different angles and this what I've converged > into. Very hard to hit messy into messy merge conflicts. Remembered why the things are the way they are. Also ioctl.c needs these symbols and I'd keep that separate from the contents of main.c and reclaim.c. There the separation obviously makes sense. I'll anyway merge main.c and reclaim.c as one for v31 because they are strongly connected. /Jarkko