Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756750AbeAHLLQ (ORCPT + 1 other); Mon, 8 Jan 2018 06:11:16 -0500 Received: from Galois.linutronix.de ([146.0.238.70]:49192 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755966AbeAHLLP (ORCPT ); Mon, 8 Jan 2018 06:11:15 -0500 Date: Mon, 8 Jan 2018 12:10:33 +0100 (CET) From: Thomas Gleixner To: Andrew Cooper cc: bp@alien8.de, dwmw@amazon.co.uk, gregkh@linux-foundation.org, thomas.lendacky@amd.com, pjt@google.com, mingo@kernel.org, linux-kernel@vger.kernel.org, hpa@zytor.com, tim.c.chen@linux.intel.com, torvalds@linux-foundation.org, peterz@infradead.org, dave.hansen@intel.com, linux-tip-commits@vger.kernel.org Subject: Re: [tip:x86/pti] x86/cpu/AMD: Use LFENCE_RDTSC instead of MFENCE_RDTSC In-Reply-To: <1b179b8b-6cc8-d736-81dc-2445be4baf02@citrix.com> Message-ID: References: <20180105160756.23786.4220.stgit@tlendack-t1.amdoffice.net> <1b179b8b-6cc8-d736-81dc-2445be4baf02@citrix.com> User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 Content-Type: multipart/mixed; BOUNDARY="8323329-1309648868-1515409834=:1735" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --8323329-1309648868-1515409834=:1735 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8BIT On Mon, 8 Jan 2018, Andrew Cooper wrote: > On 08/01/18 10:08, Thomas Gleixner wrote: > > On Sat, 6 Jan 2018, tip-bot for Tom Lendacky wrote: > > > >> Commit-ID: 0bf17c102177d5da9363bf8b1e4704b9996d5079 > >> Gitweb: https://git.kernel.org/tip/0bf17c102177d5da9363bf8b1e4704b9996d5079 > >> Author: Tom Lendacky > >> AuthorDate: Fri, 5 Jan 2018 10:07:56 -0600 > >> Committer: Thomas Gleixner > >> CommitDate: Sat, 6 Jan 2018 21:57:40 +0100 > >> > >> x86/cpu/AMD: Use LFENCE_RDTSC instead of MFENCE_RDTSC > >> > >> With LFENCE now a serializing instruction, set the LFENCE_RDTSC > >> feature since the LFENCE instruction has less overhead than the > >> MFENCE instruction. > > Second thoughts on that. As pointed out by someone in one of the insane > > long threads: > > > > What happens if the kernel runs as a guest and > > > > - the hypervisor did not set the LFENCE to serializing on the host > > > > - the hypervisor does not allow writing MSR_AMD64_DE_CFG > > > > That would bring the guest into a pretty bad state or am I missing > > something essential here? > > What I did in Xen was to attempt to set it, then read it back and see.  > If LFENCE still isn't serialising, using repoline is the only available > mitigation. > > My understanding from the folk at AMD is that retpoline is safe to use, > but has higher overhead than the LFENCE approach. That still does not help vs. rdtsc_ordered() and LFENCE_RDTSC ... Thanks, tglx --8323329-1309648868-1515409834=:1735--