From 042fc2959705eba79b2eae6031d5f9ca5c454c01 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Thu, 27 Jun 2019 10:53:18 +0300 Subject: MDEV-19845: Adaptive spin loops Starting with the Intel Skylake microarchitecture, the PAUSE instruction latency is about 140 clock cycles instead of earlier 10. On AMD processors, the latency could be 10 or 50 clock cycles, depending on microarchitecture. Because of this big range of latency, let us scale the loops around the PAUSE instruction based on timing results at server startup. my_cpu_relax_multiplier: New variable: How many times to invoke PAUSE in a loop. Only defined for IA-32 and AMD64. my_cpu_init(): Determine with RDTSC the time to run 16 PAUSE instructions in two unrolled loops according, and based on the quicker of the two runs, initialize my_cpu_relax_multiplier. This form of calibration was suggested by Mikhail Sinyavin from Intel. LF_BACKOFF(), ut_delay(): Use my_cpu_relax_multiplier when available. ut_delay(): Define inline in my_cpu.h. UT_COMPILER_BARRIER(): Remove. This does not seem to have any effect, because in our ut_delay() implementation, no computations are being performed inside the loop. The purpose of UT_COMPILER_BARRIER() was to prohibit the compiler from reordering computations. It was not emitting any code. --- config.h.cmake | 2 -- 1 file changed, 2 deletions(-) (limited to 'config.h.cmake') diff --git a/config.h.cmake b/config.h.cmake index b8a77899c4d..765d75dfb23 100644 --- a/config.h.cmake +++ b/config.h.cmake @@ -187,8 +187,6 @@ #cmakedefine HAVE_LINUX_FALLOC_H 1 #cmakedefine HAVE_FALLOC_PUNCH_HOLE_AND_KEEP_SIZE 1 #cmakedefine HAVE_PREAD 1 -#cmakedefine HAVE_PAUSE_INSTRUCTION 1 -#cmakedefine HAVE_FAKE_PAUSE_INSTRUCTION 1 #cmakedefine HAVE_RDTSCLL 1 #cmakedefine HAVE_READ_REAL_TIME 1 #cmakedefine HAVE_PTHREAD_ATTR_CREATE 1 -- cgit v1.2.1 From 5e929ee8a0487f8929386031e84b1884f503eb48 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Fri, 28 Jun 2019 12:52:13 +0300 Subject: MDEV-19845: Define my_timer_cycles() inline On clang, use __builtin_readcyclecounter() when available. Hinted by Sergey Vojtovich. (This may lead to runtime failure on ARM systems. The hardware should be available on ARMv8 (AArch64), but access to it may require special privileges.) We remove support for the proprietary Sun Microsystems compiler, and rely on clang or the __GNUC__ assembler syntax instead. For now, we retain support for IA-64 (Itanium) and 32-bit SPARC, even though those platforms are likely no longer widely used. We remove support for clock_gettime(CLOCK_SGI_CYCLE), because Silicon Graphics ceased supporting IRIX in December 2013. This was the only cycle timer interface available for MIPS. On PowerPC, we rely on the GCC 4.8 __builtin_ppc_get_timebase() (or clang __builtin_readcyclecounter()), which should be equivalent to the old assembler code on both 64-bit and 32-bit targets. --- config.h.cmake | 2 -- 1 file changed, 2 deletions(-) (limited to 'config.h.cmake') diff --git a/config.h.cmake b/config.h.cmake index 22509b2cf93..7ff54bef069 100644 --- a/config.h.cmake +++ b/config.h.cmake @@ -21,7 +21,6 @@ #cmakedefine _GNU_SOURCE 1 #cmakedefine HAVE_ALLOCA_H 1 #cmakedefine HAVE_ARPA_INET_H 1 -#cmakedefine HAVE_ASM_MSR_H 1 #cmakedefine HAVE_ASM_TERMBITS_H 1 #cmakedefine HAVE_CRYPT_H 1 #cmakedefine HAVE_CURSES_H 1 @@ -186,7 +185,6 @@ #cmakedefine HAVE_POSIX_FALLOCATE 1 #cmakedefine HAVE_FALLOC_PUNCH_HOLE_AND_KEEP_SIZE 1 #cmakedefine HAVE_PREAD 1 -#cmakedefine HAVE_RDTSCLL 1 #cmakedefine HAVE_READ_REAL_TIME 1 #cmakedefine HAVE_PTHREAD_ATTR_CREATE 1 #cmakedefine HAVE_PTHREAD_ATTR_GETGUARDSIZE 1 -- cgit v1.2.1 From e8392e58b2a5a69f9c0bd5b5aed90348b4a0ccb3 Mon Sep 17 00:00:00 2001 From: Robert Bindar Date: Mon, 1 Jul 2019 13:21:07 +0300 Subject: MDEV-19696 - Cleanup gcc sync builtins Since 10.4 requires C++11 capable compiler, gcc sync builtins became dead code. Remove relevant cmake checks and cleanup include files. --- config.h.cmake | 1 - 1 file changed, 1 deletion(-) (limited to 'config.h.cmake') diff --git a/config.h.cmake b/config.h.cmake index 7ff54bef069..b15f7b57a2b 100644 --- a/config.h.cmake +++ b/config.h.cmake @@ -380,7 +380,6 @@ #cmakedefine HAVE_SOLARIS_STYLE_GETHOST 1 -#cmakedefine HAVE_GCC_ATOMIC_BUILTINS 1 #cmakedefine HAVE_GCC_C11_ATOMICS 1 #cmakedefine HAVE_SOLARIS_ATOMIC 1 #cmakedefine HAVE_DECL_SHM_HUGETLB 1 -- cgit v1.2.1