Commit 22e5231f authored by Ondřej Surý's avatar Ondřej Surý

Remove ISC_PLATFORM_BUSYWAITNOP in favour of direct isc_rwlock_pause() define

parent 376bea8b
...@@ -706,7 +706,6 @@ DNSTAPSRCS ...@@ -706,7 +706,6 @@ DNSTAPSRCS
DNSTAP DNSTAP
FSTRM_CAPTURE FSTRM_CAPTURE
PROTOC_C PROTOC_C
ISC_PLATFORM_BUSYWAITNOP
ISC_PLATFORM_HAVEIFNAMETOINDEX ISC_PLATFORM_HAVEIFNAMETOINDEX
ISC_PLATFORM_HAVESTRINGSH ISC_PLATFORM_HAVESTRINGSH
IRS_PLATFORM_USEDECLSPEC IRS_PLATFORM_USEDECLSPEC
...@@ -18461,112 +18460,6 @@ $as_echo "#define HAVE_BUILTIN_CLZ 1" >>confdefs.h ...@@ -18461,112 +18460,6 @@ $as_echo "#define HAVE_BUILTIN_CLZ 1" >>confdefs.h
fi fi
#
# CPU relax (for spin locks)
#
case "$host" in
i[3456]86-*)
# x86_32
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if asm(\"rep; nop\"); works" >&5
$as_echo_n "checking if asm(\"rep; nop\"); works... " >&6; }
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main ()
{
asm("rep; nop");
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
ISC_PLATFORM_BUSYWAITNOP="#define ISC_PLATFORM_BUSYWAITNOP asm(\"rep; nop\")"
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
;;
x86_64-*|amd64-*)
# x86_64
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if asm(\"rep; nop\"); works" >&5
$as_echo_n "checking if asm(\"rep; nop\"); works... " >&6; }
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main ()
{
asm("rep; nop");
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
ISC_PLATFORM_BUSYWAITNOP="#define ISC_PLATFORM_BUSYWAITNOP asm(\"rep; nop\")"
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
;;
ia64-*)
# ia64
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if asm(\"hint @pause\"); works" >&5
$as_echo_n "checking if asm(\"hint @pause\"); works... " >&6; }
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main ()
{
asm("hint @pause");
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
ISC_PLATFORM_BUSYWAITNOP="#define ISC_PLATFORM_BUSYWAITNOP asm(\"hint @pause\")"
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
;;
sparc-*)
# sparc
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if cpu_relax(); or __cpu_relax(); works" >&5
$as_echo_n "checking if cpu_relax(); or __cpu_relax(); works... " >&6; }
ac_fn_c_check_func "$LINENO" "cpu_relax" "ac_cv_func_cpu_relax"
if test "x$ac_cv_func_cpu_relax" = xyes; then :
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
ISC_PLATFORM_BUSYWAITNOP="#define ISC_PLATFORM_BUSYWAITNOP cpu_relax()"
else
ac_fn_c_check_func "$LINENO" "__cpu_relax" "ac_cv_func___cpu_relax"
if test "x$ac_cv_func___cpu_relax" = xyes; then :
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
ISC_PLATFORM_BUSYWAITNOP="#define ISC_PLATFORM_BUSYWAITNOP __cpu_relax()"
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
fi
;;
esac
# #
# Activate "rrset-order fixed" or not? # Activate "rrset-order fixed" or not?
# #
......
...@@ -2275,55 +2275,6 @@ if test "yes" = "$have_builtin_clz"; then ...@@ -2275,55 +2275,6 @@ if test "yes" = "$have_builtin_clz"; then
AC_DEFINE(HAVE_BUILTIN_CLZ, 1, [Define to 1 if the compiler supports __builtin_clz.]) AC_DEFINE(HAVE_BUILTIN_CLZ, 1, [Define to 1 if the compiler supports __builtin_clz.])
fi fi
#
# CPU relax (for spin locks)
#
case "$host" in
[i[3456]86-*])
# x86_32
AC_MSG_CHECKING([if asm("rep; nop"); works])
AC_TRY_COMPILE(,[asm("rep; nop");],
[AC_MSG_RESULT(yes)
ISC_PLATFORM_BUSYWAITNOP="#define ISC_PLATFORM_BUSYWAITNOP asm(\"rep; nop\")"],
[AC_MSG_RESULT(no)],
[AC_MSG_RESULT([cross compile, assume yes])
ISC_PLATFORM_BUSYWAITNOP="#define ISC_PLATFORM_BUSYWAITNOP asm(\"rep; nop\")"])
;;
x86_64-*|amd64-*)
# x86_64
AC_MSG_CHECKING([if asm("rep; nop"); works])
AC_TRY_COMPILE(,[asm("rep; nop");],
[AC_MSG_RESULT(yes)
ISC_PLATFORM_BUSYWAITNOP="#define ISC_PLATFORM_BUSYWAITNOP asm(\"rep; nop\")"],
[AC_MSG_RESULT(no)],
[AC_MSG_RESULT([cross compile, assume yes])
ISC_PLATFORM_BUSYWAITNOP="#define ISC_PLATFORM_BUSYWAITNOP asm(\"rep; nop\")"])
;;
ia64-*)
# ia64
AC_MSG_CHECKING([if asm("hint @pause"); works])
AC_TRY_COMPILE(,[asm("hint @pause");],
[AC_MSG_RESULT(yes)
ISC_PLATFORM_BUSYWAITNOP="#define ISC_PLATFORM_BUSYWAITNOP asm(\"hint @pause\")"],
[AC_MSG_RESULT(no)],
[AC_MSG_RESULT([cross compile, assume yes])
ISC_PLATFORM_BUSYWAITNOP="#define ISC_PLATFORM_BUSYWAITNOP asm(\"hint @pause\")"])
;;
sparc-*)
# sparc
AC_MSG_CHECKING([if cpu_relax(); or __cpu_relax(); works])
AC_CHECK_FUNC(cpu_relax,
[AC_MSG_RESULT(yes)
ISC_PLATFORM_BUSYWAITNOP="#define ISC_PLATFORM_BUSYWAITNOP cpu_relax()"],
[AC_CHECK_FUNC(__cpu_relax,
[AC_MSG_RESULT(yes)
ISC_PLATFORM_BUSYWAITNOP="#define ISC_PLATFORM_BUSYWAITNOP __cpu_relax()"],
[AC_MSG_RESULT(no)])])
;;
esac
AC_SUBST(ISC_PLATFORM_BUSYWAITNOP)
# #
# Activate "rrset-order fixed" or not? # Activate "rrset-order fixed" or not?
# #
......
...@@ -134,11 +134,6 @@ ...@@ -134,11 +134,6 @@
*/ */
@ISC_PLATFORM_HAVESYSUNH@ @ISC_PLATFORM_HAVESYSUNH@
/*
* Define with the busy wait nop asm or function call.
*/
@ISC_PLATFORM_BUSYWAITNOP@
/* /*
* Define if the platform has <strings.h>. * Define if the platform has <strings.h>.
*/ */
......
...@@ -41,6 +41,25 @@ ...@@ -41,6 +41,25 @@
#define RWLOCK_MAX_ADAPTIVE_COUNT 100 #define RWLOCK_MAX_ADAPTIVE_COUNT 100
#endif #endif
#if defined(_MSC_VER)
# include <intrin.h>
# define isc_rwlock_pause() YieldProcessor()
#elif defined(__x86_64__) || defined(__i386__)
# include <immintrin.h>
# define isc_rwlock_pause() _mm_pause()
#elif defined(__ia64__)
# define isc_rwlock_pause() __asm__ __volatile__ ("hint @pause")
#elif defined(__arm__)
# define isc_rwlock_pause() __asm__ __volatile__ ("yield")
#elif defined(__sparc) || defined(__sparc__)
# define plasma_spin_pause() __asm__ __volatile__ ("pause")
#elif defined(__ppc__) || defined(_ARCH_PPC) || \
defined(_ARCH_PWR) || defined(_ARCH_PWR2) || defined(_POWER)
# define isc_rwlock_pause() __asm__ volatile ("or 27,27,27")
#else
# define isc_rwlock_pause()
#endif
static isc_result_t static isc_result_t
isc__rwlock_lock(isc_rwlock_t *rwl, isc_rwlocktype_t type); isc__rwlock_lock(isc_rwlock_t *rwl, isc_rwlocktype_t type);
...@@ -350,9 +369,7 @@ isc_rwlock_lock(isc_rwlock_t *rwl, isc_rwlocktype_t type) { ...@@ -350,9 +369,7 @@ isc_rwlock_lock(isc_rwlock_t *rwl, isc_rwlocktype_t type) {
result = isc__rwlock_lock(rwl, type); result = isc__rwlock_lock(rwl, type);
break; break;
} }
#ifdef ISC_PLATFORM_BUSYWAITNOP isc_rwlock_pause();
ISC_PLATFORM_BUSYWAITNOP;
#endif
} while (isc_rwlock_trylock(rwl, type) != ISC_R_SUCCESS); } while (isc_rwlock_trylock(rwl, type) != ISC_R_SUCCESS);
rwl->spins += (cnt - rwl->spins) / 8; rwl->spins += (cnt - rwl->spins) / 8;
......
...@@ -46,22 +46,14 @@ ...@@ -46,22 +46,14 @@
#undef MSG_TRUNC #undef MSG_TRUNC
#define ISC_PLATFORM_NEEDSTRSEP
#define ISC_PLATFORM_NEEDSTRLCPY #define ISC_PLATFORM_NEEDSTRLCPY
#define ISC_PLATFORM_NEEDSTRLCAT #define ISC_PLATFORM_NEEDSTRLCAT
#define ISC_PLATFORM_NEEDSTRLCPY
/* /*
* Used to control how extern data is linked; needed for Win32 platforms. * Used to control how extern data is linked; needed for Win32 platforms.
*/ */
#define ISC_PLATFORM_USEDECLSPEC 1 #define ISC_PLATFORM_USEDECLSPEC 1
/*
* Define this here for now as winsock2.h defines h_errno
* and we don't want to redeclare it.
*/
#define ISC_PLATFORM_NONSTDHERRNO
/* /*
* Define if the platform has <sys/un.h>. * Define if the platform has <sys/un.h>.
*/ */
...@@ -73,35 +65,6 @@ ...@@ -73,35 +65,6 @@
#define ISC_PLATFORM_NORETURN_PRE __declspec(noreturn) #define ISC_PLATFORM_NORETURN_PRE __declspec(noreturn)
#define ISC_PLATFORM_NORETURN_POST #define ISC_PLATFORM_NORETURN_POST
/*
* If the "xadd" operation is available on this architecture,
* ISC_PLATFORM_HAVEXADD will be defined.
*/
@ISC_PLATFORM_HAVEXADD@
/*
* If the "xaddq" operation (64bit xadd) is available on this architecture,
* ISC_PLATFORM_HAVEXADDQ will be defined.
*/
@ISC_PLATFORM_HAVEXADDQ@
/*
* If the "atomic swap" operation is available on this architecture,
* ISC_PLATFORM_HAVEATOMICSTORE" will be defined.
*/
@ISC_PLATFORM_HAVEATOMICSTORE@
/*
* If the "compare-and-exchange" operation is available on this architecture,
* ISC_PLATFORM_HAVECMPXCHG will be defined.
*/
@ISC_PLATFORM_HAVECMPXCHG@
/*
* Define with the busy wait nop asm or function call.
*/
@ISC_PLATFORM_BUSYWAITNOP@
/* /*
* If the strcasestr() operation is not available on this platform, * If the strcasestr() operation is not available on this platform,
* ISC_PLATFORM_NEEDSTRCASESTR will be defined. * ISC_PLATFORM_NEEDSTRCASESTR will be defined.
......
...@@ -220,19 +220,14 @@ my @substdefh = ("AES_CC", ...@@ -220,19 +220,14 @@ my @substdefh = ("AES_CC",
"TUNE_LARGE", "TUNE_LARGE",
"WANT_QUERYTRACE", "WANT_QUERYTRACE",
"WITH_IDN", "WITH_IDN",
"CPU_RELAX",
"VALIDATION_DEFAULT"); "VALIDATION_DEFAULT");
# for platform.h # for platform.h
my %configdefp; my %configdefp;
my @substdefp = ("ISC_PLATFORM_BUSYWAITNOP", my @substdefp = ("ISC_PLATFORM_NEEDSTRCASESTR");
"ISC_PLATFORM_HAVEATOMICSTORE",
"ISC_PLATFORM_HAVEATOMICSTOREQ",
"ISC_PLATFORM_HAVECMPXCHG",
"ISC_PLATFORM_HAVEXADD",
"ISC_PLATFORM_HAVEXADDQ",
"ISC_PLATFORM_NEEDSTRCASESTR");
# for conf.sh # for conf.sh
...@@ -576,13 +571,11 @@ if (($want_win32 eq "yes") && ($want_x64 eq "yes")) { ...@@ -576,13 +571,11 @@ if (($want_win32 eq "yes") && ($want_x64 eq "yes")) {
$configvar{"BUILD_PLATFORM"} = "Win32"; $configvar{"BUILD_PLATFORM"} = "Win32";
$configvar{"MACHINE"} = "/machine:X86"; $configvar{"MACHINE"} = "/machine:X86";
$configvar{"BUILD_MACHINE"} = "/machine:X86"; $configvar{"BUILD_MACHINE"} = "/machine:X86";
$configdefp{"ISC_PLATFORM_BUSYWAITNOP"} = "__asm { rep nop }";
} elsif ($want_x64 eq "yes") { } elsif ($want_x64 eq "yes") {
$configvar{"PLATFORM"} = "x64"; $configvar{"PLATFORM"} = "x64";
$configvar{"BUILD_PLATFORM"} = "x64"; $configvar{"BUILD_PLATFORM"} = "x64";
$configvar{"MACHINE"} = "/machine:X64"; $configvar{"MACHINE"} = "/machine:X64";
$configvar{"BUILD_MACHINE"} = "/machine:X64"; $configvar{"BUILD_MACHINE"} = "/machine:X64";
$configdefp{"ISC_PLATFORM_BUSYWAITNOP"} = "_mm_pause()";
} }
# Standard configure variable # Standard configure variable
$configvar{"EXEEXT"} = ".exe"; $configvar{"EXEEXT"} = ".exe";
...@@ -1231,22 +1224,6 @@ EOF ...@@ -1231,22 +1224,6 @@ EOF
# Process arguments # Process arguments
# enable-intrinsics
if ($enable_intrinsics eq "yes") {
$configcond{"ATOMIC"} = 1;
$configvar{"INTRINSIC"} = "true";
$configvar{"COPTI"} = "/Oi";
$configdefp{"ISC_PLATFORM_HAVEXADD"} = 1;
if ($want_x64 eq "yes") {
$configdefp{"ISC_PLATFORM_HAVEXADDQ"} = 1;
$configdefp{"ISC_PLATFORM_HAVEATOMICSTOREQ"} = 1;
}
$configdefp{"ISC_PLATFORM_HAVEATOMICSTORE"} = 1;
$configdefp{"ISC_PLATFORM_HAVECMPXCHG"} = 1;
} else {
$configvar{"INTRINSIC"} = "false";
}
# enable-native-pkcs11 # enable-native-pkcs11
if ($enable_native_pkcs11 eq "yes") { if ($enable_native_pkcs11 eq "yes") {
$cryptolib = "pkcs11"; $cryptolib = "pkcs11";
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment