Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S966233AbcKKB0x (ORCPT ); Thu, 10 Nov 2016 20:26:53 -0500 Received: from mail-by2nam01on0115.outbound.protection.outlook.com ([104.47.34.115]:47142 "EHLO NAM01-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S965383AbcKKB0v (ORCPT ); Thu, 10 Nov 2016 20:26:51 -0500 From: "Kani, Toshimitsu" To: "thomas.lendacky@amd.com" , "bp@alien8.de" CC: "kvm@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "dvyukov@google.com" , "corbet@lwn.net" , "arnd@arndb.de" , "matt@codeblueprint.co.uk" , "linux-mm@kvack.org" , "aryabinin@virtuozzo.com" , "tglx@linutronix.de" , "konrad.wilk@oracle.com" , "kasan-dev@googlegroups.com" , "x86@kernel.org" , "iommu@lists.linux-foundation.org" , "riel@redhat.com" , "lwoodman@redhat.com" , "mingo@redhat.com" , "joro@8bytes.org" , "linux-efi@vger.kernel.org" , "pbonzini@redhat.com" , "hpa@zytor.com" , "luto@kernel.org" , "glider@google.com" , "linux-arch@vger.kernel.org" , "linux-doc@vger.kernel.org" , "rkrcmar@redhat.com" Subject: Re: [RFC PATCH v3 02/20] x86: Set the write-protect cache mode for full PAT support Thread-Topic: [RFC PATCH v3 02/20] x86: Set the write-protect cache mode for full PAT support Thread-Index: AQHSOu1fwLqIaWOzCkmLAhzIu3DgZKDSMr4AgADMJgA= Date: Fri, 11 Nov 2016 01:26:48 +0000 Message-ID: <1478827480.20881.142.camel@hpe.com> References: <20161110003426.3280.2999.stgit@tlendack-t1.amdoffice.net> <20161110003448.3280.27573.stgit@tlendack-t1.amdoffice.net> <20161110131400.bmeoojsrin2zi2w2@pd.tnic> In-Reply-To: <20161110131400.bmeoojsrin2zi2w2@pd.tnic> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=toshi.kani@hpe.com; x-originating-ip: [15.219.163.9] x-microsoft-exchange-diagnostics: 1;CS1PR84MB0006;7:YQ2I1bkrPTfqHwkpvvQRIWOwoqhXdRiWqOkfBDcsNXCOzdu2Gzs8gnLfELy8q2Y0v1QHjv9qjIduS2nyKzJnHPyvdDEpVPIOZG4S76VQZlBICGyxl9kwv7e6LQ9ygLv2Oupt/eqbPE/DnJtej2DxUd/6fij9M1Y1TTH5q/OGNLZW3NIt4x9dG3utxTyYu7N438wb6M+XDeftkWjaAEdBi/IFrPvyxPKnj6ZpZMIfkee/35JLi+TNkGHMuiJrk+ka6tMglMNTeMnAtylLXB3pdTPTp/wILzdW5Lum46M2fsm2CmY/ZQsdWqkGu44trmB6Sl3AW7mEFWvLOfhheXsphPSDHT5Uv3Rl7+ybdtef0s4= x-ms-office365-filtering-correlation-id: 1d22c8cb-ee9a-48fc-ae16-08d409d1cebb x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001);SRVR:CS1PR84MB0006; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:; x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(6040176)(601004)(2401047)(5005006)(8121501046)(3002001)(10201501046)(6055026);SRVR:CS1PR84MB0006;BCL:0;PCL:0;RULEID:;SRVR:CS1PR84MB0006; x-forefront-prvs: 012349AD1C x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(6009001)(7916002)(199003)(377424004)(189002)(24454002)(7416002)(103116003)(33646002)(2501003)(5660300001)(87936001)(2950100002)(68736007)(229853002)(66066001)(8936002)(81156014)(2900100001)(81166006)(8676002)(586003)(305945005)(86362001)(7736002)(7846002)(2906002)(77096005)(122556002)(92566002)(105586002)(36756003)(6116002)(4001150100001)(102836003)(99286002)(101416001)(106356001)(3660700001)(3280700002)(106116001)(3846002)(4326007)(8666005)(5001770100001)(76176999)(50986999)(189998001)(54356999)(97736004)(7059030)(217873001);DIR:OUT;SFP:1102;SCL:1;SRVR:CS1PR84MB0006;H:CS1PR84MB0005.NAMPRD84.PROD.OUTLOOK.COM;FPR:;SPF:None;PTR:InfoNoRecords;A:1;MX:1;LANG:en; spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="utf-8" Content-ID: <5A008A45AA7B1344A2346C26C53E4AD3@NAMPRD84.PROD.OUTLOOK.COM> MIME-Version: 1.0 X-OriginatorOrg: hpe.com X-MS-Exchange-CrossTenant-originalarrivaltime: 11 Nov 2016 01:26:48.5842 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 105b2061-b669-4b31-92ac-24d304d195dc X-MS-Exchange-Transport-CrossTenantHeadersStamped: CS1PR84MB0006 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from base64 to 8bit by mail.home.local id uAB1QwSo027534 Content-Length: 1019 Lines: 25 On Thu, 2016-11-10 at 14:14 +0100, Borislav Petkov wrote: > + Toshi. > > On Wed, Nov 09, 2016 at 06:34:48PM -0600, Tom Lendacky wrote: > > > > For processors that support PAT, set the write-protect cache mode > > (_PAGE_CACHE_MODE_WP) entry to the actual write-protect value > > (x05). Using slot 6 may be more cautious (for the same reason slot 7 was used for WT), but I do not have a strong opinion for it. set_page_memtype() cannot track the use of WP type since there is no extra-bit available for WP, but WP is only supported by early_memremap_xx() interfaces in this series.  So, I think we should just document that WP is only intended for temporary mappings at boot- time until this issue is resolved.  Also, we need to make sure that this early_memremap for WP is only called after pat_init() is done. A nit - please add WP to the function header comment below. "This function initializes PAT MSR and PAT table with an OS-defined value to enable additional cache attributes, WC and WT." Thanks, -Toshi