• Borislav Petkov's avatar
    x86: Sanity-check static_cpu_has usage · 5700f743
    Borislav Petkov authored
    static_cpu_has may be used only after alternatives have run. Before that
    it always returns false if constant folding with __builtin_constant_p()
    doesn't happen. And you don't want that.
    
    This patch is the result of me debugging an issue where I overzealously
    put static_cpu_has in code which executed before alternatives have run
    and had to spend some time with scratching head and cursing at the
    monitor.
    
    So add a jump to a warning which screams loudly when we use this
    function too early. The alternatives patch that check away in
    conjunction with patching the rest of the kernel image.
    
    [ hpa: factored this into its own configuration option.  If we want to
      have an overarching option, it should be an option which selects
      other options, not as a group option in the source code. ]
    Signed-off-by: default avatarBorislav Petkov <bp@suse.de>
    Link: http://lkml.kernel.org/r/1370772454-6106-4-git-send-email-bp@alien8.deSigned-off-by: default avatarH. Peter Anvin <hpa@linux.intel.com>
    5700f743
Kconfig.debug 9.56 KB