Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp699697pxb; Tue, 2 Feb 2021 16:01:25 -0800 (PST) X-Google-Smtp-Source: ABdhPJwE/eJf2OwBH1YpmX48VIGzo93jH2K2sG0DnpplDK9i6AOIZtqUZzNR9eEhpeiHZhqvwNbY X-Received: by 2002:a17:906:7c43:: with SMTP id g3mr474015ejp.210.1612310485011; Tue, 02 Feb 2021 16:01:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612310485; cv=none; d=google.com; s=arc-20160816; b=NKPu2S9YPMRJgAl06Y6G9KJKjK0mXpsNUhbJL1Nop/FS/XurK8vQ3CkMcT7LjSbpvm 6w9s+fih5j7cpS6ha1bwSrzGh4SXs7cRww+SXzMNvqisRl8oKXcykh/fyTg2UJ/qW2jk 786DB4ZgON5Y1EEOzL2Ce71fhz2Pvy4js93QYTJwGjAuNWzvKOArC6WtS+hhW7wOW6+E Dr2k1QqeABMYA8KpiM+VcSy201J7CLhf/VMc7zU862DtGX3sGZhDXsRJ3MzHPf/XHEYa VVCLgCsudtzk90etX6g4kELr9s7ZQ7SrSdq38b2cqVGsTGh4RLlXN7OdM3MA7oWwZc4C n/cA== 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=5ZfRJS2W/OsM5Brj5F+4AD6Rev7h6F55eW3sC7czqEk=; b=QjwU666q5Op5QNez8ZEuqG2fr+7CgIjcWv/DrUKD5m4zKAU3kMyOOjSYd8al1K2S2r pZS8g5ry2i6ACYrAWdGfOgdjoXSBg5ciUPVIFNkkwYcQcE+brOI94GyJ3l9jGF2kSPZn d/0KOwuNCWg8FobXw2vO2MYZSMvl6uH9V/4UOmrnQ3BMFQgSlsPhCRfBO/lTX4xSD8mm yVlgDLsG30nz1m7a2RTzXdIzFa5D8t/L4JZ5rg129JOloJ5vQM4ezK7RJeL4hVeDYXfd LDmXUsxIPPBMxTo8kPynQrKF0/F9FPSwBD3q46dyPZVoAyH8rx8a6lPVJMa33MAIhSsf tLEA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=rOR49h7i; 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 c13si172390ede.559.2021.02.02.16.00.55; Tue, 02 Feb 2021 16:01:25 -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=rOR49h7i; 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 S237613AbhBBRlD (ORCPT + 99 others); Tue, 2 Feb 2021 12:41:03 -0500 Received: from mail.kernel.org ([198.145.29.99]:47920 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237626AbhBBRh4 (ORCPT ); Tue, 2 Feb 2021 12:37:56 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 700A164F6B; Tue, 2 Feb 2021 17:37:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1612287435; bh=Q5IXGz4agDy9l+eqDqusJEsm5r3+bp1i2JQICg3Sb68=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=rOR49h7ioJoHRRu5wIYcUXazOLckzJoNzfEV3hbml47dbWe4z0657cijt/Nz8JJ/W Y68M2Y+uig8GpuIQD4jZlGffvlPWh1ZtJbBT+hc4yVpBRtghugXe7Vj++SNtaGTp3s RE0W636qwLqAeLeLVzfpwcLVrufiWqk0JCbXPZJr63Fy11w2ARUqiSdwsWN+JZepsa JbKzoIEx81P8nPMS3PH6Cbs6llixrsMMnmmne4hBl9v5IwYZDcd0ljqoyNROCDF/Ta NziQUEJ7C4SG2uK2SChu3+Qj7huntndezUE63PkmYT9XdGc41SNf/9hBINN70P3A2+ xLv20C+mkmmpg== Date: Tue, 2 Feb 2021 19:37:08 +0200 From: Jarkko Sakkinen To: Christoph Hellwig Cc: Sean Christopherson , ira.weiny@intel.com, 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: <20210129001459.1538805-1-ira.weiny@intel.com> <20210201084812.GA3229269@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210201084812.GA3229269@infradead.org> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Feb 01, 2021 at 08:48:12AM +0000, Christoph Hellwig wrote: > On Fri, Jan 29, 2021 at 09:37:30AM -0800, Sean Christopherson wrote: > > On Thu, Jan 28, 2021, ira.weiny@intel.com wrote: > > > From: Ira Weiny > > > > > > There is no reason to alloc a page and kmap it to store this temporary > > > data from the user. > > > > Actually, there is, it's just poorly documented. The sigstruct needs to be > > page aligned, and the token needs to be 512-byte aligned. kmcalloc doesn't > > guarantee alignment. IIRC things will work until slub_debug is enabled, at > > which point the natural alignment behavior goes out the window. > > Well, there still is absolutely no need for the kmap as you can use > page_address for a GFP_KERNEL allocation. Yeah, we do that in sgx_ioc_enclave_create already based on feedback: secs = kmalloc(PAGE_SIZE, GFP_KERNEL); if (!secs) return -ENOMEM; The kmap() in sgx_ioc_enclave_init() is an unfortunate miss. Let's just follow the pre-existing pattern. /Jarkko