• Borislav Petkov's avatar
    x86/cpufeature: Speed up cpu_feature_enabled() · f2cc8e07
    Borislav Petkov authored
    When GCC cannot do constant folding for this macro, it falls back to
    cpu_has(). But static_cpu_has() is optimal and it works at all times
    now. So use it and speedup the fallback case.
    
    Before we had this:
    
      mov    0x99d674(%rip),%rdx        # ffffffff81b0d9f4 <boot_cpu_data+0x34>
      shr    $0x2e,%rdx
      and    $0x1,%edx
      jne    ffffffff811704e9 <do_munmap+0x3f9>
    
    After alternatives patching, it turns into:
    
    		  jmp    0xffffffff81170390
    		  nopl   (%rax)
    		  ...
    		  callq  ffffffff81056e00 <mpx_notify_unmap>
    ffffffff81170390: mov    0x170(%r12),%rdi
    Signed-off-by: default avatarBorislav Petkov <bp@suse.de>
    Cc: Joerg Roedel <joro@8bytes.org>
    Cc: Linus Torvalds <torvalds@linux-foundation.org>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Thomas Gleixner <tglx@linutronix.de>
    Link: http://lkml.kernel.org/r/1455578358-28347-1-git-send-email-bp@alien8.deSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
    f2cc8e07
cpufeature.h 7.13 KB