fix: add acquire fence in bthread_join for ARM memory visibility#3276
fix: add acquire fence in bthread_join for ARM memory visibility#3276guoliushui wants to merge 2 commits intoapache:masterfrom
Conversation
Ensure memory visibility on ARM architecture after thread join.
|
已使用测试程序验证生效 |
There was a problem hiding this comment.
Pull request overview
This PR addresses weak-memory-ordering visibility issues where bthread_join() may return before the joining thread can reliably observe the joined bthread’s prior memory writes (reported on ARM/aarch64).
Changes:
- Add an acquire fence after
TaskGroup::join()observes the joined bthread has advancedversion_butex. - Gate the fence with ARM architecture preprocessor checks (
__aarch64__/__arm__).
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
|
我们最近也在用arm,想验证一下这个bug,可以提供一下复现bug的代码吗 |
|
butex_wait 有 acquire 语义。是不是只有没有进入循环的情况下才有问题? brpc/src/bthread/task_group.cpp Lines 632 to 637 in 35682ff |
当时也有过这方面的考虑,最后未做区分是否touch到了butex_wait原因如下:
|
|
@guoliushui 之前我在鲲鹏 950 上测试时也发现, |
目前在鲲鹏920上,还未遇到过卡住的现象 |
|
感谢,我们机器也是鲲鹏920的,复现了这个问题 |
Ensure memory visibility on ARM architecture after thread join.
What problem does this PR solve?
Issue Number: fix #3274
Problem Summary:
What is changed and the side effects?
Changed:
Side effects:
Performance effects:
Breaking backward compatibility:
Check List: