Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934017AbeAHPDA (ORCPT + 1 other); Mon, 8 Jan 2018 10:03:00 -0500 Received: from twosheds.infradead.org ([90.155.92.209]:46320 "EHLO twosheds.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932121AbeAHPC6 (ORCPT ); Mon, 8 Jan 2018 10:02:58 -0500 Message-ID: In-Reply-To: <4d9a1f0d-a401-3f0f-9ee2-dd42f4b4716a@amd.com> References: <20180105160756.23786.4220.stgit@tlendack-t1.amdoffice.net> <1b179b8b-6cc8-d736-81dc-2445be4baf02@citrix.com> <4d9a1f0d-a401-3f0f-9ee2-dd42f4b4716a@amd.com> Date: Mon, 8 Jan 2018 15:02:25 -0000 Subject: Re: [tip:x86/pti] x86/cpu/AMD: Use LFENCE_RDTSC instead of MFENCE_RDTSC From: "David Woodhouse" To: "Tom Lendacky" Cc: "Thomas Gleixner" , "Andrew Cooper" , 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 User-Agent: SquirrelMail/1.4.22-21.fc27 MIME-Version: 1.0 Content-Type: text/plain;charset=utf-8 Content-Transfer-Encoding: 8bit X-Priority: 3 (Normal) Importance: Normal X-SRS-Rewrite: SMTP reverse-path rewritten from by twosheds.infradead.org. See http://www.infradead.org/rpr.html Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: > Ok, I can add the read-back check before setting the feature flag(s). > > But... what about the case where the guest is a different family than > hypervisor? If we're on, say, a Fam15h hypervisor but the guest is started > as a Fam0fh guest where the MSR doesn't exist and LFENCE is supposed to be > serialized? I'll have to do a rdmsr_safe() and only set the flag(s) if I > can successfully read the MSR back and validate the bit. At some point, if the hypervisor is lying to you about what the CPU is, and you can't check empirically, you have to admit defeat :) -- dwmw2