Add HLE devl head file and several usages in kernel
Subsystems (2)
PATCH 1/1 Add HLE devl head file and several usages in kernel
For new Instruction Prefixes XACQUIRE and XRELEASE to enable kernel to use the new memory model that affects the critical sections with a hope to enable atomic memory concurrency in the absence of data conflicts based on description in chapter 12 of Intel SDM optimization guide. My understanding is that it can give your atomic operations some certian of relif from strictly sequentially consistent atomic semantics to acquire-release model in terms of happens-before semantic that only applies to the dependent variables.
see gcc.gnu.org/wiki/Atomic/GCCMM/AtomicSync
Signed-off-by Luming Yu <[email protected]>
Signed-off-by Andi Kleen <[email protected]>
--- arch/x86/include/asm/alternative.h | 3 + arch/x86/include/asm/atomic.h | 12 +-- arch/x86/include/asm/hle-emulation.h | 204 +++++++++++++++++++++++++++++++++++ 3 files changed, 213 insertions(+), 6 deletions(-) create mode 100644 arch/x86/include/asm/hle-emulation.h
arch/x86/include/asm/alternative.h +3 -0
@@ -6,6 +6,7 @@#include <linux/stringify.h> #include <asm/asm.h> #include <asm/ptrace.h> +#include <asm/hle-emulation.h> /* * Alternative inline assembly for SMP.
@@ -37,6 +38,8 @@ "671:"#define LOCK_PREFIX LOCK_PREFIX_HERE "\n\tlock; " +#define LOCK_PREFIXA LOCK_PREFIX_HERE __HLE_ACQUIRE "\n\tlock; " +#define LOCK_PREFIXR LOCK_PREFIX_HERE __HLE_RELEASE "\n\tlock; "#else /* ! CONFIG_SMP */ #define LOCK_PREFIX_HERE ""
arch/x86/include/asm/atomic.h +6 -6
@@ -47,7 +47,7 @@ static inline void atomic_set(atomic_t *v, int i)*/ static inline void atomic_add (int i,atomic_t *v) { - asmvolatile (LOCK_PREFIX "addl %1,%0" + asmvolatile (LOCK_PREFIXA "addl %1,%0" :"+m" (v->counter) :"ir" (i)); }
@@ -61,7 +61,7 @@ static inline void atomic_add(int i, atomic_t *v)*/ static inline void atomic_sub (int i,atomic_t *v) { - asmvolatile (LOCK_PREFIX "subl %1,%0" + asmvolatile (LOCK_PREFIXR "subl %1,%0" :"+m" (v->counter) :"ir" (i)); }
@@ -88,7 +88,7 @@ static inline int atomic_sub_and_test(int i, atomic_t *v)*/ static inline void atomic_inc (atomic_t *v) { - asmvolatile (LOCK_PREFIX "incl %0" + asmvolatile (LOCK_PREFIXA "incl %0" :"+m" (v->counter)); }
@@ -100,7 +100,7 @@ static inline void atomic_inc(atomic_t *v)*/ static inline void atomic_dec (atomic_t *v) { - asmvolatile (LOCK_PREFIX "decl %0" + asmvolatile (LOCK_PREFIXR "decl %0" :"+m" (v->counter)); }
@@ -114,7 +114,7 @@ static inline void atomic_dec(atomic_t *v)*/ static inline int atomic_dec_and_test (atomic_t *v) { -GEN_UNARY_RMWcc (LOCK_PREFIX "decl" , v->counter,"%0" ,"e" ); +GEN_UNARY_RMWcc (LOCK_PREFIXR "decl" , v->counter,"%0" ,"e" ); }/**
@@ -127,7 +127,7 @@ static inline int atomic_dec_and_test(atomic_t *v)*/ static inline int atomic_inc_and_test (atomic_t *v) { -GEN_UNARY_RMWcc (LOCK_PREFIX "incl" , v->counter,"%0" ,"e" ); +GEN_UNARY_RMWcc (LOCK_PREFIXA "incl" , v->counter,"%0" ,"e" ); }/**
arch/x86/include/asm/hle-emulation.h new file +204 -0
204 lines not on this page · raw message
Signature · 1 line
1.8.1.4