Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753633AbeADWyd (ORCPT + 1 other); Thu, 4 Jan 2018 17:54:33 -0500 Received: from merlin.infradead.org ([205.233.59.134]:55060 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753240AbeADWyb (ORCPT ); Thu, 4 Jan 2018 17:54:31 -0500 Date: Thu, 4 Jan 2018 23:54:22 +0100 From: Peter Zijlstra To: Tim Chen Cc: Thomas Gleixner , Andy Lutomirski , Linus Torvalds , Greg KH , Dave Hansen , Andrea Arcangeli , Andi Kleen , Arjan Van De Ven , linux-kernel@vger.kernel.org Subject: Re: [PATCH 6/7] x86/spec_ctrl: Add sysctl knobs to enable/disable SPEC_CTRL feature Message-ID: <20180104225422.GG32035@hirez.programming.kicks-ass.net> References: <4d4b3752e8e533201c6983d8473eea95c747ea33.1515086770.git.tim.c.chen@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4d4b3752e8e533201c6983d8473eea95c747ea33.1515086770.git.tim.c.chen@linux.intel.com> User-Agent: Mutt/1.9.2 (2017-12-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: On Thu, Jan 04, 2018 at 09:56:47AM -0800, Tim Chen wrote: > .macro ENABLE_IBRS > - ALTERNATIVE "jmp 10f", "", X86_FEATURE_SPEC_CTRL > + testl $SPEC_CTRL_IBRS_INUSE, spec_ctrl_ibrs > + jz .Lskip_\@ > + > PUSH_MSR_REGS > WRMSR_ASM $MSR_IA32_SPEC_CTRL, $SPEC_CTRL_FEATURE_ENABLE_IBRS > POP_MSR_REGS > -10: > + > + jmp .Ldone_\@ > +.Lskip_\@: > + /* > + * prevent speculation beyond here as we could want to > + * stop speculation by enabling IBRS > + */ > + lfence > +.Ldone_\@: > .endm Yeah no. We have jump labels for this stuff. There is no reason what so ever to do dynamic tests for a variable that _never_ changes.