Skip to content
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
4 changes: 1 addition & 3 deletions api/include/opentelemetry/common/spin_lock_mutex.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,7 @@ class SpinLockMutex
__builtin_ia32_pause();
# endif
#elif defined(__arm__)
// This intrinsic should fail to be found if YIELD is not supported on the current
// processor.
__yield();

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a way (e.g. macro or something) to determine if __yield is available?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Curious where this pattern comes from.

BTW, do we need add CI for arm?

@lalitb lalitb Apr 12, 2022

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a way (e.g. macro or something) to determine if __yield is available?

There is no standard approach to do this. ARM vendors may choose not to implement these extensions.

Curious where this pattern comes from.

This patten of yielding ? It was written by Josh. I would prefer to let these platform specific code go away as long term solution, and rely on yield provided by standard C++ library.

BTW, do we need add CI for arm?

Yes we need it. @esigo has done some initial work #1165, but seems builds are very slow, as there is no ARM virtual machines provided by github.

__asm__ volatile("yield" ::: "memory");
#else
// TODO: Issue PAGE/YIELD on other architectures.
#endif
Expand Down
2 changes: 1 addition & 1 deletion api/test/common/spinlock_benchmark.cc
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ static void BM_ProcYieldSpinLockThrashing(benchmark::State &s)
__builtin_ia32_pause();
# endif
#elif defined(__arm__)
__yield();
__asm__ volatile("yield" ::: "memory");
#endif
}
},
Expand Down