Received: by 10.223.185.116 with SMTP id b49csp429488wrg; Wed, 14 Feb 2018 01:03:42 -0800 (PST) X-Google-Smtp-Source: AH8x225RzYryKjV35Lj/0lQ2Lv2Pyr2wddXOJYRj524TceSol4Rki2VwyEVuwdvrq8AaxkL7EuSL X-Received: by 2002:a17:902:b7ca:: with SMTP id v10-v6mr3869643plz.437.1518599022662; Wed, 14 Feb 2018 01:03:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518599022; cv=none; d=google.com; s=arc-20160816; b=G1hzyBY8i2KqkWH21VOMK6mYDb2OFz+rgKxrKus2rooONT4otrSWoAmDpxfzPkNBO1 GV5XUQJ3mZqnpmoQ7Zoz+uRQKlIpFIx+/5LFHpr/uXmSEJ69/TFUSIqRIc/3azziib6q Ug14RjwNZcSqMUubVdwuR4+lTwe2qfpro0CeBmMS0Cn+7fELo2Sos12QeEvQn1n0dIpf SisoV11DmxuD4DSPa0HPbXxgS87GHoCf82LLCSK9lGSSiW9ZnOpLvv7f1W9vSPhFBaNc ltX0zubWkTTKC/fMLI+HTvrE7Tt47LB/f+Q9cOaGBv2UQqq/s49aKm20MIQvJSF90pRR AlNw== 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=5jrculoGDgJVIXXizMcUtDf73As7iOU+N+rCwHsJdgY=; b=tZbF1mn2P4PZkgLwRTBEBj7sRVFN4vPXPZ3ymj2K3P3ic2WFSR2H7EpItlEqnPGwCq Zt2BFxkDz5iprfkJA8ZwEeOx9G2CcTQdT7N/BZT5s/udzYOrag4h+rb0iVeyczSP3Ixi 0iE8neHdRze6sLifJ5DW86P5JM/k5RZdIC6pG/wEHWNa/3yWBW4eyK/zCjfxKDs7lc7t nxFNg/Lq33FtRIZ++ApNtlJpCRitvTIOpK9amIZ6t22yFWA0YjLgGbYh9Wyy780zO46z sq2pncl3B2HD+gex6UBd/wg/dwbx53TYkpaNRu+HJjBnGxMnDduSn4a9IBJcwxifyi6M 49Iw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@shutemov-name.20150623.gappssmtp.com header.s=20150623 header.b=rCAKzVAu; 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 b3-v6si2511050plc.309.2018.02.14.01.03.27; Wed, 14 Feb 2018 01:03:42 -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=rCAKzVAu; 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 S966581AbeBNJCq (ORCPT + 99 others); Wed, 14 Feb 2018 04:02:46 -0500 Received: from mail-wm0-f67.google.com ([74.125.82.67]:50647 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754400AbeBNJCm (ORCPT ); Wed, 14 Feb 2018 04:02:42 -0500 Received: by mail-wm0-f67.google.com with SMTP id k87so3333125wmi.0 for ; Wed, 14 Feb 2018 01:02:41 -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=5jrculoGDgJVIXXizMcUtDf73As7iOU+N+rCwHsJdgY=; b=rCAKzVAueYhs+SSqoEUwB3KGmYva+x91sw1lu+cRw2aVCE343nyeN57MTOCwnZhuBU TjsG6H5XANV0AWVsoUqgB2qt1E9z4gMDbQxDgcnmEXNVl9Ub1U3mm0LmJHPWUV3aQUCb uuB68lVsibzZnM105T4K1YhYCfELOXHGROC/1BAo4V8aZNaN8dz2eF2c/zgKAvxci6hS lXvLgFkcNXXvGRgt0yUWE+rqgaJgH9tZyxEftMt2nX3S33Od8rlsMNFkpUl25KzsVfeL VImn3csdLIld+UxvuL/wQr/4iTqxrSLq+5UwchcNDEDQnaKlNXEyozqFLFSca/6589TF oOlw== 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=5jrculoGDgJVIXXizMcUtDf73As7iOU+N+rCwHsJdgY=; b=jaoJ3OKGDkczdL8DNWRU6q6JxIar8NEoCc3AnQ3U1GckgX2QVkyruRX4e1jR+SD2pK JtFner2PF59Aqu23CrxxQUMvwOXtgMRsGZCNqk7Qtqb8o0dcrmi5aweNxtwNO1Rc2jqV xwwDGdwUEvvq72dJ/8SNKFUyoajJDXZp7FGIjzZ3Ih5m7wOcYmeQXui4NnPPXOdznh9S mAToUCamkft3NPsrfqPBUFsVXwiS6G3WHf/u8BsNf2IaQB+YruYDhJ4bQVltkK0mhecw BcqfZZBA8dn4ct5l7G09bINB3IJTrG6LlvOjLwEJ/mpdsN67ns/dJcDzM9DHjPQ4r1ak PhnQ== X-Gm-Message-State: APf1xPA/Xp+4vavuAOC9U9qgJy/6xtbt2cAvgsQcX+8LvrDZyQB/ChVI iuu2d6C+TiVizAqxVydfFtFLTc41 X-Received: by 10.80.148.69 with SMTP id q5mr5959572eda.70.1518598961220; Wed, 14 Feb 2018 01:02:41 -0800 (PST) Received: from node.shutemov.name ([178.121.192.223]) by smtp.gmail.com with ESMTPSA id p93sm2691414edp.63.2018.02.14.01.02.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 14 Feb 2018 01:02:40 -0800 (PST) Received: by node.shutemov.name (Postfix, from userid 1000) id 49660648D520; Wed, 14 Feb 2018 12:02:39 +0300 (+03) Date: Wed, 14 Feb 2018 12:02:39 +0300 From: "Kirill A. Shutemov" To: Kai Huang Cc: Tom Lendacky , "Kirill A. Shutemov" , Ingo Molnar , x86@kernel.org, Thomas Gleixner , "H. Peter Anvin" , Dave Hansen , linux-kernel@vger.kernel.org Subject: Re: [PATCH] x86/mm: Decouple dynamic __PHYSICAL_MASK from AMD SME Message-ID: <20180214090239.cjidydeflvgeww4d@node.shutemov.name> References: <20180208125524.88795-1-kirill.shutemov@linux.intel.com> <5199949d-6795-aa55-888c-7ba8abd406e2@amd.com> <20180214042121.tza3cpvrnpztjeme@node.shutemov.name> <37cf20a3-653b-1ad7-1e65-6bed935cf325@amd.com> <1518593420.13066.11.camel@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1518593420.13066.11.camel@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 Wed, Feb 14, 2018 at 08:30:20PM +1300, Kai Huang wrote: > On Tue, 2018-02-13 at 22:57 -0600, Tom Lendacky wrote: > > On 2/13/2018 10:21 PM, Kirill A. Shutemov wrote: > > > On Tue, Feb 13, 2018 at 10:10:22PM -0600, Tom Lendacky wrote: > > > > On 2/8/2018 6:55 AM, Kirill A. Shutemov wrote: > > > > > AMD SME claims one bit from physical address to indicate > > > > > whether the > > > > > page is encrypted or not. To achieve that we clear out the bit > > > > > from > > > > > __PHYSICAL_MASK. > > > > > > > > I was actually working on a suggestion by Linus to use one of the > > > > software > > > > page table bits to indicate encryption and translate that to the > > > > hardware > > > > bit when writing the actual page table entry. With that, > > > > __PHYSICAL_MASK > > > > would go back to its original definition. > > > > > > But you would need to mask it on reading of pfn from page table > > > entry, > > > right? I expect it to have more overhead than this one. > > > > When reading back an entry it would translate the hardware bit > > position > > back to the software bit position. The suggestion for changing it > > was > > to make _PAGE_ENC a constant and not tied to the sme_me_mask. But is it really constant? I thought it's enumerated at boot-time. Can we step onto a problem for future AMD CPUs? In case of MKTME the bits we need to clear are not constant. Depends on CPU and BIOS settings. By making _PAGE_ENC constant we would effectively lower maximum physical address space the kernel can handle, regardless if the system has SME enabled. I can imagine some people wouldn't be happy about this. And I think it would collide with 5-level paging. I would leave it as variable for now and look on this later once we would have infrastructure to patch constants in kernel text. -- Kirill A. Shutemov