diff options
author | Jeremy Fitzhardinge <jeremy@goop.org> | 2008-07-08 18:06:42 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-07-16 04:58:13 -0400 |
commit | 5b09b2876ed1a8e34a0da8f069575fc6174e2077 (patch) | |
tree | 370750e5c1d4073ed4a7525ccd0348e4154ba0d4 /include | |
parent | a9e7062d7339f1a1df2b6d7e5d595c7d55b56bfb (diff) |
x86_64: add workaround for no %gs-based percpu
As a stopgap until Mike Travis's x86-64 gs-based percpu patches are
ready, provide workaround functions for x86_read/write_percpu for
Xen's use.
Specifically, this means that we can't really make use of vcpu
placement, because we can't use a single gs-based memory access to get
to vcpu fields. So disable all that for now.
Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
Cc: Stephen Tweedie <sct@redhat.com>
Cc: Eduardo Habkost <ehabkost@redhat.com>
Cc: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'include')
-rw-r--r-- | include/asm-x86/percpu.h | 26 | ||||
-rw-r--r-- | include/asm-x86/setup.h | 1 |
2 files changed, 27 insertions, 0 deletions
diff --git a/include/asm-x86/percpu.h b/include/asm-x86/percpu.h index 912a3a17b9db..4e91ee1e37aa 100644 --- a/include/asm-x86/percpu.h +++ b/include/asm-x86/percpu.h | |||
@@ -22,6 +22,32 @@ | |||
22 | 22 | ||
23 | DECLARE_PER_CPU(struct x8664_pda, pda); | 23 | DECLARE_PER_CPU(struct x8664_pda, pda); |
24 | 24 | ||
25 | /* | ||
26 | * These are supposed to be implemented as a single instruction which | ||
27 | * operates on the per-cpu data base segment. x86-64 doesn't have | ||
28 | * that yet, so this is a fairly inefficient workaround for the | ||
29 | * meantime. The single instruction is atomic with respect to | ||
30 | * preemption and interrupts, so we need to explicitly disable | ||
31 | * interrupts here to achieve the same effect. However, because it | ||
32 | * can be used from within interrupt-disable/enable, we can't actually | ||
33 | * disable interrupts; disabling preemption is enough. | ||
34 | */ | ||
35 | #define x86_read_percpu(var) \ | ||
36 | ({ \ | ||
37 | typeof(per_cpu_var(var)) __tmp; \ | ||
38 | preempt_disable(); \ | ||
39 | __tmp = __get_cpu_var(var); \ | ||
40 | preempt_enable(); \ | ||
41 | __tmp; \ | ||
42 | }) | ||
43 | |||
44 | #define x86_write_percpu(var, val) \ | ||
45 | do { \ | ||
46 | preempt_disable(); \ | ||
47 | __get_cpu_var(var) = (val); \ | ||
48 | preempt_enable(); \ | ||
49 | } while(0) | ||
50 | |||
25 | #else /* CONFIG_X86_64 */ | 51 | #else /* CONFIG_X86_64 */ |
26 | 52 | ||
27 | #ifdef __ASSEMBLY__ | 53 | #ifdef __ASSEMBLY__ |
diff --git a/include/asm-x86/setup.h b/include/asm-x86/setup.h index 90ab2225e71b..659492624e74 100644 --- a/include/asm-x86/setup.h +++ b/include/asm-x86/setup.h | |||
@@ -76,6 +76,7 @@ extern unsigned long init_pg_tables_start; | |||
76 | extern unsigned long init_pg_tables_end; | 76 | extern unsigned long init_pg_tables_end; |
77 | 77 | ||
78 | #else | 78 | #else |
79 | void __init x86_64_init_pda(void); | ||
79 | void __init x86_64_start_kernel(char *real_mode); | 80 | void __init x86_64_start_kernel(char *real_mode); |
80 | void __init x86_64_start_reservations(char *real_mode_data); | 81 | void __init x86_64_start_reservations(char *real_mode_data); |
81 | 82 | ||