Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp1706711ybt; Thu, 25 Jun 2020 12:07:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJypIHnPyUCA9x+9U7J0vFM2FgG1d8sELoQzBSx90dey+vlYYZQpDKUM7mQBMJHafM0hf5zi X-Received: by 2002:a05:6402:888:: with SMTP id e8mr28047074edy.210.1593112034299; Thu, 25 Jun 2020 12:07:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593112034; cv=none; d=google.com; s=arc-20160816; b=QoFy+AoIaz2tjk+IHXtJDbL0QFlJy8Vy6dx5ZsN7T12pF0OiELqmRvR/6vASg7wFaH V6hDExRZwl+rUMk2mSTuGY2fmRwy/7cfcPT+K9MBCOcypqHZUzwOR0aXq+hjodZr1SzM QUgOKV4OuDGbo4iqeyOdG8fisdIoK6yU14TiPFPjYXygw5MSsnNRTnJis/wlXQPV+4Rl ZInWw5EJ8z4pDfZwDlyj/jF5XtkFS0QU7LIEqHldKGdSIS7UKDdMESXCAAsI9GABxFB0 j+R/194F5gu7bDmBF8T505sX6h5OLU1eHvbJgfWrqOr4vBH3UWEL8Mi7dwAGtC407ojK RCYA== 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=7+CtKA4fDe1I+F90iO3AAw+HFUzgB5ezqulM7n9qtY4=; b=gdMfdY9NJKA2NVuiN1MfcO87/RvkGmIxFJmFR/1GAp0pSFDccP9EiOLKbKCHuxP7mw g4FvkZtL8FBkJ+xWV7HYpZDRjuFTXVB/w1Zx+EFzcCGV5hSvpvRw/uYhN+fg/nW6WzXw wzonE9LmnMoEnu8MaW5Ix5K8KC7cQRYEJn/oknB1h+BbB6DCNUOKrDB1FWdBdGYj2I0R gaqFs9ryRyJ4aUpCF4O9KqRWYeUACtms/yzXZWJX1YwklGbRjuiLb1YZIN6raYCnR2K2 SVkU2l4kHEOa9jV4yb/HWYOJOj1p++/8j9fUbyHKYPjXwdExKXdUaA/efPsKPLh3dLnv cqsw== 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 v12si14841721eji.163.2020.06.25.12.06.49; Thu, 25 Jun 2020 12:07:14 -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 S2405100AbgFYSfL (ORCPT + 99 others); Thu, 25 Jun 2020 14:35:11 -0400 Received: from mga04.intel.com ([192.55.52.120]:46256 "EHLO mga04.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390025AbgFYSfK (ORCPT ); Thu, 25 Jun 2020 14:35:10 -0400 IronPort-SDR: 0fQ228rc3r+oWij782i+k//EP0WeBT593xXC90inrqZejb0hmLHVz2CGiU/3OEp+4WanzEf6gt EoEV3T+gtG7w== X-IronPort-AV: E=McAfee;i="6000,8403,9663"; a="142530546" X-IronPort-AV: E=Sophos;i="5.75,280,1589266800"; d="scan'208";a="142530546" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Jun 2020 11:35:10 -0700 IronPort-SDR: aL4PASQml7wgyj7szJXhpPrZsa4zbVfKDGQzun7rjRPc6UUnaOODbuZ/RKRusjXTdmgFJsRUHg +NFjZpLp2YgQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,280,1589266800"; d="scan'208";a="265427085" Received: from sjchrist-coffee.jf.intel.com (HELO linux.intel.com) ([10.54.74.152]) by fmsmga008.fm.intel.com with ESMTP; 25 Jun 2020 11:35:09 -0700 Date: Thu, 25 Jun 2020 11:34:48 -0700 From: Sean Christopherson To: Borislav Petkov Cc: Jarkko Sakkinen , x86@kernel.org, linux-sgx@vger.kernel.org, linux-kernel@vger.kernel.org, linux-security-module@vger.kernel.org, Jethro Beekman , Haitao Huang , Chunyang Hui , Jordan Hand , Nathaniel McCallum , Seth Moore , 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 v33 11/21] x86/sgx: Linux Enclave Driver Message-ID: <20200625183448.GG3437@linux.intel.com> References: <20200617220844.57423-1-jarkko.sakkinen@linux.intel.com> <20200617220844.57423-12-jarkko.sakkinen@linux.intel.com> <20200625172319.GJ20319@zn.tnic> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200625172319.GJ20319@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 Thu, Jun 25, 2020 at 07:23:19PM +0200, Borislav Petkov wrote: > Also, you had all patches until now split nice and logically doing one > thing only. > > But this one is huge. Why? > > Why can't you split out the facilities which the driver uses: encl.[ch] > into a patch, then ioctl.c into a separate one and then the driver into > a third one? Or do they all belong together inseparably? > > I guess I'll find out eventually but it would've been nice if they were > split out... Hmm, I think the most reasonable way to break up this beast would be to incrementally introduce functionality. E.g. four or so patches, one for each ioctl() of ENCLAVE_CREATE, ENCLAVE_ADD_PAGES, ENCLAVE_INIT and ENCLAVE_SET_ATTRIBUTE, in that order. Splitting up by file probably wouldn't work very well. The split is pretty arbitrary, e.g. encl.[ch] isn't simply a pure representation of an enclave, there is a lot of the driver details/dependencies in there, i.e. the functionality between encl/ioctl/driver is all pretty intertwined. But I think serially introducing each ioctl() would be fairly clean, and would help readers/reviewers better understand SGX as the patches would naturally document the process of building an enclave, e.g. CREATE the enclave, then ADD_PAGES, then INIT the enclave. SET_ATTRIBUTE is a bit of an outlier in that it would be chronologically out of order with respect to building the enclave, but I think that's ok. Jarkko, thoughts?