You've already forked linux-apfs
mirror of
https://github.com/linux-apfs/linux-apfs.git
synced 2026-05-01 15:00:59 -07:00
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>
This commit is contained in:
committed by
Ingo Molnar
parent
a9e7062d73
commit
5b09b2876e
@@ -22,6 +22,32 @@
|
||||
|
||||
DECLARE_PER_CPU(struct x8664_pda, pda);
|
||||
|
||||
/*
|
||||
* These are supposed to be implemented as a single instruction which
|
||||
* operates on the per-cpu data base segment. x86-64 doesn't have
|
||||
* that yet, so this is a fairly inefficient workaround for the
|
||||
* meantime. The single instruction is atomic with respect to
|
||||
* preemption and interrupts, so we need to explicitly disable
|
||||
* interrupts here to achieve the same effect. However, because it
|
||||
* can be used from within interrupt-disable/enable, we can't actually
|
||||
* disable interrupts; disabling preemption is enough.
|
||||
*/
|
||||
#define x86_read_percpu(var) \
|
||||
({ \
|
||||
typeof(per_cpu_var(var)) __tmp; \
|
||||
preempt_disable(); \
|
||||
__tmp = __get_cpu_var(var); \
|
||||
preempt_enable(); \
|
||||
__tmp; \
|
||||
})
|
||||
|
||||
#define x86_write_percpu(var, val) \
|
||||
do { \
|
||||
preempt_disable(); \
|
||||
__get_cpu_var(var) = (val); \
|
||||
preempt_enable(); \
|
||||
} while(0)
|
||||
|
||||
#else /* CONFIG_X86_64 */
|
||||
|
||||
#ifdef __ASSEMBLY__
|
||||
|
||||
Reference in New Issue
Block a user