Received: by 10.223.176.46 with SMTP id f43csp569357wra; Wed, 24 Jan 2018 02:37:59 -0800 (PST) X-Google-Smtp-Source: AH8x225v2Erg9NVNvqr2s7Y4NFpDj1vZIf0dKgAgqZ+zYs5b2I+82ms6Yd7bwIfz6oUNbhWXiyxE X-Received: by 10.99.123.8 with SMTP id w8mr10438426pgc.201.1516790279143; Wed, 24 Jan 2018 02:37:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516790279; cv=none; d=google.com; s=arc-20160816; b=WDue0wUKo7UME601nL1Qjx19Uk09QicROQtzW0mj4Bvn63AcQ0J5ZXnmFVqisfoPZx ZO1A/yPdUYie0QLkYZJBoRuGekSwtfLF6ZTR+2xBeoFATz5n2KE5c/xQHJkVMF2LOyu7 i86HFmh9QTjTFm57520g6j7H3+u1cD3KSVkbqjSUyVNyt+hLm7O0rNdK43c43mPc+yCm zhVfiQFD668dWVqmqAv/43GpC3hFjcIDJGXJjsy1w7yrOrRjr3oCOMmD6V5G0+I05V9t n7OzrpBPESBx4McOcPTWdyrYhj8y1H3b4NQcQl4baNsgw4KlJ1Y1IBt/hvNq8pafKSoj 1D3w== 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=tBYr4FymnOegrqBpD5a8UvjqNSACUFUSWjplF1GH6LY=; b=rZOy16ni8V0XxSEbK4F21rbwNMx7IwrWJ6GGohNXdFLVz79nwJJJtRHX4OY5LitHIB 9dBI02etZ7LZyG/sd0JCDJkZ27YBjxMVOT/tYEx8REtfKxRT+fNiGeebRHCNo+vjcRGc Q4PEKZHOhnqAwrYku8XFce8tUpS2+9mcHDNdxea5CGAVZNfZFjIoAcFwxxfbBO+Jyibr gNfMqQup9Naqv9r0OUrEC74i4seOlmnBaRQVEktpkaab5YNyjnvH3efp5dsznqqaTxE8 GVA6VT7jEycV37QYpmMRw1DIPqJfi0JuK43qtZ+sarmgtUsHS9cY2AIxyqbsrZbJlD6X aglQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@shutemov-name.20150623.gappssmtp.com header.s=20150623 header.b=wpaFc0fA; 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 f7si2740672pfh.215.2018.01.24.02.37.45; Wed, 24 Jan 2018 02:37:59 -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=wpaFc0fA; 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 S933249AbeAXKgo (ORCPT + 99 others); Wed, 24 Jan 2018 05:36:44 -0500 Received: from mail-wm0-f67.google.com ([74.125.82.67]:34388 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932859AbeAXKgk (ORCPT ); Wed, 24 Jan 2018 05:36:40 -0500 Received: by mail-wm0-f67.google.com with SMTP id j21so17396364wmh.1 for ; Wed, 24 Jan 2018 02:36:39 -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=tBYr4FymnOegrqBpD5a8UvjqNSACUFUSWjplF1GH6LY=; b=wpaFc0fArM6LpUPJIqVYZ58i1RbW40s6Cw4hSkAZo2V382TSbzA1MR7MLSbC5wxUyY +db8Ad7wciohTdlwdnsZUybra9nEQrSuEFIEIcK79UM1VbMsknz1SK23DEsFzJXl3joe GNTJvzSErlil4QDVyrH4Ys1ebfOvXsCG7/ZjTtbANwlLQKHz7YvZ1xyWm8zbcSiC1byz l7YVjEcQxeuM8HVXHF+WPxqXkiwwGpdqSb2ZVGviidcyE7u26TzYNsGfeUDgbrfSZvfl kXUgw0pCGRTANi7HwCt685GwYLST9Xdr5c9YSCd3vPrzTj5lxbbP0d5OxgRMrd0IUzqU p7cQ== 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=tBYr4FymnOegrqBpD5a8UvjqNSACUFUSWjplF1GH6LY=; b=OoaiY5ZZWFTd+B7g+MYA/eD+m7DZqxQyFohqtSliMj02DeVDvvCFuwJg49MW+vWrNE KQJ+TvxlJPURU15q1yTs+gjUUDGpI5qjDCu3x+3coJSb7id4QNF5RbpgWQh2qJ18V4IL Ykzg9Z7qeNwuDZEmHPszSp0xVCJXjypoWaGrgS2BxiW065Rm5omxjTA7sfJAL4FYCO7U QTkLJqKSUMBcd8iMXYPG3sJXLT9Lpwcq8igLBE2RIYZmwvhsFfD1aArfVemTZSjUhZ2t Zmhb9+n27X7JD9V60wJZxTsRAbfMrBwXfRrs1fRSqGFlzOq952usG91npdh04nNr/h78 JcCA== X-Gm-Message-State: AKwxytfreZAwwd7RZTj/m5Hh2OGR5wmZzehvUzvEovUmpWZ+DRS3NSY3 3GADZbrdf5bAKv/YdQrGeTDbpmEQ X-Received: by 10.80.183.214 with SMTP id i22mr23591835ede.15.1516790199012; Wed, 24 Jan 2018 02:36:39 -0800 (PST) Received: from node.shutemov.name ([178.121.236.183]) by smtp.gmail.com with ESMTPSA id d60sm8573edc.40.2018.01.24.02.36.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 24 Jan 2018 02:36:37 -0800 (PST) Received: by node.shutemov.name (Postfix, from userid 1000) id A8C83648D520; Wed, 24 Jan 2018 13:36:36 +0300 (+03) Date: Wed, 24 Jan 2018 13:36:36 +0300 From: "Kirill A. Shutemov" To: "Kirill A. Shutemov" Cc: Ingo Molnar , x86@kernel.org, Thomas Gleixner , "H. Peter Anvin" , Tom Lendacky , Linus Torvalds , Borislav Petkov , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/3] x86/mm/encrypt: Move sme_populate_pgd*() into separate translation unit Message-ID: <20180124103636.y5udfksagk2ndlzp@node.shutemov.name> References: <20180123171910.55841-1-kirill.shutemov@linux.intel.com> <20180123171910.55841-2-kirill.shutemov@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180123171910.55841-2-kirill.shutemov@linux.intel.com> 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 23, 2018 at 08:19:08PM +0300, Kirill A. Shutemov wrote: > sme_populate_pgd() and sme_populate_pgd_large() 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 sme_populate_pgd() and sme_populate_pgd_large() into own > translation unit. > > Signed-off-by: Kirill A. Shutemov > --- > arch/x86/mm/Makefile | 13 ++-- > arch/x86/mm/mem_encrypt.c | 129 ----------------------------------- > arch/x86/mm/mem_encrypt_identity.c | 134 +++++++++++++++++++++++++++++++++++++ > arch/x86/mm/mm_internal.h | 14 ++++ > 4 files changed, 156 insertions(+), 134 deletions(-) > create mode 100644 arch/x86/mm/mem_encrypt_identity.c > > diff --git a/arch/x86/mm/Makefile b/arch/x86/mm/Makefile > index 27e9e90a8d35..51e364ef12d9 100644 > --- a/arch/x86/mm/Makefile > +++ b/arch/x86/mm/Makefile > @@ -1,12 +1,14 @@ > # SPDX-License-Identifier: GPL-2.0 > -# Kernel does not boot with instrumentation of tlb.c and mem_encrypt.c > -KCOV_INSTRUMENT_tlb.o := n > -KCOV_INSTRUMENT_mem_encrypt.o := n > +# Kernel does not boot with instrumentation of tlb.c and mem_encrypt*.c > +KCOV_INSTRUMENT_tlb.o := n > +KCOV_INSTRUMENT_mem_encrypt.o := n > +KCOV_INSTRUMENT_mem_encrypt_identity.o := n > > -KASAN_SANITIZE_mem_encrypt.o := n > +KASAN_SANITIZE_mem_encrypt.o := n > +KASAN_SANITIZE_mem_encrypt_identity.o := n > > ifdef CONFIG_FUNCTION_TRACER > -CFLAGS_REMOVE_mem_encrypt.o = -pg > +CFLAGS_REMOVE_mem_encrypt_identity.o = -pg > endif 0day found a boot issue with the commit. We need to add line on mem_encrypt_identity.o, not replace existing one. Fixup is below. diff --git a/arch/x86/mm/Makefile b/arch/x86/mm/Makefile index 51e364ef12d9..03c6c8561623 100644 --- a/arch/x86/mm/Makefile +++ b/arch/x86/mm/Makefile @@ -8,6 +8,7 @@ KASAN_SANITIZE_mem_encrypt.o := n KASAN_SANITIZE_mem_encrypt_identity.o := n ifdef CONFIG_FUNCTION_TRACER +CFLAGS_REMOVE_mem_encrypt.o = -pg CFLAGS_REMOVE_mem_encrypt_identity.o = -pg endif -- Kirill A. Shutemov