Opened 12 years ago
Closed 11 years ago
#5331 closed Bugs (fixed)
usage of deprecated swp instruction on arm
Reported by: | Owned by: | Peter Dimov | |
---|---|---|---|
Milestone: | To Be Determined | Component: | smart_ptr |
Version: | Boost 1.50.0 | Severity: | Problem |
Keywords: | arm deprecated | Cc: |
Description
Hi,
In smart_ptr/detail/spinlock_gcc_arm.hpp There is use of the deprecated swp instruction (for armv6 and above). This emits warning when compiling and also is supposed to have performance penalty on SMP platforms.
Can this be fixed using new instructions (ldrex etc..) ?
Thanks.
Boaz
Attachments (2)
Change History (8)
comment:1 by , 12 years ago
comment:2 by , 11 years ago
Hi,
I'm not sure if this is still on the agenda or not. However, I had to fix this specific problem earlier this year. I followed the outline given at http://www.boost.org/support/bugs.html to produce the attached patch against the latest trunk.
The patch should take care of deprecation warnings.
The latest trunk introduced a memory barrier after the swp instructiopn. However, I think using a memory barrier is only ever necessary when the lock was actually acquired. Yet, the trunk codebase sets one up on each call of try_lock()... This might have some performance implications.
As of right now, try_lock() is called in lock() inside a loop which explicitly yields the thread if try_lock() failed. It might be better to have that loop in try_lock() instead and only do a dmb if the lock was acquired. However, this might change the API in more ways than most people would be comfortable with, I guess...
by , 11 years ago
Attachment: | arm_spinlock_fix.patch added |
---|
Proposed patch for strex and ldrex usage on AMR 6 and ARM7.
by , 11 years ago
Attachment: | arm_spinlock_fix.2.patch added |
---|
[Fixed] Proposed patch for strex and ldrex usage on AMR 6 and ARM7.
comment:6 by , 11 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
I'm pretty sure that it can be fixed in principle using ldrex/strex; not only that, but it should be possible to implement sp_counted_base for armv6 using these, without resorting to a spinlock. However, I have neither the necessary experience with ARM assembly nor the resources to test the code.