From 7aeb0e6e9721c8d07419a4a9de27832a1a355a54 Mon Sep 17 00:00:00 2001 From: Ryan Pavlik Date: Tue, 19 Jan 2021 13:58:49 -0600 Subject: [PATCH] Add 10_mimalloc_restrict_cpu_yield.patch to fix mimalloc armel build. --- .../10_mimalloc_restrict_cpu_yield.patch | 41 +++++++++++++++++++ debian/patches/series | 1 + 2 files changed, 42 insertions(+) create mode 100644 debian/patches/10_mimalloc_restrict_cpu_yield.patch diff --git a/debian/patches/10_mimalloc_restrict_cpu_yield.patch b/debian/patches/10_mimalloc_restrict_cpu_yield.patch new file mode 100644 index 0000000..c7b4ae8 --- /dev/null +++ b/debian/patches/10_mimalloc_restrict_cpu_yield.patch @@ -0,0 +1,41 @@ +From: Ryan Pavlik +Date: Tue, 19 Jan 2021 13:46:43 -0600 +Subject: Restricts cpu yield instructions a little. + +adding clobber for ARM and preventing older 32 bits chips not supporting this instruction. + +Backport of https://github.com/microsoft/mimalloc/commit/33a10b48605f8bb419487a03125815ad6ee00a70 +--- + extlib/mimalloc/include/mimalloc-atomic.h | 12 +++++++++--- + 1 file changed, 9 insertions(+), 3 deletions(-) + +diff --git a/extlib/mimalloc/include/mimalloc-atomic.h b/extlib/mimalloc/include/mimalloc-atomic.h +index 722b6ad..94010d4 100644 +--- a/extlib/mimalloc/include/mimalloc-atomic.h ++++ b/extlib/mimalloc/include/mimalloc-atomic.h +@@ -267,16 +267,22 @@ static inline void mi_atomic_maxi64(volatile int64_t* p, int64_t x) { + std::this_thread::yield(); + } + #elif (defined(__GNUC__) || defined(__clang__)) && \ +- (defined(__x86_64__) || defined(__i386__) || defined(__arm__) || defined(__aarch64__)) ++ (defined(__x86_64__) || defined(__i386__) || (defined(__arm__) && __ARM_ARCH__ >= 7) || defined(__aarch64__)) + #if defined(__x86_64__) || defined(__i386__) + static inline void mi_atomic_yield(void) { + asm volatile ("pause" ::: "memory"); + } +-#elif defined(__arm__) || defined(__aarch64__) ++#elif (defined(__arm__) && __ARM_ARCH__ >= 7) || defined(__aarch64__) + static inline void mi_atomic_yield(void) { +- asm volatile("yield"); ++ __asm__ volatile("yield" ::: "memory"); + } + #endif ++#elif defined(__sun) ++ // Fallback for other archs ++ #include ++ static inline void mi_atomic_yield(void) { ++ smt_pause(); ++ } + #elif defined(__wasi__) + #include + static inline void mi_atomic_yield(void) { diff --git a/debian/patches/series b/debian/patches/series index 1f20572..7cde63c 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -1 +1,2 @@ 01_RemoveGitHash.patch +10_mimalloc_restrict_cpu_yield.patch -- 2.30.2