Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp609985ybt; Fri, 26 Jun 2020 07:20:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzBtcaRkCiSERpu00hdXJazJcKYFnoEJvSmCumMs8h0yIDmhQodfxfPaXD185d5Ssvsh6FY X-Received: by 2002:a17:906:8381:: with SMTP id p1mr2740495ejx.280.1593181254516; Fri, 26 Jun 2020 07:20:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593181254; cv=none; d=google.com; s=arc-20160816; b=zt79u6WB2Kr7S/yNaHczVLTAyliNj4S47jauYCeVInKkdQstA4AOJDIeck04m8rKVX LZrUJvFZEl8ojQjaeJtG8bUdp77p7yBBvToe9mH3CkhPGbc1/UM8oz9rmAfzdaQALYEU 4gXZ2+7tZHCHKQPayvNr3TKDgFMQbKcT7YM490G71bJAHy83PKH+SjKVmu6JB7SnWesQ y5/e5iwM5FlX3L2xCqS2b11H0UiT1m6jxFo4ME0YQD51m5BvmIMIbj/fP/952N0bCdg4 H7Kz7U6uMJMN96bMOhUCq5uYb/wlIwoiRSDexzHZlqkjpOE+LweC7q6jIvqX3Uvv3sdj dalw== 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=rLjxygDGdT49G57zkhC74dYiKJmHD0I8ikmBR1E1o+Q=; b=Lj2mtwhAJqbAewDBrzEEy1blJVAU04gCBQ33sLfxUDf2qdJH+L9g5oL3rXkECEKl6/ nzxpbL57evL6DBua/iuLKP/ZziX3ClzlCA5+yyJxrHW6L5UuKjFzsWQ1dIiuTZSYQ8Mm ke1B2pXO5Px2BU9+bbv16rzaKWCGVLK4qCJx0fzuJ4bMFwKVoI6O0OGR2FxFjrQOF2tH SGXKyq2CFmAFH4iWI/WHc2FiRBcKiEQwrzEArw/vn4wUfD4X++rxJGxJCpZd/1nl/oI2 yfn7T7pDc4DkFZlecXL6+sfDNOpdlLvEldfKJjNPPaSuqDYEn/br8JDzUpmwVA6TQSgA wiqQ== 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 i26si8809255eja.98.2020.06.26.07.20.31; Fri, 26 Jun 2020 07:20:54 -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 S1729156AbgFZOT6 (ORCPT + 99 others); Fri, 26 Jun 2020 10:19:58 -0400 Received: from mga17.intel.com ([192.55.52.151]:43793 "EHLO mga17.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728489AbgFZOT5 (ORCPT ); Fri, 26 Jun 2020 10:19:57 -0400 IronPort-SDR: 2hNThCcDOiVRxgR1oOA+ooSiKTszLnw0dNkSqsKw3hfWmKOa7vjlt5DzCvy7wOlM28yrB7RDU2 uLJqH0oa8iXQ== X-IronPort-AV: E=McAfee;i="6000,8403,9663"; a="125539943" X-IronPort-AV: E=Sophos;i="5.75,283,1589266800"; d="scan'208";a="125539943" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Jun 2020 07:19:56 -0700 IronPort-SDR: 7KVUSL9c3jS1SzTl7agv6L9IQ8NJCyF5vADzpoDpcQH0XLAoZqj/qLV9uL4jS/U4NvVV7P03wB OH3ciBZmhnwg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,283,1589266800"; d="scan'208";a="479841368" Received: from cgheban-mobl.ger.corp.intel.com (HELO localhost) ([10.249.40.199]) by fmsmga006.fm.intel.com with ESMTP; 26 Jun 2020 07:19:38 -0700 Date: Fri, 26 Jun 2020 17:19:36 +0300 From: Jarkko Sakkinen To: Sean Christopherson Cc: Borislav Petkov , 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: <20200626141936.GC390691@linux.intel.com> References: <20200617220844.57423-1-jarkko.sakkinen@linux.intel.com> <20200617220844.57423-12-jarkko.sakkinen@linux.intel.com> <20200625172319.GJ20319@zn.tnic> <20200625183448.GG3437@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200625183448.GG3437@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, Jun 25, 2020 at 11:34:48AM -0700, Sean Christopherson wrote: > 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? I proposed the same before I go this email so I guess we have a consensus here. /Jarkko