diff options
Diffstat (limited to 'meta-openembedded/meta-oe/recipes-dbs/rocksdb/files')
9 files changed, 202 insertions, 21 deletions
diff --git a/meta-openembedded/meta-oe/recipes-dbs/rocksdb/files/0001-cmake-Add-check-for-atomic-support.patch b/meta-openembedded/meta-oe/recipes-dbs/rocksdb/files/0001-cmake-Add-check-for-atomic-support.patch index eb9928a0c..8bdd27ff2 100644 --- a/meta-openembedded/meta-oe/recipes-dbs/rocksdb/files/0001-cmake-Add-check-for-atomic-support.patch +++ b/meta-openembedded/meta-oe/recipes-dbs/rocksdb/files/0001-cmake-Add-check-for-atomic-support.patch @@ -25,11 +25,9 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com> 2 files changed, 74 insertions(+) create mode 100644 cmake/modules/CheckAtomic.cmake -diff --git a/CMakeLists.txt b/CMakeLists.txt -index f9c8f3346..4d604004b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt -@@ -852,7 +852,12 @@ endif() +@@ -935,7 +935,12 @@ endif() if(WIN32) set(SYSTEM_LIBS ${SYSTEM_LIBS} shlwapi.lib rpcrt4.lib) else() @@ -41,10 +39,7 @@ index f9c8f3346..4d604004b 100644 + endif() endif() - add_library(${ROCKSDB_STATIC_LIB} STATIC ${SOURCES}) -diff --git a/cmake/modules/CheckAtomic.cmake b/cmake/modules/CheckAtomic.cmake -new file mode 100644 -index 000000000..8b7dc8a37 + add_library(${ROCKSDB_STATIC_LIB} STATIC ${SOURCES} ${BUILD_VERSION_CC}) --- /dev/null +++ b/cmake/modules/CheckAtomic.cmake @@ -0,0 +1,69 @@ @@ -117,6 +112,3 @@ index 000000000..8b7dc8a37 + endif() +endif() + --- -2.28.0 - diff --git a/meta-openembedded/meta-oe/recipes-dbs/rocksdb/files/0001-cmake-Use-exported-target-for-bz2.patch b/meta-openembedded/meta-oe/recipes-dbs/rocksdb/files/0001-cmake-Use-exported-target-for-bz2.patch index 57433b057..d3054759a 100644 --- a/meta-openembedded/meta-oe/recipes-dbs/rocksdb/files/0001-cmake-Use-exported-target-for-bz2.patch +++ b/meta-openembedded/meta-oe/recipes-dbs/rocksdb/files/0001-cmake-Use-exported-target-for-bz2.patch @@ -11,8 +11,6 @@ Upstream-Status: Submitted [https://github.com/facebook/rocksdb/pull/7541] CMakeLists.txt | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 676192913..801586c30 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -32,7 +32,7 @@ @@ -24,7 +22,7 @@ index 676192913..801586c30 100644 list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake/modules/") include(ReadVersion) -@@ -148,12 +148,7 @@ else() +@@ -152,12 +152,7 @@ else() if(WITH_BZ2) find_package(BZip2 REQUIRED) add_definitions(-DBZIP2) @@ -38,6 +36,3 @@ index 676192913..801586c30 100644 endif() if(WITH_LZ4) --- -2.28.0 - diff --git a/meta-openembedded/meta-oe/recipes-dbs/rocksdb/files/0001-folly-Use-SYS_futex-for-syscall.patch b/meta-openembedded/meta-oe/recipes-dbs/rocksdb/files/0001-folly-Use-SYS_futex-for-syscall.patch index aa291daa3..9c70d4f6a 100644 --- a/meta-openembedded/meta-oe/recipes-dbs/rocksdb/files/0001-folly-Use-SYS_futex-for-syscall.patch +++ b/meta-openembedded/meta-oe/recipes-dbs/rocksdb/files/0001-folly-Use-SYS_futex-for-syscall.patch @@ -12,8 +12,6 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com> third-party/folly/folly/detail/Futex.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) -diff --git a/third-party/folly/folly/detail/Futex.cpp b/third-party/folly/folly/detail/Futex.cpp -index 62d6ea2b2..a914a8c73 100644 --- a/third-party/folly/folly/detail/Futex.cpp +++ b/third-party/folly/folly/detail/Futex.cpp @@ -48,9 +48,15 @@ namespace { @@ -42,6 +40,3 @@ index 62d6ea2b2..a914a8c73 100644 addr, /* addr1 */ op, /* op */ expected, /* val */ --- -2.29.2 - diff --git a/meta-openembedded/meta-oe/recipes-dbs/rocksdb/files/0001-jemalloc_helper-Limit-the-mm_malloc.h-hack-to-glibc-.patch b/meta-openembedded/meta-oe/recipes-dbs/rocksdb/files/0001-jemalloc_helper-Limit-the-mm_malloc.h-hack-to-glibc-.patch new file mode 100644 index 000000000..dbb0dda22 --- /dev/null +++ b/meta-openembedded/meta-oe/recipes-dbs/rocksdb/files/0001-jemalloc_helper-Limit-the-mm_malloc.h-hack-to-glibc-.patch @@ -0,0 +1,23 @@ +From 1a69d4cc3f97e348dba9714c7ec60da1a8650664 Mon Sep 17 00:00:00 2001 +From: Khem Raj <raj.khem@gmail.com> +Date: Tue, 15 Jun 2021 22:05:36 -0700 +Subject: [PATCH] jemalloc_helper: Limit the mm_malloc.h hack to glibc on linux + +Musl does not need this hack + +Signed-off-by: Khem Raj <raj.khem@gmail.com> +--- + port/jemalloc_helper.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/port/jemalloc_helper.h ++++ b/port/jemalloc_helper.h +@@ -5,7 +5,7 @@ + + #pragma once + +-#if defined(__clang__) ++#if defined(__clang__) && defined(__GLIBC__) + // glibc's `posix_memalign()` declaration specifies `throw()` while clang's + // declaration does not. There is a hack in clang to make its re-declaration + // compatible with glibc's if they are declared consecutively. That hack breaks diff --git a/meta-openembedded/meta-oe/recipes-dbs/rocksdb/files/0001-range_tree-Implement-toku_time_now-for-rv32-rv64-in-.patch b/meta-openembedded/meta-oe/recipes-dbs/rocksdb/files/0001-range_tree-Implement-toku_time_now-for-rv32-rv64-in-.patch new file mode 100644 index 000000000..86c1bffea --- /dev/null +++ b/meta-openembedded/meta-oe/recipes-dbs/rocksdb/files/0001-range_tree-Implement-toku_time_now-for-rv32-rv64-in-.patch @@ -0,0 +1,44 @@ +From 89c032a9b4011385c0b504ea61e5df0db71f0ff5 Mon Sep 17 00:00:00 2001 +From: Khem Raj <raj.khem@gmail.com> +Date: Wed, 16 Jun 2021 19:06:02 -0700 +Subject: [PATCH] range_tree: Implement toku_time_now for rv32/rv64 in asm + +Upstream-Status: Pending +Signed-off-by: Khem Raj <raj.khem@gmail.com> +--- + .../range_tree/lib/portability/toku_time.h | 19 +++++++++++++++++++ + 1 file changed, 19 insertions(+) + +diff --git a/utilities/transactions/lock/range/range_tree/lib/portability/toku_time.h b/utilities/transactions/lock/range/range_tree/lib/portability/toku_time.h +index 4425a4a2e..4ac964f85 100644 +--- a/utilities/transactions/lock/range/range_tree/lib/portability/toku_time.h ++++ b/utilities/transactions/lock/range/range_tree/lib/portability/toku_time.h +@@ -133,6 +133,25 @@ static inline tokutime_t toku_time_now(void) { + return result; + #elif defined(__powerpc__) + return __ppc_get_timebase(); ++#elif defined(__riscv) // RISC-V ++#if __riscv_xlen == 32 ++ uint32_t lo, hi0, hi1; ++ __asm __volatile__( ++ "rdcycleh %0\n" ++ "rdcycle %1\n" ++ "rdcycleh %2\n" ++ "sub %0, %0, %2\n" ++ "seqz %0, %0\n" ++ "sub %0, zero, %0\n" ++ "and %1, %1, %0\n" ++ : "=r"(hi0), "=r"(lo), "=r"(hi1)); ++ return ((uint64_t)hi1 << 32) | lo; ++#else ++ uint64_t result; ++ __asm __volatile__("rdcycle %0" : "=r"(result)); ++ return result; ++#endif ++ + #else + #error No timer implementation for this platform + #endif +-- +2.32.0 + diff --git a/meta-openembedded/meta-oe/recipes-dbs/rocksdb/files/0001-replace-old-sync-with-new-atomic-builtin-equivalents.patch b/meta-openembedded/meta-oe/recipes-dbs/rocksdb/files/0001-replace-old-sync-with-new-atomic-builtin-equivalents.patch new file mode 100644 index 000000000..4aa91d9b2 --- /dev/null +++ b/meta-openembedded/meta-oe/recipes-dbs/rocksdb/files/0001-replace-old-sync-with-new-atomic-builtin-equivalents.patch @@ -0,0 +1,59 @@ +From 114c42fba3fc86119710e8dd1bb2b7a9e39e3064 Mon Sep 17 00:00:00 2001 +From: Khem Raj <raj.khem@gmail.com> +Date: Thu, 17 Jun 2021 19:35:01 -0700 +Subject: [PATCH] replace old sync with new atomic builtin equivalents + +Helps compiling with gcc on newer arches e.g. riscv32 where these +__sync* builtins are not implemented atleast for 64bit values + +Signed-off-by: Khem Raj <raj.khem@gmail.com> +--- + .../range/range_tree/lib/portability/toku_atomic.h | 12 ++++++------ + 1 file changed, 6 insertions(+), 6 deletions(-) + +--- a/utilities/transactions/lock/range/range_tree/lib/portability/toku_atomic.h ++++ b/utilities/transactions/lock/range/range_tree/lib/portability/toku_atomic.h +@@ -77,37 +77,37 @@ template <typename T, typename U> + __attribute__((always_inline)) static inline T toku_sync_fetch_and_add(T *addr, + U diff) { + paranoid_invariant(!crosses_boundary(addr, sizeof *addr)); +- return __sync_fetch_and_add(addr, diff); ++ return __atomic_fetch_add(addr, diff, 5); + } + template <typename T, typename U> + __attribute__((always_inline)) static inline T toku_sync_add_and_fetch(T *addr, + U diff) { + paranoid_invariant(!crosses_boundary(addr, sizeof *addr)); +- return __sync_add_and_fetch(addr, diff); ++ return __atomic_add_fetch(addr, diff, 5); + } + template <typename T, typename U> + __attribute__((always_inline)) static inline T toku_sync_fetch_and_sub(T *addr, + U diff) { + paranoid_invariant(!crosses_boundary(addr, sizeof *addr)); +- return __sync_fetch_and_sub(addr, diff); ++ return __atomic_fetch_sub(addr, diff, 5); + } + template <typename T, typename U> + __attribute__((always_inline)) static inline T toku_sync_sub_and_fetch(T *addr, + U diff) { + paranoid_invariant(!crosses_boundary(addr, sizeof *addr)); +- return __sync_sub_and_fetch(addr, diff); ++ return __atomic_sub_fetch(addr, diff, 5); + } + template <typename T, typename U, typename V> + __attribute__((always_inline)) static inline T toku_sync_val_compare_and_swap( + T *addr, U oldval, V newval) { + paranoid_invariant(!crosses_boundary(addr, sizeof *addr)); +- return __sync_val_compare_and_swap(addr, oldval, newval); ++ return __atomic_compare_exchange(addr, oldval, newval); + } + template <typename T, typename U, typename V> + __attribute__((always_inline)) static inline bool + toku_sync_bool_compare_and_swap(T *addr, U oldval, V newval) { + paranoid_invariant(!crosses_boundary(addr, sizeof *addr)); +- return __sync_bool_compare_and_swap(addr, oldval, newval); ++ return static_cast<bool>(__atomic_compare_exchange(addr, oldval, newval)); + } + + // in case you include this but not toku_portability.h diff --git a/meta-openembedded/meta-oe/recipes-dbs/rocksdb/files/arm.patch b/meta-openembedded/meta-oe/recipes-dbs/rocksdb/files/arm.patch new file mode 100644 index 000000000..d428a6624 --- /dev/null +++ b/meta-openembedded/meta-oe/recipes-dbs/rocksdb/files/arm.patch @@ -0,0 +1,26 @@ +implement timer for arm >= v6 + +Signed-off-by: Khem Raj <raj.khem@gmail.com> +--- a/utilities/transactions/lock/range/range_tree/lib/portability/toku_time.h ++++ b/utilities/transactions/lock/range/range_tree/lib/portability/toku_time.h +@@ -161,6 +161,20 @@ static inline tokutime_t toku_time_now(v + struct timeval tv; + gettimeofday(&tv, nullptr); + return (uint64_t)tv.tv_sec * 1000000 + tv.tv_usec; ++#elif (__ARM_ARCH >= 6) ++ uint32_t pmccntr; ++ uint32_t pmuseren; ++ uint32_t pmcntenset; ++ // Read the user mode perf monitor counter access permissions. ++ asm volatile("mrc p15, 0, %0, c9, c14, 0" : "=r"(pmuseren)); ++ if (pmuseren & 1) { // Allows reading perfmon counters for user mode code. ++ asm volatile("mrc p15, 0, %0, c9, c12, 1" : "=r"(pmcntenset)); ++ if (pmcntenset & 0x80000000ul) { // Is it counting? ++ asm volatile("mrc p15, 0, %0, c9, c13, 0" : "=r"(pmccntr)); ++ // The counter is set up to count every 64th cycle ++ return (uint64_t)pmccntr * 64; // Should optimize to << 6 ++ } ++ } + #else + #error No timer implementation for this platform + #endif diff --git a/meta-openembedded/meta-oe/recipes-dbs/rocksdb/files/mips.patch b/meta-openembedded/meta-oe/recipes-dbs/rocksdb/files/mips.patch new file mode 100644 index 000000000..db2305d29 --- /dev/null +++ b/meta-openembedded/meta-oe/recipes-dbs/rocksdb/files/mips.patch @@ -0,0 +1,19 @@ +implement timer implementation for mips platform + +Signed-off-by: Khem Raj <raj.khem@gmail.com> +--- a/utilities/transactions/lock/range/range_tree/lib/portability/toku_time.h ++++ b/utilities/transactions/lock/range/range_tree/lib/portability/toku_time.h +@@ -155,7 +155,12 @@ static inline tokutime_t toku_time_now(v + __asm __volatile__("rdcycle %0" : "=r"(result)); + return result; + #endif +- ++#elif defined(__mips__) ++ // mips apparently only allows rdtsc for superusers, so we fall ++ // back to gettimeofday. It's possible clock_gettime would be better. ++ struct timeval tv; ++ gettimeofday(&tv, nullptr); ++ return (uint64_t)tv.tv_sec * 1000000 + tv.tv_usec; + #else + #error No timer implementation for this platform + #endif diff --git a/meta-openembedded/meta-oe/recipes-dbs/rocksdb/files/ppc64.patch b/meta-openembedded/meta-oe/recipes-dbs/rocksdb/files/ppc64.patch new file mode 100644 index 000000000..bc40f1b1e --- /dev/null +++ b/meta-openembedded/meta-oe/recipes-dbs/rocksdb/files/ppc64.patch @@ -0,0 +1,28 @@ +implement support for musl/ppc64 + +Signed-off-by: Khem Raj <raj.khem@gmail.com> +--- a/utilities/transactions/lock/range/range_tree/lib/portability/toku_time.h ++++ b/utilities/transactions/lock/range/range_tree/lib/portability/toku_time.h +@@ -58,7 +58,7 @@ Copyright (c) 2006, 2015, Percona and/or + #include <stdint.h> + #include <sys/time.h> + #include <time.h> +-#if defined(__powerpc__) ++#if defined(__powerpc__) && defined(__GLIBC__) + #include <sys/platform/ppc.h> + #endif + +@@ -131,8 +131,12 @@ static inline tokutime_t toku_time_now(v + uint64_t result; + __asm __volatile__("mrs %[rt], cntvct_el0" : [ rt ] "=r"(result)); + return result; +-#elif defined(__powerpc__) ++#elif defined(__powerpc__) && defined(__GLIBC__) + return __ppc_get_timebase(); ++#elif defined(__powerpc64__) || defined(__ppc64__) ++ uint64_t result; ++ asm volatile("mfspr %0, 268" : "=r"(result)); ++ return result; + #elif defined(__riscv) // RISC-V + #if __riscv_xlen == 32 + uint32_t lo, hi0, hi1; |