• Andy Lutomirski's avatar
    x86/asm/entry: Add this_cpu_sp0() to read sp0 for the current cpu · 8ef46a67
    Andy Lutomirski authored
    We currently store references to the top of the kernel stack in
    multiple places: kernel_stack (with an offset) and
    init_tss.x86_tss.sp0 (no offset).  The latter is defined by
    hardware and is a clean canonical way to find the top of the
    stack.  Add an accessor so we can start using it.
    
    This needs minor paravirt tweaks.  On native, sp0 defines the
    top of the kernel stack and is therefore always correct.  On Xen
    and lguest, the hypervisor tracks the top of the stack, but we
    want to start reading sp0 in the kernel.  Fixing this is simple:
    just update our local copy of sp0 as well as the hypervisor's
    copy on task switches.
    Signed-off-by: default avatarAndy Lutomirski <luto@amacapital.net>
    Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com>
    Cc: Borislav Petkov <bp@alien8.de>
    Cc: Denys Vlasenko <dvlasenk@redhat.com>
    Cc: H. Peter Anvin <hpa@zytor.com>
    Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
    Cc: Linus Torvalds <torvalds@linux-foundation.org>
    Cc: Oleg Nesterov <oleg@redhat.com>
    Cc: Rusty Russell <rusty@rustcorp.com.au>
    Cc: Thomas Gleixner <tglx@linutronix.de>
    Link: http://lkml.kernel.org/r/8d675581859712bee09a055ed8f785d80dac1eca.1425611534.git.luto@amacapital.netSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
    8ef46a67
enlighten.c 45.7 KB