Received: by 2002:a25:ef43:0:0:0:0:0 with SMTP id w3csp155343ybm; Wed, 27 May 2020 22:39:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx4C7z/8anU6uRVhmXJAtmYcUGdieqsNGW3TRwri4D1oxXpg/O3Vh5OdTX32ltcsm7yllH0 X-Received: by 2002:a50:9e49:: with SMTP id z67mr1456374ede.236.1590644368555; Wed, 27 May 2020 22:39:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590644368; cv=none; d=google.com; s=arc-20160816; b=K3ob4hpAJKzPxucMUaCIlYKP/LwLsPeNUPOuKtflc//vdzyrojFOdtR9SBlgih3g/k yNlhxxUk3iUYkJijeJCO/YwIGk77vh1hIVC+XV5bGKbOb6nGlYuzeTpyPFPoTjKBYKsM vCGyceu/jrn0qdTB29Qg76Ak0fVXIrQjgt373ka7auvIIl8PL+JeyEcBKQRekX49MOoJ I1tFBD/pEVwVysPxJbmxDyoLUtSoLbmCOQoBt2MgoGZx24Y1wIY7QMcwpsMSTXMdiYh2 DXPSAQnTLZ1QcWLCIhXNczDy8sB8JQw29rL2LUOu1KNE6nyeBQHNi80EYVo4R4ZOBDpM Cv9Q== 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=IjHWq5UElbRKw3cGvCDPIpFYY9iv34jrCYyAXryy8hM=; b=EqtkI2In3RIezWJDaeEugtzwD3CavIfGA+78iyHdQQ2Gvyn/3j3gewJZhJQXdjn3H/ j56nVZxObbXrCkRAo7uAvS+1TioF4nI9jWD2VWR6YR74d1zNzthSNT3LunOwDYfRwQrG pOBhVqon99h9YFgFuS11R/eHZE2uxWpQKVPer4vhJHEHZO7cWVChgwWXydHSRM6CGnZO cqMjsRskmB45QnKjHLVqFYuCju/FYP3cSt7cnT4xAXv5yfAABVwOTFQ6ed6fp17yHU3w ufAcJuKtJ0IDeP+UjJnyBdULt4TqRf2kNeYVeDp6Ut6Zi2sLBVAkzQXsm1FDA52+ut6s focA== 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 nj4si3247655ejb.643.2020.05.27.22.39.06; Wed, 27 May 2020 22:39:28 -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 S1727811AbgE1Ff0 (ORCPT + 99 others); Thu, 28 May 2020 01:35:26 -0400 Received: from mga06.intel.com ([134.134.136.31]:27657 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725984AbgE1FfY (ORCPT ); Thu, 28 May 2020 01:35:24 -0400 IronPort-SDR: FHXnK9Maj7ZNZj53iIigx+O+2NCN+ULZ3KGQ4ARvyKs0B60rytQek2lSH64nh2cUcq5Q4yQl3T LA1jz4OWjssA== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 May 2020 22:35:24 -0700 IronPort-SDR: 2SdZPj0yQJCpDgubaEXU7UpditVC8ZiB2VgwMVvDrrBNNM3qQfr4Hc8v+7E2YIyPA5DxAwDcQp tqsYYv4V1sbg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,443,1583222400"; d="scan'208";a="468995652" Received: from dmescala-mobl1.amr.corp.intel.com (HELO localhost) ([10.252.59.102]) by fmsmga005.fm.intel.com with ESMTP; 27 May 2020 22:35:16 -0700 Date: Thu, 28 May 2020 08:35:15 +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: <20200528053515.GA64796@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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200528052532.GA63435@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: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. /Jarkko