Received: by 10.223.176.5 with SMTP id f5csp465082wra; Tue, 30 Jan 2018 14:29:21 -0800 (PST) X-Google-Smtp-Source: AH8x227KL2gw+sosr8BilrZsvqwPKyeXXOydzn6GObHOIHekGCIsIkWCN2Ujf2Msakk/ypoPSrT6 X-Received: by 2002:a17:902:76cc:: with SMTP id j12-v6mr24301387plt.120.1517351361156; Tue, 30 Jan 2018 14:29:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517351361; cv=none; d=google.com; s=arc-20160816; b=KztoFljnG/ao20GrWwD2bQuuIiURSiCUN4xtPs1sPpseh533ixJcyU5OjulAe0BOTF JOl48dI3q03wkg2xHOx6OBY+Bx6yTazVfBsWk+0O3IcXFmwLj1pjRjD9CW4Jxwc087TR qnmJitxFkIfFwCGgfYQbpOGLrQuKnKEiIFTtkzFkqoYOgUgXP1ZmQxIuWO8iphG6q0Ni zDpDxCdmM2V2cJcQKHuFkT0L8EfQtrj7B6Yupqg0OvVEsxB9o1akV3YXuC/W2eosmcAs vzXYC926T7TRGB4Y9gBuzHIiQ/McWp/dtlcGMGOT1llptQuLcChnHmWzD2tGaWowm7Vf aYLA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=tvbWNev6030y/OOTs/rBV73/+mpoT2DQ4nFSqHgFj8Y=; b=phCH2g9044rKgJCaROBHNEx+QGjPaIdK1haWvOOJTNtBdaFUHkpm5a1HkEgXasMqOQ rXEwAYMhkBlab50MnxEh92BfQwOuB2K8UzwvpcvR4DdOkkQPrr0ov7FgMtCoBHsnn/t6 Iukn2oInohQoQ0yzMugpJ1+OjPW2eT0+/ab+JKmp9a47A0KThOK7t33vDYr3EZhLAzjC wHYm+bx8h/AZgnmFvSUxMCjL4vwqm+bn3soruH4KJuiyEWgjKstt1mWP1J6fFRK+v6iW M2080DMnwmtPHskbBeZ4/iSq/kKON60UqJP6qvTyK03Yp1kDEMnHFXqMQPDN7RuMPEhl VAEg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@shutemov-name.20150623.gappssmtp.com header.s=20150623 header.b=u4tk9FwO; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y16-v6si1622694pll.82.2018.01.30.14.29.07; Tue, 30 Jan 2018 14:29:21 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@shutemov-name.20150623.gappssmtp.com header.s=20150623 header.b=u4tk9FwO; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752912AbeA3W2F (ORCPT + 99 others); Tue, 30 Jan 2018 17:28:05 -0500 Received: from mail-wm0-f68.google.com ([74.125.82.68]:36504 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751678AbeA3W2D (ORCPT ); Tue, 30 Jan 2018 17:28:03 -0500 Received: by mail-wm0-f68.google.com with SMTP id f3so4254195wmc.1 for ; Tue, 30 Jan 2018 14:28:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=shutemov-name.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=tvbWNev6030y/OOTs/rBV73/+mpoT2DQ4nFSqHgFj8Y=; b=u4tk9FwONHyGEc857LcpjhfSi02zqvh73Tug/Ar52f2u56+Q35Nl1sVkzfgrtoJOxG HM7N79zkTyQ7sukxzrJjdb03LQDVpoPFnQcnsksWcA9lE8Rfi93Ey5skr0kxz071HMIg g6DQMJUueK6IfzpbCH5ATykoNO5UQ8In04GIp5DxoRTFW48rvreYjcEVA3e/OSzzaXkH GK3f8FxZbm8oYkLrwwlN8DYvtnaN9l6qdd9XD6xkNErHo7BFbtOBUxNjyyYOTcTKxF5b j5eumLtk1o2yAyByDxlpVkC48r2rXDdPAKUT/xI+MvYUiGm2hYQnH4W4UaDMyn18HC08 JeYQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=tvbWNev6030y/OOTs/rBV73/+mpoT2DQ4nFSqHgFj8Y=; b=igvm1xVx8KjQRR7aMXDku0jGNYD6ld17oBuBeNn2Ajrx8ta5w7Dxydo0kC4B8sEr0E Fc2O+MfbCPnw0UzCnUiOYulyirIuNS8b++UmH/+DFQZjMHNRDwBpQKUxOBJPCgJ9BP3m +E+Xukvk20Q17EoJZzG1Bp8IpVP05p2P/wtHWmQiy94JYQA6i2xcw03lTbU/bZ1lwfPY QcaDsS2+S20fgcDkXOJeltOKF3ncfYbZEj4jPKMFnHlzdcvbuv5s9CRGOXIhdltWPLuz v3Y79jwNGo5HHQA/JMy5rNgmsK2aGAwI4EPGVWOoxO0XEysVYzG2h71qo2eT6UGaS3LF qINA== X-Gm-Message-State: AKwxyteZkeHPmC7GhKF8SEU1Yk/OlIxzOOlEYdPtSDGWbhXYzX+tQEi7 0BXzAQYxE7PajbmFcBaVXd3tEQ== X-Received: by 10.80.184.20 with SMTP id j20mr54685807ede.5.1517351282668; Tue, 30 Jan 2018 14:28:02 -0800 (PST) Received: from node.shutemov.name (mm-211-80-122-178.brest.dynamic.pppoe.byfly.by. [178.122.80.211]) by smtp.gmail.com with ESMTPSA id q11sm8123542edj.64.2018.01.30.14.28.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 30 Jan 2018 14:28:02 -0800 (PST) Received: by node.shutemov.name (Postfix, from userid 1000) id 01CF8648D520; Wed, 31 Jan 2018 01:28:00 +0300 (+03) Date: Wed, 31 Jan 2018 01:28:00 +0300 From: "Kirill A. Shutemov" To: Tom Lendacky Cc: "Kirill A. Shutemov" , Ingo Molnar , x86@kernel.org, Thomas Gleixner , "H. Peter Anvin" , Linus Torvalds , Borislav Petkov , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCHv3 1/3] x86/mm/encrypt: Move page table helpers into separate translation unit Message-ID: <20180130222800.7hrnzpy56fb6jwnn@node.shutemov.name> References: <20180124163623.61765-1-kirill.shutemov@linux.intel.com> <20180124163623.61765-2-kirill.shutemov@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20171215 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jan 30, 2018 at 04:26:03PM -0600, Tom Lendacky wrote: > On 1/24/2018 10:36 AM, Kirill A. Shutemov wrote: > > There are bunch of functions in mem_encrypt.c that operate on the > > identity mapping, which means they want virtual addresses to be equal to > > physical one, without PAGE_OFFSET shift. > > > > We also need to avoid paravirtualizaion call there. > > > > Getting this done is tricky. We cannot use usual page table helpers. > > It forces us to open-code a lot of things. It makes code ugly and hard > > to modify. > > > > We can get it work with the page table helpers, but it requires few > > preprocessor tricks. These tricks may have side effects for the rest of > > the file. > > > > Let's isolate such functions into own translation unit. > > > > Signed-off-by: Kirill A. Shutemov > > Just one minor comment at the end. With that change: > > Reviewed-by: Tom Lendacky > > > --- > > arch/x86/mm/Makefile | 14 +- > > arch/x86/mm/mem_encrypt.c | 578 +---------------------------------- > > arch/x86/mm/mem_encrypt_identity.c | 596 +++++++++++++++++++++++++++++++++++++ > > arch/x86/mm/mm_internal.h | 1 + > > 4 files changed, 607 insertions(+), 582 deletions(-) > > create mode 100644 arch/x86/mm/mem_encrypt_identity.c > > > > ... > > > diff --git a/arch/x86/mm/mm_internal.h b/arch/x86/mm/mm_internal.h > > index 4e1f6e1b8159..7b4fc4386d90 100644 > > --- a/arch/x86/mm/mm_internal.h > > +++ b/arch/x86/mm/mm_internal.h > > @@ -19,4 +19,5 @@ extern int after_bootmem; > > > > void update_cache_mode_entry(unsigned entry, enum page_cache_mode cache); > > > > +extern bool sev_enabled __section(.data); > > Lets move this into arch/x86/include/asm/mem_encrypt.h and then add > #include to mem_encrypt_identity.c. Why? Will we need it beyond arch/x86/mm/ in the future? -- Kirill A. Shutemov