[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20180104221645.GC32035@hirez.programming.kicks-ass.net>
Date: Thu, 4 Jan 2018 23:16:45 +0100
From: Peter Zijlstra <peterz@...radead.org>
To: Tim Chen <tim.c.chen@...ux.intel.com>
Cc: Thomas Gleixner <tglx@...utronix.de>,
Andy Lutomirski <luto@...nel.org>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Greg KH <gregkh@...uxfoundation.org>,
Dave Hansen <dave.hansen@...el.com>,
Andrea Arcangeli <aarcange@...hat.com>,
Andi Kleen <ak@...ux.intel.com>,
Arjan Van De Ven <arjan.van.de.ven@...el.com>,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH 2/7] x86/enter: MACROS to set/clear IBRS
On Thu, Jan 04, 2018 at 09:56:43AM -0800, Tim Chen wrote:
> diff --git a/arch/x86/include/asm/spec_ctrl.h b/arch/x86/include/asm/spec_ctrl.h
> new file mode 100644
> index 0000000..16fc4f58
> --- /dev/null
> +++ b/arch/x86/include/asm/spec_ctrl.h
Does this really have to live outside of arch/x86/entry/ ?
> +.macro ENABLE_IBRS
> + ALTERNATIVE "jmp 10f", "", X86_FEATURE_SPEC_CTRL
> + PUSH_MSR_REGS
> + WRMSR_ASM $MSR_IA32_SPEC_CTRL, $SPEC_CTRL_FEATURE_ENABLE_IBRS
> + POP_MSR_REGS
> +10:
> +.endm
> +
> +.macro DISABLE_IBRS
> + ALTERNATIVE "jmp 10f", "", X86_FEATURE_SPEC_CTRL
> + PUSH_MSR_REGS
> + WRMSR_ASM $MSR_IA32_SPEC_CTRL, $SPEC_CTRL_FEATURE_DISABLE_IBRS
> + POP_MSR_REGS
> +10:
> +.endm
> +
> +.macro ENABLE_IBRS_CLOBBER
> + ALTERNATIVE "jmp 10f", "", X86_FEATURE_SPEC_CTRL
> + WRMSR_ASM $MSR_IA32_SPEC_CTRL, $SPEC_CTRL_FEATURE_ENABLE_IBRS
> +10:
> +.endm
> +
> +.macro DISABLE_IBRS_CLOBBER
> + ALTERNATIVE "jmp 10f", "", X86_FEATURE_SPEC_CTRL
> + WRMSR_ASM $MSR_IA32_SPEC_CTRL, $SPEC_CTRL_FEATURE_DISABLE_IBRS
> +10:
> +.endm
> +
> +.macro ENABLE_IBRS_SAVE_AND_CLOBBER save_reg:req
> + ALTERNATIVE "jmp 10f", "", X86_FEATURE_SPEC_CTRL
> + movl $MSR_IA32_SPEC_CTRL, %ecx
> + rdmsr
> + movl %eax, \save_reg
> +
> + movl $0, %edx
> + movl $SPEC_CTRL_FEATURE_ENABLE_IBRS, %eax
> + wrmsr
> +10:
> +.endm
> +
> +.macro RESTORE_IBRS_CLOBBER save_reg:req
> + ALTERNATIVE "jmp 10f", "", X86_FEATURE_SPEC_CTRL
> + /* Set IBRS to the value saved in the save_reg */
> + movl $MSR_IA32_SPEC_CTRL, %ecx
> + movl $0, %edx
whitespace damage
> + movl \save_reg, %eax
> + wrmsr
> +10:
> +.endm
Should not all those 10 things look like .Ldone_\@ or something ?
Powered by blists - more mailing lists