Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754838AbcKNR0G (ORCPT ); Mon, 14 Nov 2016 12:26:06 -0500 Received: from mail-dm3nam03on0063.outbound.protection.outlook.com ([104.47.41.63]:11232 "EHLO NAM03-DM3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752781AbcKNR0B (ORCPT ); Mon, 14 Nov 2016 12:26:01 -0500 X-Greylist: delayed 1123 seconds by postgrey-1.27 at vger.kernel.org; Mon, 14 Nov 2016 12:26:01 EST Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Thomas.Lendacky@amd.com; Subject: Re: [RFC PATCH v3 02/20] x86: Set the write-protect cache mode for full PAT support To: "Kani, Toshimitsu" , "bp@alien8.de" References: <20161110003426.3280.2999.stgit@tlendack-t1.amdoffice.net> <20161110003448.3280.27573.stgit@tlendack-t1.amdoffice.net> <20161110131400.bmeoojsrin2zi2w2@pd.tnic> <1478827480.20881.142.camel@hpe.com> 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" From: Tom Lendacky Message-ID: <01f705f1-484b-4407-7b7a-e8e69966581f@amd.com> Date: Mon, 14 Nov 2016 10:51:27 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: <1478827480.20881.142.camel@hpe.com> Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Originating-IP: [165.204.77.1] X-ClientProxiedBy: MWHPR21CA0018.namprd21.prod.outlook.com (10.173.47.28) To CY4PR12MB1142.namprd12.prod.outlook.com (10.168.163.150) X-Microsoft-Exchange-Diagnostics: 1;CY4PR12MB1142;2:AlDRUaH/BVUrlxs1uIKgQf6gGU/EsCCfPOjeKQxXK86Q247Y1rdveG74+tk/mhgDnwEedbstDKIJgYUKkamlN4IVb9/Ya6pRZOAcHUegaEJTBXZyzFCHLXZWFCjqskJZMMZe0CwtSAV+T5F7uu2r0wbF18vA3B/aI6NbfmQbetY=;3:KB1wWqBkkcnr99VhaTriChED/pbxNWsc8ISFrEpI1Dy0oJX8JsKzc5iKYbks4NY8cfhnQ9nzIfsZszjL+9xnRfenRWNSH0iJJd2iWtysUAus+/sc9cF3UklZPrPBcNETeF603KkCl8lVk1JxwygvC1d2exmIynX90u0c1y2Lbtc= X-MS-Office365-Filtering-Correlation-Id: e895608c-81c4-48fa-24c7-08d40cae7d2c X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001);SRVR:CY4PR12MB1142; X-Microsoft-Exchange-Diagnostics: 1;CY4PR12MB1142;25:1InGWRBEEyViBuvpgRCvqsD7uy4KUkievyCfZHJnGzvLW/kQ9lmlh/EaVNIMPHuwyiQPRKW1Fe866KxkksPLfPvkLkx+t90lS+sUaRz5gVG35k5Cn4WyES1y6kqkYf+uAV+jgPGSCGIKg204kdSkGQedL61n0MVd3cQoisnwE7oUfRhPri7GUQEYnIlqGeNcFZ2bruxbhM4XV3lhMR7Ch/VvOKLMLuG+KG9vgjd8m88FCkbZ+1qtILlrzWgvlUn9XFoEDqbQZC5Iu5HuiKCDpKemHbCs0SK+gaI834ma/lfeC1u4r+wRUZ/mremY1pbw7taS86KL1IEX6+4ilgF0GV7nHscK2rCXnQuT61ry5IOsuwwXkSpUObwl/KJDpGd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d1gZSQhKImFdupDF0mFIV41Nuwb+CUAAsKbvmHyYSLQJf/bij5UpPDq/Rrn2RcoIhbzY/LPOCLU3FQZKkuAzA2BlemmK1QJr X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6060326)(601004)(2401047)(8121501046)(5005006)(3002001)(10201501046)(6055026)(6061323);SRVR:CY4PR12MB1142;BCL:0;PCL:0;RULEID:;SRVR:CY4PR12MB1142; X-Microsoft-Exchange-Diagnostics: 1;CY4PR12MB1142;4:Tc5R3sjRtZMjsqDcaNWoDALgCDLYQdJEIqHfI15IA+LSrT9BBZa9Kaspr96H/9lgFy4EkTpfm9ErMLqD3V45SZ2RjDB/Sd0Sj45EtauEW2681g8C0Bwmz8eX+MbVWeui6uAA7OLZ68rOfyGVY7PRcSl/SiLxgWQU1RjrZUhJ3CY2SjuqIsO7RTrGpqE87acDn/US7/DEfiw3JEt25LKVVspruwmLHbU5bFrRaxAMXj0vEl4VjbsCQFiRDQLJaDgnQcCpBd8tUKyejojq0P96UpMwWpQLc2fVquRld6dRNhAUCQc2DwYAXEBkYwJo6LnkKz4EzagYGmfdjC9vrVXF2M1vXE5qIrfDODhoh9u/L6LDCz280fBeQJNKF+9cjqGMIpSt51CjpTPhxrEee5c8CNR0aXyuKubFTruE3g7tko1OGAkNtD91LetwVlBUmCky X-Forefront-PRVS: 0126A32F74 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(4630300001)(6049001)(6009001)(7916002)(24454002)(189002)(199003)(377454003)(377424004)(105586002)(106356001)(36756003)(230700001)(7416002)(42186005)(50466002)(2950100002)(3846002)(6116002)(76176999)(4001350100001)(189998001)(586003)(5001770100001)(54356999)(101416001)(33646002)(65826007)(50986999)(5660300001)(4326007)(86362001)(31696002)(229853002)(64126003)(2906002)(81166006)(77096005)(81156014)(65806001)(7846002)(4001150100001)(8676002)(7736002)(23676002)(92566002)(65956001)(66066001)(47776003)(2501003)(31686004)(83506001)(68736007)(305945005)(97736004)(6666003)(93886004)(217873001);DIR:OUT;SFP:1101;SCL:1;SRVR:CY4PR12MB1142;H:[10.236.18.82];FPR:;SPF:None;PTR:InfoNoRecords;MX:1;A:1;LANG:en; X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtDWTRQUjEyTUIxMTQyOzIzOklLOEt1R0VSN1diakhkSHZVeW0yQ2dNN0NO?= =?utf-8?B?eW1pSmJkRXRMUTZ5TXJpS2dMeG1KSGw0elBtV2JLeTd5a0VlZmF2ck9LYm1G?= =?utf-8?B?UTAyVW9JdHhDT0FiK25iam5wUHRwL3VZVzIxbkV2WXNPaEVZVS9Ubk5XUEJZ?= =?utf-8?B?YS9mUTRmeEsvSEZLZEtYVGNxSGc5REN2amlrR0dVelBHN051Z0dxdjdBSHN5?= =?utf-8?B?bFZtZVF3RUVFbitnbm9RYWMzcDgvRFFUZi9VU1M0djFMWFNPaDhHV3JQczB4?= =?utf-8?B?cERXN3BpN2JJZjRGT29TVDlrZWxPKzRPd0NVRktwV0ZubVJPOHNDdXBoQjVH?= =?utf-8?B?dTZQZDl4a2U4cnZtT0l4VHdHMFhEL0VKMGgxQ2lJa1pmUWp5dG5RZHl4N1cw?= =?utf-8?B?cUw2T1BDZG5sOFNLVy9oMEtKUlV5SzlXRDE3Z3d6OXNCS25xaVlKeVh4UjlF?= =?utf-8?B?ak5PM09YWkxaUlBReGs4cXppVjZkNVJiem5QM0xxNVVVS3grUUpIb1VoZG1u?= =?utf-8?B?UThOY2oxaElzNXB1QkVRaEFjVHoxV2RyVGJsN3dFOCsrRUpRQWY3VlFyT25Q?= =?utf-8?B?RHpkUGR6R1hsRENBQTZ0T2JnZkZ6VnhBOU9hTWFEUEJXQXFtbHJlTTFSVGcv?= =?utf-8?B?d3A4cEorNHhPTUt3Q2tKaXhtRFAwZUxOY1hLcEU4dzBEMDM1TGdLUmRHSDJR?= =?utf-8?B?SHB2SVpDaE5nM1dNYXYx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pamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;CY4PR12MB1142;7:7/CwASXzTVpuuAspezKqsDaqJs1uRgoKCD6SxBEyPInpMx+VyzhNUUv2JTF2PYYkkgqeTvo8U95ldd/nw3zd51nG8rvpJRyGvVkFQ4/CqJ+iiZAsv1RSXFXNrSDqpS2vBMSNemQ1jRmMunGPiESH2UCJgpJnA3Dupa8GvfWVkygFd3HcxZz+fZhjRZz38Zh5aaNtX5vErUtIOvwyyHw5TglHJ7gzS762xAPYVW48jIrdjSH4mx/kfha8w5aySg7df76ixnOIP0/stfguAn8TAsITN51vboQNBZqvYENtXbR43mnmYfz8wpO9oGwRhpVe6nEl3u9btwSfvp4hGynXfL2nJvqSgwTG94UOavZWh6o=;20:3ahJpWW88PG5UAJJ6b4ENrhowp+EFXXl8os4cluDB/2sQbA21OdzO1YUI+zxvbsfRId5LmLxVmY/Gag8I+1oL/WlSSeoH9qcoLJ2P2WJlq9rEUAOi0RWMJBSrN55tY507ibt+cbPrajThHkCCtuE6AV7J6qKnjUt9DU0mIRku32FdzLEMb9BGGSpkkPJ1RiwE8TnDZg+xmuZp2RGLWU6F4Zj4zG44zhhEUeQMtjtvoBpiPrvcYXwxzppJIQ2x0oU X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Nov 2016 16:51:30.7761 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR12MB1142 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1190 Lines: 36 On 11/10/2016 07:26 PM, Kani, Toshimitsu wrote: > 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. Sounds good, I'll add documentation to cover these points. > > 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." Will do. Thanks, Tom > > Thanks, > -Toshi >