Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752203AbeAEQIF (ORCPT + 1 other); Fri, 5 Jan 2018 11:08:05 -0500 Received: from mail-co1nam03on0048.outbound.protection.outlook.com ([104.47.40.48]:46442 "EHLO NAM03-CO1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751784AbeAEQIC (ORCPT ); Fri, 5 Jan 2018 11:08:02 -0500 Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Thomas.Lendacky@amd.com; From: Tom Lendacky Subject: [PATCH v1 2/3] x86/cpu/AMD: Use LFENCE_RDTSC instead of MFENCE_RDTSC To: x86@kernel.org, linux-kernel@vger.kernel.org Cc: Peter Zijlstra , Linus Torvalds , Dave Hansen , Borislav Petkov , Thomas Gleixner , Tim Chen , Greg Kroah-Hartman , David Woodhouse , Paul Turner Date: Fri, 05 Jan 2018 10:07:56 -0600 Message-ID: <20180105160756.23786.4220.stgit@tlendack-t1.amdoffice.net> In-Reply-To: <20180105160736.23786.45026.stgit@tlendack-t1.amdoffice.net> References: <20180105160736.23786.45026.stgit@tlendack-t1.amdoffice.net> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Originating-IP: [165.204.77.1] X-ClientProxiedBy: CY4PR13CA0086.namprd13.prod.outlook.com (10.171.162.24) To MWHPR12MB1149.namprd12.prod.outlook.com (10.169.204.13) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: fd82d565-396c-4779-62ab-08d554567e3f X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(48565401081)(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(5600026)(4604075)(2017052603307)(7153060);SRVR:MWHPR12MB1149; X-Microsoft-Exchange-Diagnostics: 1;MWHPR12MB1149;3:iFvMDcT58DwFUeTEz5ahbrRMgFd5EKh/I6TpvG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ZSDcDkf5XrjrNEe+1poEGSwxFtjppXs5I4f5tKaIABj4id8rL05P4G+qn4EOIKLs2xPnqLAEU2nkM3CtZbsw4lnrutGWCeQrps7LCXIwXh66KcA6HfALu5JeV4ztLW1CCGwJSo1Nit7fX0ZLVOb3Fs+YVCqg4fE3IRwQ1aceyqTv20cVt/CrIHf/AHMPiVF/MwFN/89yv0/68+rzmhpToO6mPTSu7iqf25XQT01GHQJd5vo3BJc3XyLZhGAsG2Fs43TwIHR+h7sEFTTUfG+F62neVOalYrsGcn2Rv2u2w5Rh0DtrRKlyAP5MLe;4:HXcE7lyFWy2tGds10S0R711xKkcYILi7Qai9FpGgyXy7jruSXLwxW1JIFngOIsGJE5WVDdNsKFwdBCm+IwbdQhs1bsp0u1hyhNArExDOM7J0kl6xeS6+u31ZHLmnKOdovr22rx761+3yrmnnEvdV3Uv/JqGSNoKR3EPX+DuTrrVet/Xc6IR5/UvU+W6B+6VxUSkyheV80//ZaB8rdjRvWaw5vJX2yBj0sFItKTVnNKwSCf3bkoAPTSluQcLv2zUcMX22e0t2oBpZXWGz3XZllkNfq0/JT6geU+nk+xnLn5hLK+hMoRyOX9XFbNRhOFvN X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(767451399110); X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6040470)(2401047)(5005006)(8121501046)(93006095)(93001095)(10201501046)(3002001)(3231023)(944501075)(6055026)(6041268)(20161123562045)(20161123558120)(20161123564045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011);SRVR:MWHPR12MB1149;BCL:0;PCL:0;RULEID:(100000803101)(100110400095);SRVR:MWHPR12MB1149; X-Forefront-PRVS: 05437568AA X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(39380400002)(396003)(39860400002)(366004)(346002)(376002)(189003)(199004)(72206003)(316002)(478600001)(68736007)(69596002)(1076002)(8936002)(83506002)(50466002)(81156014)(81166006)(16526018)(58126008)(105586002)(230700001)(97736004)(9686003)(55016002)(54906003)(66066001)(4326008)(76176011)(7736002)(25786009)(53416004)(6506007)(23676004)(103116003)(52116002)(7696005)(6116002)(2486003)(386003)(47776003)(7416002)(8676002)(6666003)(2950100002)(3846002)(86362001)(305945005)(106356001)(97746001)(2906002)(5660300001)(53936002);DIR:OUT;SFP:1101;SCL:1;SRVR:MWHPR12MB1149;H:tlendack-t1.amdoffice.net;FPR:;SPF:None;PTR:InfoNoRecords;MX:1;A:1;LANG:en; X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtNV0hQUjEyTUIxMTQ5OzIzOjc4bWMxN29VWFgyZnlIaWJtWVBCRW1WbTRs?= =?utf-8?B?TEFzSHQyRXRLQWdmY2UvcVV4WUlldVZRRFY5N3JhRW9CYk9iWjMzRTRRSHNX?= =?utf-8?B?NFV6czRWWmZXVkw5V0UrUEwxMWU3REhBNUJHZzZUcmpsWHhtNkRpcUc5S0dN?= =?utf-8?B?SjV6dkp2Q2h1SEpQSjh1OHB1N0k1eVZxeEF2U0tVdUZMQytveUlLTFVLY3Rj?= =?utf-8?B?TTNlT3A0emlIeU04b0NzOFRDWE1rcUNxRUV4SG9NMGpXQy9JZTBEVDBWT3M1?= =?utf-8?B?YzBweFgvVXlBY0F4ZHBHSnV3R3paRVE2OTFKVVcyZGhxK0Z5ZjlZQUx1OUVK?= =?utf-8?B?SzR5S3JEK2daRFR0UFdkNWxqT1Z6UjVLVDhWU09NY3M3VytRQkhNSERTMUdt?= =?utf-8?B?QitsbWE0WFh3TXV4MzZWbmRwYTlnTTNudDBvNUM5cDVtSnBuNzluZkhNS21K?= =?utf-8?B?VHZsaU1jNW8vN3lyblAwbXRzd0lSd25XcksxVDF0L3liU1lPazBvdVhJV09B?= =?utf-8?B?RDFoWWpUY3ZiS09pcE1hUCtGSmN1aFpVY24rOGRqSHNLcFBhMXZXK3YyZkRa?= =?utf-8?B?M3dwNXQ3T1JZNWR3eGplOGhuK1NX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P83De0eYjuHCkj0dV62OMheROGbEy4FZDuT72C+P0dH0u2l3TloAdJbFqF39IKDQ7r2J9oEjyGX/8TUnxfpYOvhGnGkpfc8qBSSkj7lRtySGOicZhcMeWLKM5epC SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;MWHPR12MB1149;20:L3Fb8nrYsmu8uWUng49o9DgED7v3idmvh3nz3k3mdK2t+FFoDfaEJxfQ769RuIrnKqQVQU6QpzsEdNet/QCYA702OlwRvCX84d205wA+XGwOHosoWHjCX4XJkahYk314FzWsxa4S3Gj5LsdmfMoKL0DBoFQXTqOOzV/Xe5Fmp5024jZcjRxeW456D72iy2yIB/u123E8SUA7+1VOSHJVnUbO0m5zVmuT4TJv8wI0upOaPGpwiSm48GxU21pelKz8 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Jan 2018 16:07:59.7609 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: fd82d565-396c-4779-62ab-08d554567e3f X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR12MB1149 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: With LFENCE now a serializing instruction, set the LFENCE_RDTSC feature since the LFENCE instruction has less overhead than the MFENCE instruction. Signed-off-by: Tom Lendacky --- arch/x86/kernel/cpu/amd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c index fbd439e..b221fe5 100644 --- a/arch/x86/kernel/cpu/amd.c +++ b/arch/x86/kernel/cpu/amd.c @@ -838,8 +838,8 @@ static void init_amd(struct cpuinfo_x86 *c) msr_set_bit(MSR_F10H_DECFG, MSR_F10H_DECFG_LFENCE_SERIALIZE_BIT); - /* MFENCE stops RDTSC speculation */ - set_cpu_cap(c, X86_FEATURE_MFENCE_RDTSC); + /* A serializing LFENCE stops RDTSC speculation */ + set_cpu_cap(c, X86_FEATURE_LFENCE_RDTSC); } /*