Re: [RFC 1/3] x86: Add this_cpu_sp0() to read sp0 for the current cpu

From: Ingo Molnar
Date: Wed Mar 04 2015 - 03:02:37 EST



* Andy Lutomirski <luto@xxxxxxxxxxxxxx> wrote:

> 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

Btw., 'per_cpu(init_tss)' is a somewhat misleading name these days, as
there's nothing 'init' about it anymore - we load it during CPU init
and then manually maintain its contents. A better name would be
'current_tss' - referring to both the current CPU and the current
task?

> This needs minor paravirt tweaks to ensure that On native, sp0

nit: s/On/on/

> defines the top of the kernel stack. On Xen and lguest, the
> hypervisor tracks it, 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.

Thanks,

Ingo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/