x86/smpboot: Write the top-of-stack block in cpu_smpboot_alloc()

This allows the AP boot assembly use per-cpu variables, and brings the
semantics closer to that of the BSP, which can use per-cpu variables from the
start of day.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
This commit is contained in:
Andrew Cooper committed 2020-05-05 20:18:19 +01:00
1 parent 2e3d87cc73
commit 434596bbd4
2 files changed
+6 -6

No files matched your search

+6 -1
View File
@@ -329,7 +329,6 @@ void start_secondary(void *unused)
/* Critical region without IDT or TSS. Any fault is deadly! */
set_processor_id(cpu);
set_current(idle_vcpu[cpu]);
this_cpu(curr_vcpu) = idle_vcpu[cpu];
rdmsrl(MSR_EFER, this_cpu(efer));
@@ -986,6 +985,7 @@ static void cpu_smpboot_free(unsigned int cpu, bool remove)
static int cpu_smpboot_alloc(unsigned int cpu)
{
struct cpu_info *info;
unsigned int i, memflags = 0;
nodeid_t node = cpu_to_node(cpu);
seg_desc_t *gdt;
@@ -999,6 +999,11 @@ static int cpu_smpboot_alloc(unsigned int cpu)
stack_base[cpu] = alloc_xenheap_pages(STACK_ORDER, memflags);
if ( stack_base[cpu] == NULL )
goto out;
info = get_cpu_info_from_stack((unsigned long)stack_base[cpu]);
info->processor_id = cpu;
info->per_cpu_offset = __per_cpu_offset[cpu];
memguard_guard_stack(stack_base[cpu]);
gdt = per_cpu(gdt, cpu) ?: alloc_xenheap_pages(0, memflags);
-5
View File
@@ -100,11 +100,6 @@ static inline struct cpu_info *get_cpu_info(void)
#define current (get_current())
#define get_processor_id() (get_cpu_info()->processor_id)
#define set_processor_id(id) do { \
struct cpu_info *ci__ = get_cpu_info(); \
ci__->per_cpu_offset = __per_cpu_offset[ci__->processor_id = (id)]; \
} while (0)
#define guest_cpu_user_regs() (&get_cpu_info()->guest_cpu_user_regs)
/*
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.