Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758068AbeAHWed (ORCPT + 1 other); Mon, 8 Jan 2018 17:34:33 -0500 Received: from mail-oi0-f67.google.com ([209.85.218.67]:38608 "EHLO mail-oi0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756427AbeAHWec (ORCPT ); Mon, 8 Jan 2018 17:34:32 -0500 X-Google-Smtp-Source: ACJfBosbvhzpws7PSr2dQn2icwvyE9apzQt03sZswJKt8oVXaVqfp3wUW7dD9YP/V9RCDiFmqHX8K/SyqBv0Hd9FnvU= MIME-Version: 1.0 In-Reply-To: <20180108220912.12580.82330.stgit@tlendack-t1.amdoffice.net> References: <20180108220912.12580.82330.stgit@tlendack-t1.amdoffice.net> From: Dan Williams Date: Mon, 8 Jan 2018 14:34:31 -0800 Message-ID: Subject: Re: [PATCH v2 0/2] x86/cpu/AMD: Make LFENCE a serializing instruction on AMD To: Tom Lendacky Cc: X86 ML , Linux Kernel Mailing List , Peter Zijlstra , Linus Torvalds , Dave Hansen , Borislav Petkov , Thomas Gleixner , Tim Chen , Greg Kroah-Hartman , David Woodhouse , Paul Turner Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: On Mon, Jan 8, 2018 at 2:09 PM, Tom Lendacky wrote: > To aid in speculation control, the LFENCE instruction will be turned into > a serializing instruction. There is less performance impact using LFENCE > in this way compared to MFENCE. > > With LFENCE now being a serializing instruction, it can be also used in > rdtsc_ordered() in preference to MFENCE_RDTSC. Since the kernel could > be running under a hypervisor that does not allow writing to that MSR, > it must be first verified that the write was successful before setting > the LFENCE_RDTSC feature. > > The following patches are included in this series: > - Make LFENCE a serializing instruction on AMD > - Use LFENCE_RDTSC in preference to MFENCE_RDTSC on AMD > > This patch series is based on tip:x86/pti. > > --- > > Changes from v1: > - Add a check verifying the MSR was actually updated > - Remove the third patch that eliminates the MFENCE_RDTSC feature > (since the feature is still needed) > - Adding Dan Williams to the cc since this will impact nospec_barrier(), > which will require an alternative_2 to add an MFENCE instruction with > an MFENCE_RDTSC check Thanks Tom, I'll include this in the next posting of the variant-1 patch series.