diff options
author | Jeremy Fitzhardinge <jeremy@goop.org> | 2006-12-06 20:14:03 -0500 |
---|---|---|
committer | Andi Kleen <andi@basil.nowhere.org> | 2006-12-06 20:14:03 -0500 |
commit | b2938f880890ebfcccad356275e0000193153623 (patch) | |
tree | f2dcde93e6bd449369e4d305f081e9c12af99948 | |
parent | 49d26b6eaa8e970c8cf6e299e6ccba2474191bf5 (diff) |
[PATCH] i386: Implement smp_processor_id() with the PDA
Use the cpu_number in the PDA to implement raw_smp_processor_id. This is a
little simpler than using thread_info, though the cpu field in thread_info
cannot be removed since it is used for things other than getting the current
CPU in common code.
Signed-off-by: Jeremy Fitzhardinge <jeremy@xensource.com>
Signed-off-by: Andi Kleen <ak@suse.de>
Cc: Chuck Ebbert <76306.1226@compuserve.com>
Cc: Zachary Amsden <zach@vmware.com>
Cc: Jan Beulich <jbeulich@novell.com>
Cc: Andi Kleen <ak@suse.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
-rw-r--r-- | arch/i386/kernel/asm-offsets.c | 4 | ||||
-rw-r--r-- | arch/i386/kernel/cpu/common.c | 2 | ||||
-rw-r--r-- | arch/i386/kernel/entry.S | 3 | ||||
-rw-r--r-- | include/asm-i386/pda.h | 2 | ||||
-rw-r--r-- | include/asm-i386/smp.h | 3 |
5 files changed, 10 insertions, 4 deletions
diff --git a/arch/i386/kernel/asm-offsets.c b/arch/i386/kernel/asm-offsets.c index 9620872d3534..85f1b038e9c3 100644 --- a/arch/i386/kernel/asm-offsets.c +++ b/arch/i386/kernel/asm-offsets.c | |||
@@ -51,7 +51,6 @@ void foo(void) | |||
51 | OFFSET(TI_exec_domain, thread_info, exec_domain); | 51 | OFFSET(TI_exec_domain, thread_info, exec_domain); |
52 | OFFSET(TI_flags, thread_info, flags); | 52 | OFFSET(TI_flags, thread_info, flags); |
53 | OFFSET(TI_status, thread_info, status); | 53 | OFFSET(TI_status, thread_info, status); |
54 | OFFSET(TI_cpu, thread_info, cpu); | ||
55 | OFFSET(TI_preempt_count, thread_info, preempt_count); | 54 | OFFSET(TI_preempt_count, thread_info, preempt_count); |
56 | OFFSET(TI_addr_limit, thread_info, addr_limit); | 55 | OFFSET(TI_addr_limit, thread_info, addr_limit); |
57 | OFFSET(TI_restart_block, thread_info, restart_block); | 56 | OFFSET(TI_restart_block, thread_info, restart_block); |
@@ -97,4 +96,7 @@ void foo(void) | |||
97 | DEFINE(VDSO_PRELINK, VDSO_PRELINK); | 96 | DEFINE(VDSO_PRELINK, VDSO_PRELINK); |
98 | 97 | ||
99 | OFFSET(crypto_tfm_ctx_offset, crypto_tfm, __crt_ctx); | 98 | OFFSET(crypto_tfm_ctx_offset, crypto_tfm, __crt_ctx); |
99 | |||
100 | BLANK(); | ||
101 | OFFSET(PDA_cpu, i386_pda, cpu_number); | ||
100 | } | 102 | } |
diff --git a/arch/i386/kernel/cpu/common.c b/arch/i386/kernel/cpu/common.c index 4e63d8ce602b..e476202b887f 100644 --- a/arch/i386/kernel/cpu/common.c +++ b/arch/i386/kernel/cpu/common.c | |||
@@ -650,6 +650,7 @@ __cpuinit int alloc_gdt(int cpu) | |||
650 | /* Initial PDA used by boot CPU */ | 650 | /* Initial PDA used by boot CPU */ |
651 | struct i386_pda boot_pda = { | 651 | struct i386_pda boot_pda = { |
652 | ._pda = &boot_pda, | 652 | ._pda = &boot_pda, |
653 | .cpu_number = 0, | ||
653 | }; | 654 | }; |
654 | 655 | ||
655 | static inline void set_kernel_gs(void) | 656 | static inline void set_kernel_gs(void) |
@@ -694,6 +695,7 @@ __cpuinit int init_gdt(int cpu, struct task_struct *idle) | |||
694 | 695 | ||
695 | memset(pda, 0, sizeof(*pda)); | 696 | memset(pda, 0, sizeof(*pda)); |
696 | pda->_pda = pda; | 697 | pda->_pda = pda; |
698 | pda->cpu_number = cpu; | ||
697 | 699 | ||
698 | return 1; | 700 | return 1; |
699 | } | 701 | } |
diff --git a/arch/i386/kernel/entry.S b/arch/i386/kernel/entry.S index b99d4a160078..d7423efaeea4 100644 --- a/arch/i386/kernel/entry.S +++ b/arch/i386/kernel/entry.S | |||
@@ -524,8 +524,7 @@ syscall_badsys: | |||
524 | 524 | ||
525 | #define FIXUP_ESPFIX_STACK \ | 525 | #define FIXUP_ESPFIX_STACK \ |
526 | /* since we are on a wrong stack, we cant make it a C code :( */ \ | 526 | /* since we are on a wrong stack, we cant make it a C code :( */ \ |
527 | GET_THREAD_INFO(%ebp); \ | 527 | movl %gs:PDA_cpu, %ebx; \ |
528 | movl TI_cpu(%ebp), %ebx; \ | ||
529 | PER_CPU(cpu_gdt_descr, %ebx); \ | 528 | PER_CPU(cpu_gdt_descr, %ebx); \ |
530 | movl GDS_address(%ebx), %ebx; \ | 529 | movl GDS_address(%ebx), %ebx; \ |
531 | GET_DESC_BASE(GDT_ENTRY_ESPFIX_SS, %ebx, %eax, %ax, %al, %ah); \ | 530 | GET_DESC_BASE(GDT_ENTRY_ESPFIX_SS, %ebx, %eax, %ax, %al, %ah); \ |
diff --git a/include/asm-i386/pda.h b/include/asm-i386/pda.h index 4c39ccb1305c..f90fde22566d 100644 --- a/include/asm-i386/pda.h +++ b/include/asm-i386/pda.h | |||
@@ -11,6 +11,8 @@ | |||
11 | struct i386_pda | 11 | struct i386_pda |
12 | { | 12 | { |
13 | struct i386_pda *_pda; /* pointer to self */ | 13 | struct i386_pda *_pda; /* pointer to self */ |
14 | |||
15 | int cpu_number; | ||
14 | }; | 16 | }; |
15 | 17 | ||
16 | extern struct i386_pda *_cpu_pda[]; | 18 | extern struct i386_pda *_cpu_pda[]; |
diff --git a/include/asm-i386/smp.h b/include/asm-i386/smp.h index bd59c1508e71..64fe624c02ca 100644 --- a/include/asm-i386/smp.h +++ b/include/asm-i386/smp.h | |||
@@ -8,6 +8,7 @@ | |||
8 | #include <linux/kernel.h> | 8 | #include <linux/kernel.h> |
9 | #include <linux/threads.h> | 9 | #include <linux/threads.h> |
10 | #include <linux/cpumask.h> | 10 | #include <linux/cpumask.h> |
11 | #include <asm/pda.h> | ||
11 | #endif | 12 | #endif |
12 | 13 | ||
13 | #ifdef CONFIG_X86_LOCAL_APIC | 14 | #ifdef CONFIG_X86_LOCAL_APIC |
@@ -56,7 +57,7 @@ extern void cpu_uninit(void); | |||
56 | * from the initial startup. We map APIC_BASE very early in page_setup(), | 57 | * from the initial startup. We map APIC_BASE very early in page_setup(), |
57 | * so this is correct in the x86 case. | 58 | * so this is correct in the x86 case. |
58 | */ | 59 | */ |
59 | #define raw_smp_processor_id() (current_thread_info()->cpu) | 60 | #define raw_smp_processor_id() (read_pda(cpu_number)) |
60 | 61 | ||
61 | extern cpumask_t cpu_callout_map; | 62 | extern cpumask_t cpu_callout_map; |
62 | extern cpumask_t cpu_callin_map; | 63 | extern cpumask_t cpu_callin_map; |