diff options
author | Ingo Molnar <mingo@elte.hu> | 2009-01-18 11:41:32 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-01-18 11:41:32 -0500 |
commit | 99937d6455cea95405ac681c86a857d0fcd530bd (patch) | |
tree | 5a40a9ca966e5feda1040f9ef2c7798ac4d1e234 /arch/x86/include/asm | |
parent | 74e7904559a10cbb9fbf9139c5c42fc87c0f62a4 (diff) | |
parent | 87b264065880fa696c121dad8498a60524e0f6de (diff) |
Merge branch 'tj-percpu' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/misc into core/percpu
Diffstat (limited to 'arch/x86/include/asm')
-rw-r--r-- | arch/x86/include/asm/current.h | 24 | ||||
-rw-r--r-- | arch/x86/include/asm/hardirq_64.h | 24 | ||||
-rw-r--r-- | arch/x86/include/asm/mmu_context_64.h | 16 | ||||
-rw-r--r-- | arch/x86/include/asm/page_64.h | 4 | ||||
-rw-r--r-- | arch/x86/include/asm/pda.h | 29 | ||||
-rw-r--r-- | arch/x86/include/asm/percpu.h | 26 | ||||
-rw-r--r-- | arch/x86/include/asm/processor.h | 3 | ||||
-rw-r--r-- | arch/x86/include/asm/smp.h | 4 | ||||
-rw-r--r-- | arch/x86/include/asm/system.h | 4 | ||||
-rw-r--r-- | arch/x86/include/asm/thread_info.h | 20 | ||||
-rw-r--r-- | arch/x86/include/asm/tlbflush.h | 7 | ||||
-rw-r--r-- | arch/x86/include/asm/topology.h | 3 |
12 files changed, 68 insertions, 96 deletions
diff --git a/arch/x86/include/asm/current.h b/arch/x86/include/asm/current.h index 0728480f5c56..c68c361697e1 100644 --- a/arch/x86/include/asm/current.h +++ b/arch/x86/include/asm/current.h | |||
@@ -1,39 +1,21 @@ | |||
1 | #ifndef _ASM_X86_CURRENT_H | 1 | #ifndef _ASM_X86_CURRENT_H |
2 | #define _ASM_X86_CURRENT_H | 2 | #define _ASM_X86_CURRENT_H |
3 | 3 | ||
4 | #ifdef CONFIG_X86_32 | ||
5 | #include <linux/compiler.h> | 4 | #include <linux/compiler.h> |
6 | #include <asm/percpu.h> | 5 | #include <asm/percpu.h> |
7 | 6 | ||
7 | #ifndef __ASSEMBLY__ | ||
8 | struct task_struct; | 8 | struct task_struct; |
9 | 9 | ||
10 | DECLARE_PER_CPU(struct task_struct *, current_task); | 10 | DECLARE_PER_CPU(struct task_struct *, current_task); |
11 | static __always_inline struct task_struct *get_current(void) | ||
12 | { | ||
13 | return percpu_read(current_task); | ||
14 | } | ||
15 | |||
16 | #else /* X86_32 */ | ||
17 | |||
18 | #ifndef __ASSEMBLY__ | ||
19 | #include <asm/pda.h> | ||
20 | |||
21 | struct task_struct; | ||
22 | 11 | ||
23 | static __always_inline struct task_struct *get_current(void) | 12 | static __always_inline struct task_struct *get_current(void) |
24 | { | 13 | { |
25 | return read_pda(pcurrent); | 14 | return percpu_read(current_task); |
26 | } | 15 | } |
27 | 16 | ||
28 | #else /* __ASSEMBLY__ */ | 17 | #define current get_current() |
29 | |||
30 | #include <asm/asm-offsets.h> | ||
31 | #define GET_CURRENT(reg) movq %gs:(pda_pcurrent),reg | ||
32 | 18 | ||
33 | #endif /* __ASSEMBLY__ */ | 19 | #endif /* __ASSEMBLY__ */ |
34 | 20 | ||
35 | #endif /* X86_32 */ | ||
36 | |||
37 | #define current get_current() | ||
38 | |||
39 | #endif /* _ASM_X86_CURRENT_H */ | 21 | #endif /* _ASM_X86_CURRENT_H */ |
diff --git a/arch/x86/include/asm/hardirq_64.h b/arch/x86/include/asm/hardirq_64.h index b5a6b5d56704..a65bab20f6ce 100644 --- a/arch/x86/include/asm/hardirq_64.h +++ b/arch/x86/include/asm/hardirq_64.h | |||
@@ -3,22 +3,36 @@ | |||
3 | 3 | ||
4 | #include <linux/threads.h> | 4 | #include <linux/threads.h> |
5 | #include <linux/irq.h> | 5 | #include <linux/irq.h> |
6 | #include <asm/pda.h> | ||
7 | #include <asm/apic.h> | 6 | #include <asm/apic.h> |
8 | 7 | ||
8 | typedef struct { | ||
9 | unsigned int __softirq_pending; | ||
10 | unsigned int __nmi_count; /* arch dependent */ | ||
11 | unsigned int apic_timer_irqs; /* arch dependent */ | ||
12 | unsigned int irq0_irqs; | ||
13 | unsigned int irq_resched_count; | ||
14 | unsigned int irq_call_count; | ||
15 | unsigned int irq_tlb_count; | ||
16 | unsigned int irq_thermal_count; | ||
17 | unsigned int irq_spurious_count; | ||
18 | unsigned int irq_threshold_count; | ||
19 | } ____cacheline_aligned irq_cpustat_t; | ||
20 | |||
21 | DECLARE_PER_CPU(irq_cpustat_t, irq_stat); | ||
22 | |||
9 | /* We can have at most NR_VECTORS irqs routed to a cpu at a time */ | 23 | /* We can have at most NR_VECTORS irqs routed to a cpu at a time */ |
10 | #define MAX_HARDIRQS_PER_CPU NR_VECTORS | 24 | #define MAX_HARDIRQS_PER_CPU NR_VECTORS |
11 | 25 | ||
12 | #define __ARCH_IRQ_STAT 1 | 26 | #define __ARCH_IRQ_STAT 1 |
13 | 27 | ||
14 | #define inc_irq_stat(member) add_pda(member, 1) | 28 | #define inc_irq_stat(member) percpu_add(irq_stat.member, 1) |
15 | 29 | ||
16 | #define local_softirq_pending() read_pda(__softirq_pending) | 30 | #define local_softirq_pending() percpu_read(irq_stat.__softirq_pending) |
17 | 31 | ||
18 | #define __ARCH_SET_SOFTIRQ_PENDING 1 | 32 | #define __ARCH_SET_SOFTIRQ_PENDING 1 |
19 | 33 | ||
20 | #define set_softirq_pending(x) write_pda(__softirq_pending, (x)) | 34 | #define set_softirq_pending(x) percpu_write(irq_stat.__softirq_pending, (x)) |
21 | #define or_softirq_pending(x) or_pda(__softirq_pending, (x)) | 35 | #define or_softirq_pending(x) percpu_or(irq_stat.__softirq_pending, (x)) |
22 | 36 | ||
23 | extern void ack_bad_irq(unsigned int irq); | 37 | extern void ack_bad_irq(unsigned int irq); |
24 | 38 | ||
diff --git a/arch/x86/include/asm/mmu_context_64.h b/arch/x86/include/asm/mmu_context_64.h index 677d36e9540a..c4572505ab3e 100644 --- a/arch/x86/include/asm/mmu_context_64.h +++ b/arch/x86/include/asm/mmu_context_64.h | |||
@@ -1,13 +1,11 @@ | |||
1 | #ifndef _ASM_X86_MMU_CONTEXT_64_H | 1 | #ifndef _ASM_X86_MMU_CONTEXT_64_H |
2 | #define _ASM_X86_MMU_CONTEXT_64_H | 2 | #define _ASM_X86_MMU_CONTEXT_64_H |
3 | 3 | ||
4 | #include <asm/pda.h> | ||
5 | |||
6 | static inline void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk) | 4 | static inline void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk) |
7 | { | 5 | { |
8 | #ifdef CONFIG_SMP | 6 | #ifdef CONFIG_SMP |
9 | if (read_pda(mmu_state) == TLBSTATE_OK) | 7 | if (percpu_read(cpu_tlbstate.state) == TLBSTATE_OK) |
10 | write_pda(mmu_state, TLBSTATE_LAZY); | 8 | percpu_write(cpu_tlbstate.state, TLBSTATE_LAZY); |
11 | #endif | 9 | #endif |
12 | } | 10 | } |
13 | 11 | ||
@@ -19,8 +17,8 @@ static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next, | |||
19 | /* stop flush ipis for the previous mm */ | 17 | /* stop flush ipis for the previous mm */ |
20 | cpu_clear(cpu, prev->cpu_vm_mask); | 18 | cpu_clear(cpu, prev->cpu_vm_mask); |
21 | #ifdef CONFIG_SMP | 19 | #ifdef CONFIG_SMP |
22 | write_pda(mmu_state, TLBSTATE_OK); | 20 | percpu_write(cpu_tlbstate.state, TLBSTATE_OK); |
23 | write_pda(active_mm, next); | 21 | percpu_write(cpu_tlbstate.active_mm, next); |
24 | #endif | 22 | #endif |
25 | cpu_set(cpu, next->cpu_vm_mask); | 23 | cpu_set(cpu, next->cpu_vm_mask); |
26 | load_cr3(next->pgd); | 24 | load_cr3(next->pgd); |
@@ -30,9 +28,9 @@ static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next, | |||
30 | } | 28 | } |
31 | #ifdef CONFIG_SMP | 29 | #ifdef CONFIG_SMP |
32 | else { | 30 | else { |
33 | write_pda(mmu_state, TLBSTATE_OK); | 31 | percpu_write(cpu_tlbstate.state, TLBSTATE_OK); |
34 | if (read_pda(active_mm) != next) | 32 | BUG_ON(percpu_read(cpu_tlbstate.active_mm) != next); |
35 | BUG(); | 33 | |
36 | if (!cpu_test_and_set(cpu, next->cpu_vm_mask)) { | 34 | if (!cpu_test_and_set(cpu, next->cpu_vm_mask)) { |
37 | /* We were in lazy tlb mode and leave_mm disabled | 35 | /* We were in lazy tlb mode and leave_mm disabled |
38 | * tlb flush IPI delivery. We must reload CR3 | 36 | * tlb flush IPI delivery. We must reload CR3 |
diff --git a/arch/x86/include/asm/page_64.h b/arch/x86/include/asm/page_64.h index 5ebca29f44f0..e27fdbe5f9e4 100644 --- a/arch/x86/include/asm/page_64.h +++ b/arch/x86/include/asm/page_64.h | |||
@@ -13,8 +13,8 @@ | |||
13 | #define DEBUG_STACK_ORDER (EXCEPTION_STACK_ORDER + 1) | 13 | #define DEBUG_STACK_ORDER (EXCEPTION_STACK_ORDER + 1) |
14 | #define DEBUG_STKSZ (PAGE_SIZE << DEBUG_STACK_ORDER) | 14 | #define DEBUG_STKSZ (PAGE_SIZE << DEBUG_STACK_ORDER) |
15 | 15 | ||
16 | #define IRQSTACK_ORDER 2 | 16 | #define IRQ_STACK_ORDER 2 |
17 | #define IRQSTACKSIZE (PAGE_SIZE << IRQSTACK_ORDER) | 17 | #define IRQ_STACK_SIZE (PAGE_SIZE << IRQ_STACK_ORDER) |
18 | 18 | ||
19 | #define STACKFAULT_STACK 1 | 19 | #define STACKFAULT_STACK 1 |
20 | #define DOUBLEFAULT_STACK 2 | 20 | #define DOUBLEFAULT_STACK 2 |
diff --git a/arch/x86/include/asm/pda.h b/arch/x86/include/asm/pda.h index 47f274fe6953..c31ca048a901 100644 --- a/arch/x86/include/asm/pda.h +++ b/arch/x86/include/asm/pda.h | |||
@@ -11,33 +11,18 @@ | |||
11 | 11 | ||
12 | /* Per processor datastructure. %gs points to it while the kernel runs */ | 12 | /* Per processor datastructure. %gs points to it while the kernel runs */ |
13 | struct x8664_pda { | 13 | struct x8664_pda { |
14 | struct task_struct *pcurrent; /* 0 Current process */ | 14 | unsigned long unused1; |
15 | unsigned long dummy; | 15 | unsigned long unused2; |
16 | unsigned long kernelstack; /* 16 top of kernel stack for current */ | 16 | unsigned long unused3; |
17 | unsigned long oldrsp; /* 24 user rsp for system call */ | 17 | unsigned long unused4; |
18 | int irqcount; /* 32 Irq nesting counter. Starts -1 */ | 18 | int unused5; |
19 | unsigned int cpunumber; /* 36 Logical CPU number */ | 19 | unsigned int unused6; /* 36 was cpunumber */ |
20 | #ifdef CONFIG_CC_STACKPROTECTOR | 20 | #ifdef CONFIG_CC_STACKPROTECTOR |
21 | unsigned long stack_canary; /* 40 stack canary value */ | 21 | unsigned long stack_canary; /* 40 stack canary value */ |
22 | /* gcc-ABI: this canary MUST be at | 22 | /* gcc-ABI: this canary MUST be at |
23 | offset 40!!! */ | 23 | offset 40!!! */ |
24 | #endif | 24 | #endif |
25 | char *irqstackptr; | ||
26 | short nodenumber; /* number of current node (32k max) */ | ||
27 | short in_bootmem; /* pda lives in bootmem */ | 25 | short in_bootmem; /* pda lives in bootmem */ |
28 | unsigned int __softirq_pending; | ||
29 | unsigned int __nmi_count; /* number of NMI on this CPUs */ | ||
30 | short mmu_state; | ||
31 | short isidle; | ||
32 | struct mm_struct *active_mm; | ||
33 | unsigned apic_timer_irqs; | ||
34 | unsigned irq0_irqs; | ||
35 | unsigned irq_resched_count; | ||
36 | unsigned irq_call_count; | ||
37 | unsigned irq_tlb_count; | ||
38 | unsigned irq_thermal_count; | ||
39 | unsigned irq_threshold_count; | ||
40 | unsigned irq_spurious_count; | ||
41 | } ____cacheline_aligned_in_smp; | 26 | } ____cacheline_aligned_in_smp; |
42 | 27 | ||
43 | DECLARE_PER_CPU(struct x8664_pda, __pda); | 28 | DECLARE_PER_CPU(struct x8664_pda, __pda); |
@@ -57,6 +42,4 @@ extern void pda_init(int); | |||
57 | 42 | ||
58 | #endif | 43 | #endif |
59 | 44 | ||
60 | #define PDA_STACKOFFSET (5*8) | ||
61 | |||
62 | #endif /* _ASM_X86_PDA_H */ | 45 | #endif /* _ASM_X86_PDA_H */ |
diff --git a/arch/x86/include/asm/percpu.h b/arch/x86/include/asm/percpu.h index 03aa4b00a1c3..165d5272ece1 100644 --- a/arch/x86/include/asm/percpu.h +++ b/arch/x86/include/asm/percpu.h | |||
@@ -39,10 +39,10 @@ | |||
39 | #include <linux/stringify.h> | 39 | #include <linux/stringify.h> |
40 | 40 | ||
41 | #ifdef CONFIG_SMP | 41 | #ifdef CONFIG_SMP |
42 | #define __percpu_seg_str "%%"__stringify(__percpu_seg)":" | 42 | #define __percpu_arg(x) "%%"__stringify(__percpu_seg)":%P" #x |
43 | #define __my_cpu_offset percpu_read(this_cpu_off) | 43 | #define __my_cpu_offset percpu_read(this_cpu_off) |
44 | #else | 44 | #else |
45 | #define __percpu_seg_str | 45 | #define __percpu_arg(x) "%" #x |
46 | #endif | 46 | #endif |
47 | 47 | ||
48 | /* For arch-specific code, we can use direct single-insn ops (they | 48 | /* For arch-specific code, we can use direct single-insn ops (they |
@@ -58,22 +58,22 @@ do { \ | |||
58 | } \ | 58 | } \ |
59 | switch (sizeof(var)) { \ | 59 | switch (sizeof(var)) { \ |
60 | case 1: \ | 60 | case 1: \ |
61 | asm(op "b %1,"__percpu_seg_str"%0" \ | 61 | asm(op "b %1,"__percpu_arg(0) \ |
62 | : "+m" (var) \ | 62 | : "+m" (var) \ |
63 | : "ri" ((T__)val)); \ | 63 | : "ri" ((T__)val)); \ |
64 | break; \ | 64 | break; \ |
65 | case 2: \ | 65 | case 2: \ |
66 | asm(op "w %1,"__percpu_seg_str"%0" \ | 66 | asm(op "w %1,"__percpu_arg(0) \ |
67 | : "+m" (var) \ | 67 | : "+m" (var) \ |
68 | : "ri" ((T__)val)); \ | 68 | : "ri" ((T__)val)); \ |
69 | break; \ | 69 | break; \ |
70 | case 4: \ | 70 | case 4: \ |
71 | asm(op "l %1,"__percpu_seg_str"%0" \ | 71 | asm(op "l %1,"__percpu_arg(0) \ |
72 | : "+m" (var) \ | 72 | : "+m" (var) \ |
73 | : "ri" ((T__)val)); \ | 73 | : "ri" ((T__)val)); \ |
74 | break; \ | 74 | break; \ |
75 | case 8: \ | 75 | case 8: \ |
76 | asm(op "q %1,"__percpu_seg_str"%0" \ | 76 | asm(op "q %1,"__percpu_arg(0) \ |
77 | : "+m" (var) \ | 77 | : "+m" (var) \ |
78 | : "r" ((T__)val)); \ | 78 | : "r" ((T__)val)); \ |
79 | break; \ | 79 | break; \ |
@@ -86,22 +86,22 @@ do { \ | |||
86 | typeof(var) ret__; \ | 86 | typeof(var) ret__; \ |
87 | switch (sizeof(var)) { \ | 87 | switch (sizeof(var)) { \ |
88 | case 1: \ | 88 | case 1: \ |
89 | asm(op "b "__percpu_seg_str"%1,%0" \ | 89 | asm(op "b "__percpu_arg(1)",%0" \ |
90 | : "=r" (ret__) \ | 90 | : "=r" (ret__) \ |
91 | : "m" (var)); \ | 91 | : "m" (var)); \ |
92 | break; \ | 92 | break; \ |
93 | case 2: \ | 93 | case 2: \ |
94 | asm(op "w "__percpu_seg_str"%1,%0" \ | 94 | asm(op "w "__percpu_arg(1)",%0" \ |
95 | : "=r" (ret__) \ | 95 | : "=r" (ret__) \ |
96 | : "m" (var)); \ | 96 | : "m" (var)); \ |
97 | break; \ | 97 | break; \ |
98 | case 4: \ | 98 | case 4: \ |
99 | asm(op "l "__percpu_seg_str"%1,%0" \ | 99 | asm(op "l "__percpu_arg(1)",%0" \ |
100 | : "=r" (ret__) \ | 100 | : "=r" (ret__) \ |
101 | : "m" (var)); \ | 101 | : "m" (var)); \ |
102 | break; \ | 102 | break; \ |
103 | case 8: \ | 103 | case 8: \ |
104 | asm(op "q "__percpu_seg_str"%1,%0" \ | 104 | asm(op "q "__percpu_arg(1)",%0" \ |
105 | : "=r" (ret__) \ | 105 | : "=r" (ret__) \ |
106 | : "m" (var)); \ | 106 | : "m" (var)); \ |
107 | break; \ | 107 | break; \ |
@@ -122,9 +122,9 @@ do { \ | |||
122 | #define x86_test_and_clear_bit_percpu(bit, var) \ | 122 | #define x86_test_and_clear_bit_percpu(bit, var) \ |
123 | ({ \ | 123 | ({ \ |
124 | int old__; \ | 124 | int old__; \ |
125 | asm volatile("btr %1,"__percpu_seg_str"%c2\n\tsbbl %0,%0" \ | 125 | asm volatile("btr %2,"__percpu_arg(1)"\n\tsbbl %0,%0" \ |
126 | : "=r" (old__) \ | 126 | : "=r" (old__), "+m" (per_cpu__##var) \ |
127 | : "dIr" (bit), "i" (&per_cpu__##var) : "memory"); \ | 127 | : "dIr" (bit)); \ |
128 | old__; \ | 128 | old__; \ |
129 | }) | 129 | }) |
130 | 130 | ||
diff --git a/arch/x86/include/asm/processor.h b/arch/x86/include/asm/processor.h index 091cd8855f2e..f511246fa6cd 100644 --- a/arch/x86/include/asm/processor.h +++ b/arch/x86/include/asm/processor.h | |||
@@ -378,6 +378,9 @@ union thread_xstate { | |||
378 | 378 | ||
379 | #ifdef CONFIG_X86_64 | 379 | #ifdef CONFIG_X86_64 |
380 | DECLARE_PER_CPU(struct orig_ist, orig_ist); | 380 | DECLARE_PER_CPU(struct orig_ist, orig_ist); |
381 | |||
382 | DECLARE_PER_CPU(char[IRQ_STACK_SIZE], irq_stack); | ||
383 | DECLARE_PER_CPU(char *, irq_stack_ptr); | ||
381 | #endif | 384 | #endif |
382 | 385 | ||
383 | extern void print_cpu_info(struct cpuinfo_x86 *); | 386 | extern void print_cpu_info(struct cpuinfo_x86 *); |
diff --git a/arch/x86/include/asm/smp.h b/arch/x86/include/asm/smp.h index c7bbbbe65d3f..68636e767a91 100644 --- a/arch/x86/include/asm/smp.h +++ b/arch/x86/include/asm/smp.h | |||
@@ -25,9 +25,7 @@ extern unsigned int num_processors; | |||
25 | DECLARE_PER_CPU(cpumask_t, cpu_sibling_map); | 25 | DECLARE_PER_CPU(cpumask_t, cpu_sibling_map); |
26 | DECLARE_PER_CPU(cpumask_t, cpu_core_map); | 26 | DECLARE_PER_CPU(cpumask_t, cpu_core_map); |
27 | DECLARE_PER_CPU(u16, cpu_llc_id); | 27 | DECLARE_PER_CPU(u16, cpu_llc_id); |
28 | #ifdef CONFIG_X86_32 | ||
29 | DECLARE_PER_CPU(int, cpu_number); | 28 | DECLARE_PER_CPU(int, cpu_number); |
30 | #endif | ||
31 | 29 | ||
32 | static inline struct cpumask *cpu_sibling_mask(int cpu) | 30 | static inline struct cpumask *cpu_sibling_mask(int cpu) |
33 | { | 31 | { |
@@ -164,7 +162,7 @@ extern unsigned disabled_cpus __cpuinitdata; | |||
164 | extern int safe_smp_processor_id(void); | 162 | extern int safe_smp_processor_id(void); |
165 | 163 | ||
166 | #elif defined(CONFIG_X86_64_SMP) | 164 | #elif defined(CONFIG_X86_64_SMP) |
167 | #define raw_smp_processor_id() read_pda(cpunumber) | 165 | #define raw_smp_processor_id() (percpu_read(cpu_number)) |
168 | 166 | ||
169 | #define stack_smp_processor_id() \ | 167 | #define stack_smp_processor_id() \ |
170 | ({ \ | 168 | ({ \ |
diff --git a/arch/x86/include/asm/system.h b/arch/x86/include/asm/system.h index 8e626ea33a1a..d1dc27dba36d 100644 --- a/arch/x86/include/asm/system.h +++ b/arch/x86/include/asm/system.h | |||
@@ -94,7 +94,7 @@ do { \ | |||
94 | "call __switch_to\n\t" \ | 94 | "call __switch_to\n\t" \ |
95 | ".globl thread_return\n" \ | 95 | ".globl thread_return\n" \ |
96 | "thread_return:\n\t" \ | 96 | "thread_return:\n\t" \ |
97 | "movq %%gs:%P[pda_pcurrent],%%rsi\n\t" \ | 97 | "movq "__percpu_arg([current_task])",%%rsi\n\t" \ |
98 | "movq %P[thread_info](%%rsi),%%r8\n\t" \ | 98 | "movq %P[thread_info](%%rsi),%%r8\n\t" \ |
99 | LOCK_PREFIX "btr %[tif_fork],%P[ti_flags](%%r8)\n\t" \ | 99 | LOCK_PREFIX "btr %[tif_fork],%P[ti_flags](%%r8)\n\t" \ |
100 | "movq %%rax,%%rdi\n\t" \ | 100 | "movq %%rax,%%rdi\n\t" \ |
@@ -106,7 +106,7 @@ do { \ | |||
106 | [ti_flags] "i" (offsetof(struct thread_info, flags)), \ | 106 | [ti_flags] "i" (offsetof(struct thread_info, flags)), \ |
107 | [tif_fork] "i" (TIF_FORK), \ | 107 | [tif_fork] "i" (TIF_FORK), \ |
108 | [thread_info] "i" (offsetof(struct task_struct, stack)), \ | 108 | [thread_info] "i" (offsetof(struct task_struct, stack)), \ |
109 | [pda_pcurrent] "i" (offsetof(struct x8664_pda, pcurrent)) \ | 109 | [current_task] "m" (per_cpu_var(current_task)) \ |
110 | : "memory", "cc" __EXTRA_CLOBBER) | 110 | : "memory", "cc" __EXTRA_CLOBBER) |
111 | #endif | 111 | #endif |
112 | 112 | ||
diff --git a/arch/x86/include/asm/thread_info.h b/arch/x86/include/asm/thread_info.h index 98789647baa9..b46f8ca007b5 100644 --- a/arch/x86/include/asm/thread_info.h +++ b/arch/x86/include/asm/thread_info.h | |||
@@ -194,25 +194,21 @@ static inline struct thread_info *current_thread_info(void) | |||
194 | 194 | ||
195 | #else /* X86_32 */ | 195 | #else /* X86_32 */ |
196 | 196 | ||
197 | #include <asm/pda.h> | 197 | #include <asm/percpu.h> |
198 | #define KERNEL_STACK_OFFSET (5*8) | ||
198 | 199 | ||
199 | /* | 200 | /* |
200 | * macros/functions for gaining access to the thread information structure | 201 | * macros/functions for gaining access to the thread information structure |
201 | * preempt_count needs to be 1 initially, until the scheduler is functional. | 202 | * preempt_count needs to be 1 initially, until the scheduler is functional. |
202 | */ | 203 | */ |
203 | #ifndef __ASSEMBLY__ | 204 | #ifndef __ASSEMBLY__ |
204 | static inline struct thread_info *current_thread_info(void) | 205 | DECLARE_PER_CPU(unsigned long, kernel_stack); |
205 | { | ||
206 | struct thread_info *ti; | ||
207 | ti = (void *)(read_pda(kernelstack) + PDA_STACKOFFSET - THREAD_SIZE); | ||
208 | return ti; | ||
209 | } | ||
210 | 206 | ||
211 | /* do not use in interrupt context */ | 207 | static inline struct thread_info *current_thread_info(void) |
212 | static inline struct thread_info *stack_thread_info(void) | ||
213 | { | 208 | { |
214 | struct thread_info *ti; | 209 | struct thread_info *ti; |
215 | asm("andq %%rsp,%0; " : "=r" (ti) : "0" (~(THREAD_SIZE - 1))); | 210 | ti = (void *)(percpu_read(kernel_stack) + |
211 | KERNEL_STACK_OFFSET - THREAD_SIZE); | ||
216 | return ti; | 212 | return ti; |
217 | } | 213 | } |
218 | 214 | ||
@@ -220,8 +216,8 @@ static inline struct thread_info *stack_thread_info(void) | |||
220 | 216 | ||
221 | /* how to get the thread information struct from ASM */ | 217 | /* how to get the thread information struct from ASM */ |
222 | #define GET_THREAD_INFO(reg) \ | 218 | #define GET_THREAD_INFO(reg) \ |
223 | movq %gs:pda_kernelstack,reg ; \ | 219 | movq PER_CPU_VAR(kernel_stack),reg ; \ |
224 | subq $(THREAD_SIZE-PDA_STACKOFFSET),reg | 220 | subq $(THREAD_SIZE-KERNEL_STACK_OFFSET),reg |
225 | 221 | ||
226 | #endif | 222 | #endif |
227 | 223 | ||
diff --git a/arch/x86/include/asm/tlbflush.h b/arch/x86/include/asm/tlbflush.h index 17feaa9c7e76..d3539f998f88 100644 --- a/arch/x86/include/asm/tlbflush.h +++ b/arch/x86/include/asm/tlbflush.h | |||
@@ -148,20 +148,17 @@ void native_flush_tlb_others(const struct cpumask *cpumask, | |||
148 | #define TLBSTATE_OK 1 | 148 | #define TLBSTATE_OK 1 |
149 | #define TLBSTATE_LAZY 2 | 149 | #define TLBSTATE_LAZY 2 |
150 | 150 | ||
151 | #ifdef CONFIG_X86_32 | ||
152 | struct tlb_state { | 151 | struct tlb_state { |
153 | struct mm_struct *active_mm; | 152 | struct mm_struct *active_mm; |
154 | int state; | 153 | int state; |
155 | char __cacheline_padding[L1_CACHE_BYTES-8]; | ||
156 | }; | 154 | }; |
157 | DECLARE_PER_CPU(struct tlb_state, cpu_tlbstate); | 155 | DECLARE_PER_CPU(struct tlb_state, cpu_tlbstate); |
158 | 156 | ||
159 | void reset_lazy_tlbstate(void); | ||
160 | #else | ||
161 | static inline void reset_lazy_tlbstate(void) | 157 | static inline void reset_lazy_tlbstate(void) |
162 | { | 158 | { |
159 | percpu_write(cpu_tlbstate.state, 0); | ||
160 | percpu_write(cpu_tlbstate.active_mm, &init_mm); | ||
163 | } | 161 | } |
164 | #endif | ||
165 | 162 | ||
166 | #endif /* SMP */ | 163 | #endif /* SMP */ |
167 | 164 | ||
diff --git a/arch/x86/include/asm/topology.h b/arch/x86/include/asm/topology.h index 87ca3fd86e88..ffea1fe03a99 100644 --- a/arch/x86/include/asm/topology.h +++ b/arch/x86/include/asm/topology.h | |||
@@ -83,7 +83,8 @@ extern cpumask_t *node_to_cpumask_map; | |||
83 | DECLARE_EARLY_PER_CPU(int, x86_cpu_to_node_map); | 83 | DECLARE_EARLY_PER_CPU(int, x86_cpu_to_node_map); |
84 | 84 | ||
85 | /* Returns the number of the current Node. */ | 85 | /* Returns the number of the current Node. */ |
86 | #define numa_node_id() read_pda(nodenumber) | 86 | DECLARE_PER_CPU(int, node_number); |
87 | #define numa_node_id() percpu_read(node_number) | ||
87 | 88 | ||
88 | #ifdef CONFIG_DEBUG_PER_CPU_MAPS | 89 | #ifdef CONFIG_DEBUG_PER_CPU_MAPS |
89 | extern int cpu_to_node(int cpu); | 90 | extern int cpu_to_node(int cpu); |