• Borislav Petkov's avatar
    x86, fpu: Use static_cpu_has_safe before alternatives · 5f8c4218
    Borislav Petkov authored
    The call stack below shows how this happens: basically eager_fpu_init()
    calls __thread_fpu_begin(current) which then does if (!use_eager_fpu()),
    which, in turn, uses static_cpu_has.
    
    And we're executing before alternatives so static_cpu_has doesn't work
    there yet.
    
    Use the safe variant in this path which becomes optimal after
    alternatives have run.
    
    WARNING: at arch/x86/kernel/cpu/common.c:1368 warn_pre_alternatives+0x1e/0x20()
    You're using static_cpu_has before alternatives have run!
    Modules linked in:
    Pid: 0, comm: swapper Not tainted 3.9.0-rc8+ #1
    Call Trace:
     warn_slowpath_common
     warn_slowpath_fmt
     ? fpu_finit
     warn_pre_alternatives
     eager_fpu_init
     fpu_init
     cpu_init
     trap_init
     start_kernel
     ? repair_env_string
     x86_64_start_reservations
     x86_64_start_kernel
    Signed-off-by: default avatarBorislav Petkov <bp@suse.de>
    Link: http://lkml.kernel.org/r/1370772454-6106-6-git-send-email-bp@alien8.deSigned-off-by: default avatarH. Peter Anvin <hpa@linux.intel.com>
    5f8c4218
fpu-internal.h 15.5 KB