On Wed, Dec 05, 2018 at 02:49:28PM -0500, Waiman Long wrote:
> Since conditional STIBP is the default, it should be treated as
> the likely case. Changes the use of static_branch_unlikely() to
> static_branch_likely() for switch_to_cond_stibp.

So now you're making kernels on 'fixed' or unaffected hardware slower.

> Signed-off-by: Waiman Long <long...@redhat.com>
> ---
>  arch/x86/kernel/cpu/bugs.c | 2 +-
>  arch/x86/kernel/process.c  | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/x86/kernel/cpu/bugs.c b/arch/x86/kernel/cpu/bugs.c
> index a68b32c..bd11119 100644
> --- a/arch/x86/kernel/cpu/bugs.c
> +++ b/arch/x86/kernel/cpu/bugs.c
> @@ -153,7 +153,7 @@ void __init check_bugs(void)
>                       hostval |= ssbd_tif_to_spec_ctrl(ti->flags);
>  
>               /* Conditional STIBP enabled? */
> -             if (static_branch_unlikely(&switch_to_cond_stibp))
> +             if (static_branch_likely(&switch_to_cond_stibp))
>                       hostval |= stibp_tif_to_spec_ctrl(ti->flags);
>  
>               if (hostval != guestval) {
> diff --git a/arch/x86/kernel/process.c b/arch/x86/kernel/process.c
> index 7d31192..39a21ae 100644
> --- a/arch/x86/kernel/process.c
> +++ b/arch/x86/kernel/process.c
> @@ -434,7 +434,7 @@ static __always_inline void 
> __speculation_ctrl_update(unsigned long tifp,
>        * otherwise avoid the MSR write.
>        */
>       if (IS_ENABLED(CONFIG_SMP) &&
> -         static_branch_unlikely(&switch_to_cond_stibp)) {
> +         static_branch_likely(&switch_to_cond_stibp)) {
>               updmsr |= !!(tif_diff & _TIF_SPEC_IB);
>               msr |= stibp_tif_to_spec_ctrl(tifn);
>       }
> -- 
> 1.8.3.1
> 

Reply via email to