Hello. Sending new version with Signed-off-by header.
Radek --- From 2726b40ae1b41586e410105d5fd5149f8e7f6b92 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Radek=20Barto=C5=88?= <[email protected]> Date: Thu, 5 Jun 2025 12:41:37 +0200 Subject: [PATCH v3] Cygwin: implement spinlock pause for AArch64 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Radek Bartoň <[email protected]> --- winsup/cygwin/local_includes/cygtls.h | 5 ++++- winsup/cygwin/thread.cc | 5 +++++ winsup/testsuite/winsup.api/pthread/cpu_relax.h | 3 ++- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/winsup/cygwin/local_includes/cygtls.h b/winsup/cygwin/local_includes/cygtls.h index 615361d3f..31cadd51a 100644 --- a/winsup/cygwin/local_includes/cygtls.h +++ b/winsup/cygwin/local_includes/cygtls.h @@ -243,8 +243,11 @@ public: /* Do NOT remove this public: line, it's a marker for gentls_offsets. */ { while (InterlockedExchange (&stacklock, 1)) { -#ifdef __x86_64__ +#if defined(__x86_64__) __asm__ ("pause"); +#elif defined(__aarch64__) + __asm__ ("dmb ishst\n" + "yield"); #else #error unimplemented for this target #endif diff --git a/winsup/cygwin/thread.cc b/winsup/cygwin/thread.cc index fea6079b8..510e2be93 100644 --- a/winsup/cygwin/thread.cc +++ b/winsup/cygwin/thread.cc @@ -1968,7 +1968,12 @@ pthread_spinlock::lock () else if (spins < FAST_SPINS_LIMIT) { ++spins; +#if defined(__x86_64__) __asm__ volatile ("pause":::); +#elif defined(__aarch64__) + __asm__ volatile ("dmb ishst\n" + "yield":::); +#endif } else { diff --git a/winsup/testsuite/winsup.api/pthread/cpu_relax.h b/winsup/testsuite/winsup.api/pthread/cpu_relax.h index 1936dc5f4..71cec0b2b 100644 --- a/winsup/testsuite/winsup.api/pthread/cpu_relax.h +++ b/winsup/testsuite/winsup.api/pthread/cpu_relax.h @@ -4,7 +4,8 @@ #if defined(__x86_64__) || defined(__i386__) // Check for x86 architectures #define CPU_RELAX() __asm__ volatile ("pause" :::) #elif defined(__aarch64__) || defined(__arm__) // Check for ARM architectures - #define CPU_RELAX() __asm__ volatile ("yield" :::) + #define CPU_RELAX() __asm__ volatile ("dmb ishst \ + yield" :::) #else #error unimplemented for this target #endif -- 2.49.0.vfs.0.4
v3-0001-Cygwin-implement-spinlock-pause-for-AArch64.patch
Description: v3-0001-Cygwin-implement-spinlock-pause-for-AArch64.patch
