Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754753AbeAHRmo (ORCPT + 1 other); Mon, 8 Jan 2018 12:42:44 -0500 Received: from mx1.redhat.com ([209.132.183.28]:42488 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752765AbeAHRmm (ORCPT ); Mon, 8 Jan 2018 12:42:42 -0500 Subject: Re: [tip:x86/pti] x86/cpu/AMD: Use LFENCE_RDTSC instead of MFENCE_RDTSC To: Tom Lendacky , "Dr. David Alan Gilbert" , Andrew Cooper Cc: Thomas Gleixner , bp@alien8.de, dwmw@amazon.co.uk, gregkh@linux-foundation.org, 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 References: <20180105160756.23786.4220.stgit@tlendack-t1.amdoffice.net> <1b179b8b-6cc8-d736-81dc-2445be4baf02@citrix.com> <4d9a1f0d-a401-3f0f-9ee2-dd42f4b4716a@amd.com> <929a34a1-e3bc-b1c8-4c71-196610c0d02a@citrix.com> <20180108164803.GF2462@work-vm> <0be27b7e-7285-b23b-7eda-55a70338d16c@redhat.com> <00e18fcc-6a56-0d39-e3c8-7f9a1ffcc260@amd.com> From: Paolo Bonzini Message-ID: <1c312f0d-9de4-1aea-7694-758a8b6103b0@redhat.com> Date: Mon, 8 Jan 2018 18:42:36 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.0 MIME-Version: 1.0 In-Reply-To: <00e18fcc-6a56-0d39-e3c8-7f9a1ffcc260@amd.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Mon, 08 Jan 2018 17:42:42 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: On 08/01/2018 18:39, Tom Lendacky wrote: > On 1/8/2018 11:01 AM, Paolo Bonzini wrote: >> On 08/01/2018 17:48, Dr. David Alan Gilbert wrote: >>>> If your hypervisor is lying to you about the primary family, then all >>>> bets are off.  I don't expect there will be any production systems doing >>>> this. >>> It's not that an unusual thing to do on qemu/kvm - to specify the lowest >>> common denominator of the set of CPUs in your data centre (for any one >>> vendor); it does tend to get some weird combinations. >> >> Agreed. But on a hypervisor we pretty much know that: >> >> - the MSR_AMD64_DE_CFG doesn't exist unless you have a fix > > Not sure what you mean by this... the MSR exists today on many families. But the hypervisor either should not expose it at all to the guest, or if it does, it should not allow setting that bit to 1. Paolo > Thanks, > Tom > >> >> - setting the MSR_AMD64_DE_CFG bit to 1 if you have a fix can be done >> independent of the family >> >> So all KVM needs is a X86_FEATURE_LFENCE_SERIALIZE, it doesn't matter if >> it's because of the family or because Linux has set MSR_F10H_DE_CFG. >> The guest will either try setting the MSR bit and #GP, or it will find >> it already set and do nothing. >> >> Of course no code for this has been written yet. >> >> Paolo >>