ck_pr: Add basic ck_pr_rfo interface.

This leverages prefetchw that is now finally available on both AMD and Intel
processors. Additional ports coming.
ck_pring
Samy Al Bahra 10 years ago
parent dc8f36c96c
commit 1474471445

15
configure vendored

@ -103,6 +103,7 @@ generate()
-e "s#@GZIP_SUFFIX@#$GZIP_SUFFIX#g" \ -e "s#@GZIP_SUFFIX@#$GZIP_SUFFIX#g" \
-e "s#@POINTER_PACK_ENABLE@#$POINTER_PACK_ENABLE#g" \ -e "s#@POINTER_PACK_ENABLE@#$POINTER_PACK_ENABLE#g" \
-e "s#@RTM_ENABLE@#$RTM_ENABLE#g" \ -e "s#@RTM_ENABLE@#$RTM_ENABLE#g" \
-e "s#@RFO_ENABLE@#$RFO_ENABLE#g" \
-e "s#@VMA_BITS@#$VMA_BITS_R#g" \ -e "s#@VMA_BITS@#$VMA_BITS_R#g" \
-e "s#@VMA_BITS_VALUE@#$VMA_BITS_VALUE_R#g" \ -e "s#@VMA_BITS_VALUE@#$VMA_BITS_VALUE_R#g" \
-e "s#@MM@#$MM#g" \ -e "s#@MM@#$MM#g" \
@ -137,6 +138,7 @@ generate_stdout()
echo " POINTER_PACK = $POINTER_PACK_ENABLE" echo " POINTER_PACK = $POINTER_PACK_ENABLE"
echo " VMA_BITS = $VMA_BITS" echo " VMA_BITS = $VMA_BITS"
echo " MEMORY_MODEL = $MM" echo " MEMORY_MODEL = $MM"
echo " RFO = $RFO_ENABLE"
echo " RTM = $RTM_ENABLE" echo " RTM = $RTM_ENABLE"
echo echo
echo "Headers will be installed in $HEADERS" echo "Headers will be installed in $HEADERS"
@ -170,13 +172,16 @@ for option; do
echo " --mandir=N Manual pages directory (default is ${PREFIX}/man)" echo " --mandir=N Manual pages directory (default is ${PREFIX}/man)"
echo " --prefix=N Installs library files in N (default is $PREFIX)" echo " --prefix=N Installs library files in N (default is $PREFIX)"
echo echo
echo "The following options will modify code generation." echo "The following options will affect generated code."
echo " --cores=N Specify number of cores available on target machine"
echo " --enable-pointer-packing Assumes address encoding is subset of pointer range" echo " --enable-pointer-packing Assumes address encoding is subset of pointer range"
echo " --enable-rtm Enable restricted transactional memory (x86_64 only)" echo " --enable-rtm Enable restricted transactional memory (power, x86_64)"
echo " --enable-rfo Enable read-for-ownership interface (power, x86_64)"
echo " --memory-model=N Specify memory model (currently tso, pso or rmo)" echo " --memory-model=N Specify memory model (currently tso, pso or rmo)"
echo " --vma-bits=N Specify valid number of VMA bits" echo " --vma-bits=N Specify valid number of VMA bits"
echo echo
echo "The following options affect regression testing."
echo " --cores=N Specify number of cores available on target machine"
echo
echo "The following environment variables may be used:" echo "The following environment variables may be used:"
echo " CC C compiler command" echo " CC C compiler command"
echo " CFLAGS C compiler flags" echo " CFLAGS C compiler flags"
@ -212,6 +217,9 @@ for option; do
--enable-rtm) --enable-rtm)
RTM_ENABLE_SET="CK_MD_RTM_ENABLE" RTM_ENABLE_SET="CK_MD_RTM_ENABLE"
;; ;;
--enable-rfo)
RFO_ENABLE_SET="CK_MD_RFO_ENABLE"
;;
--cores=*) --cores=*)
CORES=$value CORES=$value
;; ;;
@ -272,6 +280,7 @@ MANDIR=${MANDIR:-"${PREFIX}/share/man"}
GZIP=${GZIP:-"gzip -c"} GZIP=${GZIP:-"gzip -c"}
POINTER_PACK_ENABLE=${POINTER_PACK_ENABLE:-"CK_MD_POINTER_PACK_DISABLE"} POINTER_PACK_ENABLE=${POINTER_PACK_ENABLE:-"CK_MD_POINTER_PACK_DISABLE"}
RTM_ENABLE=${RTM_ENABLE_SET:-"CK_MD_RTM_DISABLE"} RTM_ENABLE=${RTM_ENABLE_SET:-"CK_MD_RTM_DISABLE"}
RFO_ENABLE=${RFO_ENABLE_SET:-"CK_MD_RFO_DISABLE"}
VMA_BITS=${VMA_BITS:-"unknown"} VMA_BITS=${VMA_BITS:-"unknown"}
if test "$PROFILE"; then if test "$PROFILE"; then

@ -39,6 +39,10 @@
#define @RTM_ENABLE@ #define @RTM_ENABLE@
#endif /* @RTM_ENABLE@ */ #endif /* @RTM_ENABLE@ */
#ifndef @RFO_ENABLE@
#define @RFO_ENABLE@
#endif /* @RFO_ENABLE@ */
#ifndef @POINTER_PACK_ENABLE@ #ifndef @POINTER_PACK_ENABLE@
#define @POINTER_PACK_ENABLE@ #define @POINTER_PACK_ENABLE@
#endif /* @POINTER_PACK_ENABLE@ */ #endif /* @POINTER_PACK_ENABLE@ */

@ -138,6 +138,17 @@ CK_PR_FENCE_NOOP(release)
#undef CK_PR_FENCE_EMIT #undef CK_PR_FENCE_EMIT
#undef CK_PR_FENCE_NOOP #undef CK_PR_FENCE_NOOP
#ifndef CK_F_PR_RFO
#define CK_F_PR_RFO
CK_CC_INLINE static void
ck_pr_rfo(const void *m)
{
(void)m;
return;
}
#endif /* CK_F_PR_RFO */
#define CK_PR_BIN(K, S, M, T, P, C) \ #define CK_PR_BIN(K, S, M, T, P, C) \
CK_CC_INLINE static void \ CK_CC_INLINE static void \
ck_pr_##K##_##S(M *target, T value) \ ck_pr_##K##_##S(M *target, T value) \

@ -91,6 +91,26 @@ CK_PR_FENCE(acquire, "mfence")
#undef CK_PR_FENCE #undef CK_PR_FENCE
/*
* Read for ownership. Older compilers will generate the 32-bit
* 3DNow! variant which is binary compatible with x86-64 variant
* of prefetchw.
*/
#ifdef CK_MD_RFO_ENABLE
#define CK_F_PR_RFO
CK_CC_INLINE static void
ck_pr_rfo(const void *m)
{
__asm__ __volatile__("prefetchw (%0)"
:
: "r" (m)
: "memory");
return;
}
#endif /* CD_MD_PREFETCHW_ENABLE */
/* /*
* Atomic fetch-and-store operations. * Atomic fetch-and-store operations.
*/ */

Loading…
Cancel
Save