Commit ea927906 authored by Brian Gerst's avatar Brian Gerst Committed by Tejun Heo

x86-64: Move cpu number from PDA to per-cpu and consolidate with 32-bit.

tj: moved cpu_number definition out of CONFIG_HAVE_SETUP_PER_CPU_AREA
    for voyager.
Signed-off-by: default avatarBrian Gerst <brgerst@gmail.com>
Signed-off-by: default avatarTejun Heo <tj@kernel.org>
parent 92d65b23
...@@ -16,7 +16,7 @@ struct x8664_pda { ...@@ -16,7 +16,7 @@ struct x8664_pda {
unsigned long kernelstack; /* 16 top of kernel stack for current */ unsigned long kernelstack; /* 16 top of kernel stack for current */
unsigned long oldrsp; /* 24 user rsp for system call */ unsigned long oldrsp; /* 24 user rsp for system call */
int irqcount; /* 32 Irq nesting counter. Starts -1 */ int irqcount; /* 32 Irq nesting counter. Starts -1 */
unsigned int cpunumber; /* 36 Logical CPU number */ unsigned int unused6; /* 36 was cpunumber */
#ifdef CONFIG_CC_STACKPROTECTOR #ifdef CONFIG_CC_STACKPROTECTOR
unsigned long stack_canary; /* 40 stack canary value */ unsigned long stack_canary; /* 40 stack canary value */
/* gcc-ABI: this canary MUST be at /* gcc-ABI: this canary MUST be at
......
...@@ -25,9 +25,7 @@ extern unsigned int num_processors; ...@@ -25,9 +25,7 @@ extern unsigned int num_processors;
DECLARE_PER_CPU(cpumask_t, cpu_sibling_map); DECLARE_PER_CPU(cpumask_t, cpu_sibling_map);
DECLARE_PER_CPU(cpumask_t, cpu_core_map); DECLARE_PER_CPU(cpumask_t, cpu_core_map);
DECLARE_PER_CPU(u16, cpu_llc_id); DECLARE_PER_CPU(u16, cpu_llc_id);
#ifdef CONFIG_X86_32
DECLARE_PER_CPU(int, cpu_number); DECLARE_PER_CPU(int, cpu_number);
#endif
static inline struct cpumask *cpu_sibling_mask(int cpu) static inline struct cpumask *cpu_sibling_mask(int cpu)
{ {
...@@ -164,7 +162,7 @@ extern unsigned disabled_cpus __cpuinitdata; ...@@ -164,7 +162,7 @@ extern unsigned disabled_cpus __cpuinitdata;
extern int safe_smp_processor_id(void); extern int safe_smp_processor_id(void);
#elif defined(CONFIG_X86_64_SMP) #elif defined(CONFIG_X86_64_SMP)
#define raw_smp_processor_id() read_pda(cpunumber) #define raw_smp_processor_id() (percpu_read(cpu_number))
#define stack_smp_processor_id() \ #define stack_smp_processor_id() \
({ \ ({ \
......
...@@ -53,7 +53,6 @@ int main(void) ...@@ -53,7 +53,6 @@ int main(void)
ENTRY(oldrsp); ENTRY(oldrsp);
ENTRY(pcurrent); ENTRY(pcurrent);
ENTRY(irqcount); ENTRY(irqcount);
ENTRY(cpunumber);
DEFINE(pda_size, sizeof(struct x8664_pda)); DEFINE(pda_size, sizeof(struct x8664_pda));
BLANK(); BLANK();
#undef ENTRY #undef ENTRY
......
...@@ -899,7 +899,6 @@ void __cpuinit pda_init(int cpu) ...@@ -899,7 +899,6 @@ void __cpuinit pda_init(int cpu)
load_pda_offset(cpu); load_pda_offset(cpu);
pda->cpunumber = cpu;
pda->irqcount = -1; pda->irqcount = -1;
pda->kernelstack = (unsigned long)stack_thread_info() - pda->kernelstack = (unsigned long)stack_thread_info() -
PDA_STACKOFFSET + THREAD_SIZE; PDA_STACKOFFSET + THREAD_SIZE;
......
...@@ -66,9 +66,6 @@ asmlinkage void ret_from_fork(void) __asm__("ret_from_fork"); ...@@ -66,9 +66,6 @@ asmlinkage void ret_from_fork(void) __asm__("ret_from_fork");
DEFINE_PER_CPU(struct task_struct *, current_task) = &init_task; DEFINE_PER_CPU(struct task_struct *, current_task) = &init_task;
EXPORT_PER_CPU_SYMBOL(current_task); EXPORT_PER_CPU_SYMBOL(current_task);
DEFINE_PER_CPU(int, cpu_number);
EXPORT_PER_CPU_SYMBOL(cpu_number);
/* /*
* Return saved PC of a blocked thread. * Return saved PC of a blocked thread.
*/ */
......
...@@ -22,6 +22,15 @@ ...@@ -22,6 +22,15 @@
# define DBG(x...) # define DBG(x...)
#endif #endif
/*
* Could be inside CONFIG_HAVE_SETUP_PER_CPU_AREA with other stuff but
* voyager wants cpu_number too.
*/
#ifdef CONFIG_SMP
DEFINE_PER_CPU(int, cpu_number);
EXPORT_PER_CPU_SYMBOL(cpu_number);
#endif
#ifdef CONFIG_X86_LOCAL_APIC #ifdef CONFIG_X86_LOCAL_APIC
unsigned int num_processors; unsigned int num_processors;
unsigned disabled_cpus __cpuinitdata; unsigned disabled_cpus __cpuinitdata;
...@@ -193,6 +202,7 @@ void __init setup_per_cpu_areas(void) ...@@ -193,6 +202,7 @@ void __init setup_per_cpu_areas(void)
memcpy(ptr, __per_cpu_load, __per_cpu_end - __per_cpu_start); memcpy(ptr, __per_cpu_load, __per_cpu_end - __per_cpu_start);
per_cpu_offset(cpu) = ptr - __per_cpu_start; per_cpu_offset(cpu) = ptr - __per_cpu_start;
per_cpu(this_cpu_off, cpu) = per_cpu_offset(cpu); per_cpu(this_cpu_off, cpu) = per_cpu_offset(cpu);
per_cpu(cpu_number, cpu) = cpu;
#ifdef CONFIG_X86_64 #ifdef CONFIG_X86_64
per_cpu(irq_stack_ptr, cpu) = per_cpu(irq_stack_ptr, cpu) =
(char *)per_cpu(irq_stack, cpu) + IRQ_STACK_SIZE - 64; (char *)per_cpu(irq_stack, cpu) + IRQ_STACK_SIZE - 64;
......
...@@ -28,7 +28,5 @@ __cpuinit void init_gdt(int cpu) ...@@ -28,7 +28,5 @@ __cpuinit void init_gdt(int cpu)
write_gdt_entry(get_cpu_gdt_table(cpu), write_gdt_entry(get_cpu_gdt_table(cpu),
GDT_ENTRY_PERCPU, &gdt, DESCTYPE_S); GDT_ENTRY_PERCPU, &gdt, DESCTYPE_S);
per_cpu(cpu_number, cpu) = cpu;
} }
#endif #endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment