Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp139424pxb; Wed, 24 Feb 2021 21:14:54 -0800 (PST) X-Google-Smtp-Source: ABdhPJyJK2Tif97F/I6NAuO/i7+ESvPAnzCR8GX2YJiFBaXTum7ckqEict3LcJ17cWfVLRXlLN3I X-Received: by 2002:aa7:c54b:: with SMTP id s11mr1169587edr.82.1614230093988; Wed, 24 Feb 2021 21:14:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614230093; cv=none; d=google.com; s=arc-20160816; b=xnJbpfRQGU4fYrIFAuA1YDA3HH8cyycLhq9vkrzzou3etIFmZH+PYuqif8wjKpvnWV TuQ2bT6id7X/YEl9mo+OCmpeFS+RbdcATQkhu7OdQmLUu1n9Jd2t7Jd62sZPQ1xPc4sH iLBVc4RyaRSCbDrOtZ0cJF6Kv3Y/d5KctCRmQZXSZHtJJN3avdFJdPZrIFR6/qS2tgTd BDYZspZJdlBExca/K0FBvVIhuwTN3zK8IT5FgNUOh5vNoe4CUMdY+ewSdqXw0j8+I2iQ W14AFV/0pfXqtfbgo6tJvELl76QDFlcBdOl1YAx6jKC4F5P7Hg9iH57jNtN+ECc+RHbW w4KA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=buHir0kAYmK52tGZmnzzjT+VSnitACsD4n7RquSvTpo=; b=ayaXHPI0LvEUdUCj/F6lkBxLfZA6Ya9SMNRfyZkQwrI4ZvftbJEWt6ZwQ2OZ4rpBlo tUurVp7BvNJ/T4yMWN+j89+N9zw+76L8iiai7Hj5UR7PkBRBikN6rsafuvUQ3EA8MPcu 7h90IimUpGe28CXbMAvgHM8rRAQ96P3WHbHw/V0zqcZUBb2jHZdqgp41Asaavdc/Bfxg feNia70jIdhFOirtP8s0rUPZ4u85jnBTcFVajSYSbL5yBaapfyDmPOh0t9Tzb1OCcOK5 ok8SuGrZ3XduOp57rl3dlFfHiFeqvUYCFlUs+v+tVsBT8S509fOTSAcdhcQTE7zwqZwy CSIg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=PI24cwjM; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id gn41si2614412ejc.544.2021.02.24.21.14.30; Wed, 24 Feb 2021 21:14:53 -0800 (PST) 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; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=PI24cwjM; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236701AbhBYBDW (ORCPT + 99 others); Wed, 24 Feb 2021 20:03:22 -0500 Received: from mail.kernel.org ([198.145.29.99]:46132 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236708AbhBYBCw (ORCPT ); Wed, 24 Feb 2021 20:02:52 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 560CD64EDD; Thu, 25 Feb 2021 01:02:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1614214931; bh=zSaKKSiyZKraVWz5FbpVQIblGPLB0AVTulXPF08cecE=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=PI24cwjME1bYxLdzO4ZtC1uf4giWIR9zShuYVePhMi1Tf2WlkAfiWGphoUTC7z/yV sROM80OtycHY7h8X/HTU+S1YiAP/Js/4yYv2COTES6UxxMwu1RMTx0vcWlM32wpHKf MqvQQ3XPPl5IuZPQBXQQxRDDiARnn1/2CfFJr0aUbncdhvKH1c+v4YUwTP/K+ZEXOM hp19hJUUw+gKebluj4ZqWziLSeUxXlNzdQCNO/qpm7Bof6YyNH481tgSrNlG5pKwSm 8q/Stk3GTm+MmRyhLds81X5fnwFOq3RWqM5GEiB2BKCUDXlx8StRezHoiw4eKGVZoy JvwtcxAmssDWQ== Date: Thu, 25 Feb 2021 03:01:54 +0200 From: Jarkko Sakkinen To: Dave Hansen Cc: linux-sgx@vger.kernel.org, haitao.huang@intel.com, dan.j.williams@intel.com, dave.hansen@linux.intel.com, bp@alien8.de, tglx@linutronix.de, linux-kernel@vger.kernel.org, x86@kernel.org Subject: Re: [PATCH 0/3] Introduce version array structure: sgx_va Message-ID: References: <20210224222049.240754-1-jarkko@kernel.org> <64cac2aa-0c69-5438-1f0e-aa1386551198@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <64cac2aa-0c69-5438-1f0e-aa1386551198@intel.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Feb 24, 2021 at 03:48:50PM -0800, Dave Hansen wrote: > On 2/24/21 2:20 PM, Jarkko Sakkinen wrote: > > The use of sgx_va can be later on extended to the following use cases: > > > > - A global VA for reclaimed SECS pages. > > - A global VA for reclaimed VA pages. > ... > > arch/x86/kernel/cpu/sgx/driver.c | 3 +- > > arch/x86/kernel/cpu/sgx/encl.c | 180 ++++++++++++++++++++++--------- > > arch/x86/kernel/cpu/sgx/encl.h | 36 ++++--- > > arch/x86/kernel/cpu/sgx/ioctl.c | 77 +++++-------- > > arch/x86/kernel/cpu/sgx/main.c | 19 +--- > > 5 files changed, 184 insertions(+), 131 deletions(-) > > It looks interesting. > > Were you planning on keeping this on the back burner until we need it > more acutely? Or, were you thinking it should be merged immediately? I think this can wait. Perhaps, this could be picked to some other patch set, such as EDMM. Let's just say that this should be part of anything that touches the page reclaimer. IDA might look odd. Mapping through IDA allocated ID's is for conserving the amount of used EPC pages for the version array. Alternative would be to linearly map enclave page offset to the VA page index but that would introduce a sloppy allocation of EPC. The selected approach, on the other hand, no matter how sparsely you create enclave pages, that does not add to the amount of EPC VA page usage. BTW, encl_page->va_page could be removed, and use sgx_va_get() to locate the VA page, when needed. I'm open for opinions with this one: it's space vs the cost of access question. /Jarkko