• Andy Lutomirski's avatar
    x86/asm: Rewrite sync_core() to use IRET-to-self · c198b121
    Andy Lutomirski authored
    Aside from being excessively slow, CPUID is problematic: Linux runs
    on a handful of CPUs that don't have CPUID.  Use IRET-to-self
    instead.  IRET-to-self works everywhere, so it makes testing easy.
    
    For reference, On my laptop, IRET-to-self is ~110ns,
    CPUID(eax=1, ecx=0) is ~83ns on native and very very slow under KVM,
    and MOV-to-CR2 is ~42ns.
    
    While we're at it: sync_core() serves a very specific purpose.
    Document it.
    Signed-off-by: default avatarAndy Lutomirski <luto@kernel.org>
    Cc: Juergen Gross <jgross@suse.com>
    Cc: One Thousand Gnomes <gnomes@lxorguk.ukuu.org.uk>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Brian Gerst <brgerst@gmail.com>
    Cc: Matthew Whitehead <tedheadster@gmail.com>
    Cc: Borislav Petkov <bp@alien8.de>
    Cc: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
    Cc: Andrew Cooper <andrew.cooper3@citrix.com>
    Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com>
    Cc: xen-devel <Xen-devel@lists.xen.org>
    Link: http://lkml.kernel.org/r/5c79f0225f68bc8c40335612bf624511abb78941.1481307769.git.luto@kernel.orgSigned-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
    c198b121
processor.h 22.6 KB