Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUILD] Improve how to handle yield() in ARM. #3129

Merged
merged 3 commits into from
Nov 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions api/include/opentelemetry/common/spin_lock_mutex.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,10 @@ class SpinLockMutex
# else
__builtin_ia32_pause();
# endif
#elif defined(__arm__)
__asm__ volatile("yield" ::: "memory");
#elif defined(__armel__) || defined(__ARMEL__)
asm volatile("nop" ::: "memory");
ThomsonTan marked this conversation as resolved.
Show resolved Hide resolved
#elif defined(__arm__) || defined(__aarch64__) // arm big endian / arm64
__asm__ __volatile__("yield" ::: "memory");
#else
// TODO: Issue PAGE/YIELD on other architectures.
#endif
Expand Down
6 changes: 4 additions & 2 deletions api/test/common/spinlock_benchmark.cc
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,10 @@ static void BM_ProcYieldSpinLockThrashing(benchmark::State &s)
# else
__builtin_ia32_pause();
# endif
#elif defined(__arm__)
__asm__ volatile("yield" ::: "memory");
#elif defined(__armel__) || defined(__ARMEL__)
asm volatile("nop" ::: "memory");
#elif defined(__arm__) || defined(__aarch64__) // arm big endian / arm64
__asm__ __volatile__("yield" ::: "memory");
#endif
}
},
Expand Down