On Fri, 16 Nov 2018, Tim Chen wrote:
> In later code, STIBP will be turned on/off in the context switch code
> path when SMT is enabled.  Checks for SMT is best
> avoided on such hot paths.
> 
> Create cpu_smt_enabled static key to turn on such SMT specific code
> statically.
> 
> This key is set in code under hot plug, so it is limited in
> scope to architecture supporting CPU hotplug, like x86.

The key is enabled by default and its scope has nothing to do with CPU
hotplug. It depends on CONFIG_HOTPLUG_SMT which is the extra SMT control
code which is currently only enabled on x86.

> diff --git a/include/linux/cpu.h b/include/linux/cpu.h
> index 218df7f..b54f085 100644
> --- a/include/linux/cpu.h
> +++ b/include/linux/cpu.h
> @@ -188,5 +188,6 @@ static inline void cpu_smt_disable(bool force) { }
>  static inline void cpu_smt_check_topology_early(void) { }
>  static inline void cpu_smt_check_topology(void) { }
>  #endif
> +DECLARE_STATIC_KEY_TRUE(cpu_smt_enabled);

And here it is declared unconditionally which allows code to use it despite
CONFIG_HOTPLUG_SMT=n and subsequently breaks the build.
  
Thanks,

        tglx

Reply via email to