Received: by 10.223.185.116 with SMTP id b49csp245159wrg; Tue, 13 Feb 2018 20:58:44 -0800 (PST) X-Google-Smtp-Source: AH8x224373LkuFAuVSccnDVp3wdE+6W9NoE3lGx4wpITvkenfDVd4/ecMVt5jcc3wEGCbOI8b/H+ X-Received: by 10.101.64.4 with SMTP id f4mr2811767pgp.171.1518584324611; Tue, 13 Feb 2018 20:58:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518584324; cv=none; d=google.com; s=arc-20160816; b=CBWvPytRoaixRZY+oQjqCxYL6w85tpsScn9Axdy+U2wqjKokizNunKJvjvcPYZRW6g lFQKjIwHRvY6IRbz/pUeGE3n3IHK7CcqYDpgjJEn+UiBzWEr2CESJYhv2uyMVgUsSW0m EH1js9rMuYtZ86jp2nSfZfESSGW/aPjo4T8UcboixzSdreN1iV23QUaAUlkMGGoyqjj2 hMY9z6OjKeeKCz9fyk77GAdUcpzZQiV6NE501YPt5GJJtIsA0nPw7dtY97Q3DZx2niCp AbKFXPO2G4GudiNEoEoEvMAc3SbVm2J/miymcdbg/Y+cOLFLUhUdYROF+Na2L2cDMA/g fHag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:spamdiagnosticmetadata :spamdiagnosticoutput:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature:arc-authentication-results; bh=SrtXi2XwPA+nsnHok5r4lofZs5jGaqDae2lt1/EgFZ4=; b=CsGprn9UxTbb04B68QdV90DuxAjETEs7j5DL397gojifVBVB4LoOxPGbEBHvLq2Gv6 fcNoTpNmQjXIQ7xezeFX+n14nqrOBcrLnTAj1LzulOl4Wi1uU7PXO/HwqwOm6osa6CaB uPyZJLnvzenn47oZR8cvVw8hszp31QSVvaCUni1mQqh4is7ZkNRK+jntfCH7CDrm8cJS mR9ZUTPEZJGCoeHfU9iFrcT6lgyxOt/t5Zt4uupP8swYWO4xL0zRpalDA63112sKcnEh It/maJPE9aRSjyP4PInAxXNXuqkdSX5RjgQ0+LgW4wHzglN0ytZuxeH5Ig20GypEf/dF 6Gpg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amdcloud.onmicrosoft.com header.s=selector1-amd-com header.b=RCgEGPu/; 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 q184si603582pga.242.2018.02.13.20.58.29; Tue, 13 Feb 2018 20:58:44 -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=@amdcloud.onmicrosoft.com header.s=selector1-amd-com header.b=RCgEGPu/; 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 S966857AbeBNE5u (ORCPT + 99 others); Tue, 13 Feb 2018 23:57:50 -0500 Received: from mail-co1nam03on0069.outbound.protection.outlook.com ([104.47.40.69]:65504 "EHLO NAM03-CO1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S966813AbeBNE5t (ORCPT ); Tue, 13 Feb 2018 23:57:49 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector1-amd-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=SrtXi2XwPA+nsnHok5r4lofZs5jGaqDae2lt1/EgFZ4=; b=RCgEGPu/Gcpqr4HY86MxK9V1NQOVcFCzJCHayAA5tWacr07kAYks3iUd6PJK4Nf3fCtSvAkLaaq3cuGXWhwDL8fN6oE6sgAo3yWAlLjnToBoTaJsQP0r8dO4uBT66h0qvmACDoEbjp3MEHIRUc9GwouULlVq4LoFnDDE5K4ZZRQ= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Thomas.Lendacky@amd.com; Received: from [10.236.65.116] (165.204.78.1) by CY4PR12MB1141.namprd12.prod.outlook.com (2603:10b6:903:36::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.485.10; Wed, 14 Feb 2018 04:57:45 +0000 Subject: Re: [PATCH] x86/mm: Decouple dynamic __PHYSICAL_MASK from AMD SME To: "Kirill A. Shutemov" Cc: "Kirill A. Shutemov" , Ingo Molnar , x86@kernel.org, Thomas Gleixner , "H. Peter Anvin" , Dave Hansen , Kai Huang , linux-kernel@vger.kernel.org References: <20180208125524.88795-1-kirill.shutemov@linux.intel.com> <5199949d-6795-aa55-888c-7ba8abd406e2@amd.com> <20180214042121.tza3cpvrnpztjeme@node.shutemov.name> From: Tom Lendacky Message-ID: <37cf20a3-653b-1ad7-1e65-6bed935cf325@amd.com> Date: Tue, 13 Feb 2018 22:57:41 -0600 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <20180214042121.tza3cpvrnpztjeme@node.shutemov.name> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [165.204.78.1] X-ClientProxiedBy: BN6PR14CA0043.namprd14.prod.outlook.com (2603:10b6:404:13f::29) To CY4PR12MB1141.namprd12.prod.outlook.com (2603:10b6:903:36::21) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: efea679d-4aed-45ef-f147-08d573677d6e X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(4534165)(4627221)(201703031133081)(201702281549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2bQ2rrmv+JjCVO+NQeGXEZ4/Lmx+ohIrjGZTU7qKafEcJfqp1/pQUrXF4k18o4S0smGxRgbXHbUtoonRNmV3RpzmxjdC8nvDzxD9fw1b4p1NiKUel3YKmvAnADF9bBSHoKdzLu944KrosYRClhu3YDcSQHtWWC+3JhJc7syEykiTmnOJX1jObiaE/nCjVFRNcEjhhW/ay2CVJkjfCOlJ6iyWL80Lk4oCInxnHBuwZoL5dkrfxGiLsGO9W+u/fuFN+8AQjxbRHSwxZb/Hv+TxIZ8Cf/hS+V+Z/z41Bn+DBCR865Fhshg2Bf631VAh+URlXVJTHFRzcqtFdd84alH3jBN3E78Rx2t1CzwLALyreJXiX3b/jZb6BrvB1Lc9uVhTad7ZKxYZXHXHwMtbq2zCvyH8JzcX60JzK57bZlSHdcRUcDnaJXz9idCTJy8;4:qdIYp3CFFCZdAevZvlvmijKYpQED6pZn/gLpDQtCfIvj2Ef2P7eI5L+QEOnWeqbEVgCtY8m1JTay9NBi0MFI2wuSwbOIiAqJYVJventa15EeiZc3i9lPPoJKDq+fT+8ljl2ql0pNq6yDg7iSBwVCdf1/22irHIX74wFXXYj2HX3rkXZ4VIGL3CSWAgCAwRuI8J6F+gTL4aFkU3HxPlXZCH9Q9pRZlCnL4RtsCziAxwnFXvk2+qa3XuB4rH3gNYx16Tc9V9dKnuYihoveky9ZHg== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6040501)(2401047)(5005006)(8121501046)(3231101)(944501161)(3002001)(93006095)(93001095)(10201501046)(6055026)(6041288)(20161123560045)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123562045)(6072148)(201708071742011);SRVR:CY4PR12MB1141;BCL:0;PCL:0;RULEID:;SRVR:CY4PR12MB1141; X-Forefront-PRVS: 0583A86C08 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(6049001)(39860400002)(346002)(39380400002)(396003)(366004)(376002)(189003)(199004)(966005)(16526019)(31686004)(76176011)(53546011)(230700001)(386003)(186003)(6486002)(72206003)(106356001)(3260700006)(105586002)(4326008)(25786009)(86362001)(77096007)(478600001)(305945005)(26005)(2486003)(7736002)(31696002)(6116002)(3846002)(23676004)(316002)(54906003)(6916009)(81166006)(50466002)(16576012)(81156014)(8676002)(6306002)(47776003)(97736004)(229853002)(64126003)(52146003)(52116002)(66066001)(65956001)(65806001)(68736007)(8936002)(6666003)(2950100002)(6246003)(5660300001)(58126008)(36756003)(83506002)(2906002)(53936002)(65826007)(6606295002);DIR:OUT;SFP:1101;SCL:1;SRVR:CY4PR12MB1141;H:[10.236.65.116];FPR:;SPF:None;PTR:InfoNoRecords;MX:1;A:1;LANG:en; Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtDWTRQUjEyTUIxMTQxOzIzOnFicHI5RUpzd20rc3pkbHFkVjlDeGI5WkxT?= =?utf-8?B?YlFveVM1Tm5YMzhLRjV5bnRKUmRkMUJCN0lXZWJVM0lFUTFXRlZOTnRqSjl1?= =?utf-8?B?aHA3V2c4dW0yZ1hqamJpL2Rld0JBdmt5T2JhdVdwcDhPWGgzb3RyUUpDaXBt?= =?utf-8?B?ekxvWTVsSU9PckdaYzJTUkdhSDRjUmxEVFVUdHBHSVZkaUJ4dVJvcjRRVFJr?= =?utf-8?B?YXQwNkNYU0ZQaUdONlpLUlNObTBIcU1UVUM1WWxnZi9kWnZBVkxkZ1VxNCtx?= =?utf-8?B?ZEZwMG9KZEI3VVdnbDhsdzB0eDJyWmVxUktFWTlyMW5tNUtQTzFEd1Z1bDBU?= =?utf-8?B?SmNXazVkT0Y3ZjdSSkZ6NDRGdnUzdHZmOW9CWk95VTRmb3g3dkd3ZmNtNWZI?= =?utf-8?B?M1RVVlMzdHYzc215eTdPc1B0T0wzelRCNzhQMUs0UzRwSkl0V0JTOVEvUT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//joJ6jUkPGvRDr07ksf0iBbQKnMkQ8njLAdFxe4AisaM4HnPdazh1/KnWBQF5RYke1l3qmjHTTexdl+Ey/0juHzWdHq/40E1x/LjY/CPiDWGUjxbqUD7kxf1IQ4NLM=;5:QpBbMSZkuAEG3Onf2toEUOZ+3TT5e3J0cozPHH2RPSdbM+DpCgk+1o6zjVHCciogXnem0opOSYed/8pVXC3DIQsx/K+5gXVs7kSiBHltZ/KHQzqay47yjBRWVNNf9d4eGQkYQ6hmrQU8rebbyxtqkz3vtvfrf8x1+yC071pCh8o=;24:gGTGa1fDFks/YyuNiGlkE+JvGRSTOn9typveUubRgFvp1CdaEuji5OIm0OGLz+z8eXiryFVdZebaVMFd/FK0FGcMFrQF/skGn033KGe7Qww=;7:qedx93+S1nsE13DasuxjcZjdUYvq29h0BM87pUGdy2xq+KKLeumhKpDCC5DrOfiUz8I1GPWC5kvUKv/PLi2KpLzWzACE1n5fnFwltdPblaiCEDCwzjPdH6QbvCAEc6SmDCBNu41SOtNm9y6i5NJHYBuhAdsxHqjlScVbPzN8U1jFoi1LCNNsn2Un8/CkwZQFILHwgEtwsvWPaqul94rDf0iX5bvyJ1objfvBV4M2Pd7QgVJ/2m/Xx6cAZCkLo8ma SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;CY4PR12MB1141;20:eyvTuINhwamAdsUJ+Kb0ehMx77zMjUxx3+Rpz6wxfeACzZoXtOupkWjfRWjGKVfO6Y+qkXGBccdke+DT6k20gEHzx335CvwQg0FpfZb2caJDtMostZ7J+BXwSuEMRDvwUHjDotadgEskiLh2igcoT1V/7KpU1E7XE6bkNMANhrkkSMqj4VXdtzcXAAEpIsbPIxFN4Y5RQOtnTzoCMLfT3fwaU7YRxF8e0gHBP2m8NHBCp4Vr8ySymPBHztrh/m8G X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Feb 2018 04:57:45.4947 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: efea679d-4aed-45ef-f147-08d573677d6e X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR12MB1141 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. See https://marc.info/?l=linux-kernel&m=151017622615894&w=2 > > And software bits are valuable. Do we still have a spare one for this? I was looking at possibly using bit 57 (_PAGE_BIT_SOFTW5). Thanks, Tom >