Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp731481pxb; Tue, 2 Feb 2021 17:00:32 -0800 (PST) X-Google-Smtp-Source: ABdhPJw0V9SowrB2hTyDxHDVSaugSsDICSdTUv4K7CdaruKaEo8iw7SsjPH9t1lVQkteYcVxTA0I X-Received: by 2002:aa7:d399:: with SMTP id x25mr658190edq.237.1612314032595; Tue, 02 Feb 2021 17:00:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612314032; cv=none; d=google.com; s=arc-20160816; b=tsaYMVF8nWa+60B/RASX9KLleRsMcFw3CHDSDSnsufal33ogq7EH00t9ElmdnXUTX3 FYcPqKS2RMsDdFGQodssbs/up4VH05sx3qPX497EB5Z7RqgdHAiP1viXNlseyImLWaxd +oZd255+MaMQooD5/Ac8hlYiUhKRqTzpnEcvxvnDHncJoRCzS7ASXwygIHXC0GUVuiaC 9TkJGAtgf5ra9Xx+k8g5MtVlkwf8+K11pGc5oeiOe7YuXkGgT55nvOmhsFaXntu8hX8K LOFn2EUfWkoXf8Xe5YfIKcit+3P8pkDLioEoE9ITV720eUy3qfQbKYAImrca7kGeLtem 35Rw== 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=K37+RR5HQ4ylxjR777L0VaC8Ev07gQAQ8XLbdJSiEvk=; b=FYPz/d2Ey6fq0ytch8iYr6GBReyIW6FbruuslTy00aSRaWrkpAhkhQxy8CGlAhLdmn WGHrZWVSYij8vCRQAB/hOLKjEw6adFHo4gwuuWQW1Tx/DEBDpa8FvrGnSdRqM1UsSXcI Yqwnxs6Ikt04Zpjctt9LdTFj6odX1XlTWrmpQS4hIebN7x8m2MWc9Dr4dlOSFd1kfdIf 548aFC4xW6LwA4khdJKHrb7xSki5M51qTGTMlIGO2sy4wiI7qdnc5yvhLmNfxQJj/0E1 hBEbEQ99wfTIMA5atCRz0yNjpCs75DD6u0E+6gGTWl6t3v4wX3uDoGyBWnRbrN3g3upv 6TDA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=pu9kSDVS; 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 m26si244490edr.61.2021.02.02.17.00.07; Tue, 02 Feb 2021 17:00:32 -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=pu9kSDVS; 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 S235524AbhBBWor (ORCPT + 99 others); Tue, 2 Feb 2021 17:44:47 -0500 Received: from mail.kernel.org ([198.145.29.99]:43672 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235648AbhBBWoi (ORCPT ); Tue, 2 Feb 2021 17:44:38 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 29E0564F4C; Tue, 2 Feb 2021 22:43:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1612305837; bh=qyiIFBOuIC3f3nUMesj1fMzai7hKaPmzlzsaCTyXV+M=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=pu9kSDVSy+xBHVBEA6OYdndUTict2LLHnUGJqpf8cfs4L6XuhaBaRMsc99hTZ7z8C MqZdlcADSirul1fukYmhahdOJ7FPO/lA8FDgufvxaKsw0PS1uEbntxp5ERDWSB3N0I yiUO5kXiibl8Z2ov9lFw3TPxw8faHI2AG4mUp4NcCOpOlDvrsEoV+npTn3a49Z59qF SmrKBSrCyaeNYlUTZzc9BftzEB3g/k1SMQABfytzoRdLs2BdXrAt/V8bv3l6QaR78i Vf4eSZN6A9Q30ZtMgH5czdKOeR5KG/9qZZawsv1K4KCBebzhLy3Q/vyEETFoJiJpnl P568lh/1zKDFw== Date: Wed, 3 Feb 2021 00:43:50 +0200 From: Jarkko Sakkinen To: Dave Hansen Cc: ira.weiny@intel.com, Sean Christopherson , Jethro Beekman , linux-kernel@vger.kernel.org, linux-sgx@vger.kernel.org Subject: Re: [PATCH] x86: Remove unnecessary kmap() from sgx_ioc_enclave_init() Message-ID: References: <20210202013725.3514671-1-ira.weiny@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Feb 02, 2021 at 10:55:36AM -0800, Dave Hansen wrote: > On 2/1/21 5:37 PM, ira.weiny@intel.com wrote: > > kmap is inefficient and we are trying to reduce the usage in the kernel. > > There is no readily apparent reason why the initp_page page needs to be > > allocated and kmap'ed() but sigstruct needs to be page aligned and token > > 512 byte aligned. > > Hi Ira, > > It's a *relatively* recent guaranteed, but: > > https://www.kernel.org/doc/Documentation/core-api/memory-allocation.rst > > says: > > > The address of a chunk allocated with `kmalloc` is aligned to at least > > ARCH_KMALLOC_MINALIGN bytes. For sizes which are a power of two, the > > alignment is also guaranteed to be at least the respective size. > > So, if you allocate a page with kmalloc(), you get an aligned page. Yay! And this what we do sgx_ioc_enclave_create() anyway, as I stated in my earlier response. Better to use the same pattern everywhere consitently when it makes sense. /Jarkko