Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp1699639pxf; Fri, 26 Mar 2021 12:47:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyqZg1ngtVLJuEtk98ZWaFOZQcYgXMIibMyc+CjvwGaYDmKxhqOrFd8H2Gsd1+ErPq0yInD X-Received: by 2002:a05:6402:13ca:: with SMTP id a10mr16985660edx.320.1616788056774; Fri, 26 Mar 2021 12:47:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616788056; cv=none; d=google.com; s=arc-20160816; b=FvEi6Ty7i+VX7FWwseKmIe3gSqUeKxZtIo5xK2mDXmfiX+JMnHFxNN4C9V84fHyJoD KzCooeY6qpcEntHQ11d5JRA3G7fp9FFOoFKhFH3h9VkfhvMqFML95owKjlUfEWUR5OAi OPDP1RSk6RWl7cfBcnAKK4tTIQbJlTWv5QVUUUkSGObBDDm4EopIAybhZH4EbkPdfqY1 s7kLigMKcofhyajlhhy71wn4eZpGrElRdC0LeRhNEa+a8+7y9o2ICfNCWOj4VxEvKm7B AvBMdUNjMFm3Zh1euyh9so687ebb0KdtAucHE0Hf66Zo46BneiVQT1/PayyICsdPhiLq 5aCw== 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=VdSlCF4VVLvPN3a62uG8H8zFCBwE68fVhQEZc/ZIqw0=; b=Bi3wj87IONij+X4LV2Rita7bDKKsSEsn2+TeS7srDgwU7c4db9BZFZTkXc+9oTZPRO hDs+rjc73Bf3Q5OZtOqU2UNu3wgVSRKMsLOFIwbem5dyKGY+qnr1jLUIz9dznodo8I2d DVxEC9sCem0TRsAkhnt/3jx/2dazZNe7Num2VfTSGp9YGzDQVTPWtE8Tlu/RreXFsGBq j/NM/GLz02jspTgSqN4rzRC1hDX57TE6Zd0a0pjmay7Hop/v86Qj3NaQVPBXOPdQJAa+ Rt8KUkD7HjTGnnNR7m2vyGBzkTUP3qG4wgc4855jwSB4jGENaltChYRQGyKfbJ82Rxtz Oqtw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=XDKADaIV; 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 w25si8061383eju.430.2021.03.26.12.47.13; Fri, 26 Mar 2021 12:47:36 -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; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=XDKADaIV; 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 S230114AbhCZTqM (ORCPT + 99 others); Fri, 26 Mar 2021 15:46:12 -0400 Received: from mail.kernel.org ([198.145.29.99]:54476 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230240AbhCZTpy (ORCPT ); Fri, 26 Mar 2021 15:45:54 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id D7C05619C7; Fri, 26 Mar 2021 19:45:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1616787954; bh=ZTDhus6muL1m6rBYPHTfl1mHLrPDAxL3zd4m78f4VF8=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=XDKADaIVj6lm9xgwj12JdNAz7sXs8A6z6taZmu2Xqfqqn8shKYW/8CT2Qjskiehi6 qYbFKtl86ZtxJk1/tvsWMnIU2e86EfqTdywutPq61w7QJ4tU8VoyH+eQp62Pz9RgT1 OvxMNfXMf0xgdkLRbdcBYNBKiuEwrEGKQRp/1l9c4veZAJd75e33n7zu3lsmeO3cJ8 FoMMme7VDYQn8gpROOl3YCHWDz55J0NqWuP+6AXJa/lVOS9PFbxmwqCnFYT+Fb8A57 SUmMJPhLioZGkLCfulhYxhZBGGqVkLTambNDZBq/7IdPeY285nxZXYVP4FfwFkWNDt F2uOwAddfYBQQ== Date: Fri, 26 Mar 2021 21:45:24 +0200 From: Jarkko Sakkinen To: ira.weiny@intel.com Cc: Thomas Gleixner , Ingo Molnar , Borislav Petkov , x86@kernel.org, Sean Christopherson , Jethro Beekman , Dave Hansen , Dave Hansen , linux-sgx@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] x86/sgx: Remove unnecessary kmap() from sgx_ioc_enclave_init() Message-ID: References: <20210324182246.2484875-1-ira.weiny@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210324182246.2484875-1-ira.weiny@intel.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Mar 24, 2021 at 11:22:46AM -0700, ira.weiny@intel.com wrote: > From: Ira Weiny > > kmap is inefficient and is being replaced by kmap_local_page(), if > possible. Nit: just saying that something is inefficient is not enough. Always should have something to back it up. > That said, there is no readily apparent reason why initp_page needs to > be allocated and kmap'ed() except that 'sigstruct' needs to be page > aligned and 'token' 512 byte aligned. > > Rather than change this kmap() to kmap_local_page() use kmalloc() > instead because kmalloc() can gives this alignment when allocating > PAGE_SIZE bytes. > > Remove the alloc_page()/kmap() and replace with kmalloc(PAGE_SIZE, ...) > to get a page aligned kernel address. > > In addition add a comment to document the alignment requirements so that > others don't attempt to 'fix' this again. I'm a bit confused based on this commit message. Why is kmap_local_page() better, and why kmalloc() is the ultimate choice of all three options? > > Cc: Sean Christopherson > Cc: Jethro Beekman > Cc: Jarkko Sakkinen > Cc: Dave Hansen > Signed-off-by: Ira Weiny /Jarkko