Re: [PATCH 26/35] x86/enter: Create macros to stop/restart Indirect Branch Speculation

From: Tim Chen
Date: Thu Jan 18 2018 - 14:45:00 EST


On Thu, Jan 18, 2018 at 02:48:26PM +0100, Peter Zijlstra wrote:
> From: Tim Chen <tim.c.chen@xxxxxxxxxxxxxxx>
>
> +
> +.macro STOP_IB_SPEC
> + ALTERNATIVE "jmp .Lskip_\@", "", X86_FEATURE_IBRS

Peter,

Will it be possible to use static key here like
STATIC_JUMP_IF_FALSE .Lskip_\@, specctrl_ibrs, def=0

In Thomas' original patchset, there is a specctrl_ibrs static key.

That will make a switch of static branch here easier if we want
to change it later in boot or at run time.

Tim

> + PUSH_MSR_REGS
> + WRMSR_ASM $MSR_IA32_SPEC_CTRL, $0, $SPEC_CTRL_ENABLE_IBRS
> + POP_MSR_REGS
> +.Lskip_\@:
> +.endm
> +