Opened 7 years ago

Closed 7 years ago

#11362 closed Bugs (fixed)

smart_ptr spinlocks leads to livelock on ARM Cortex-A9 CPUs

Reported by: alex Owned by: Peter Dimov
Milestone: To Be Determined Component: smart_ptr
Version: Boost 1.57.0 Severity: Problem
Keywords: arm spinlock Cc:

Description

Spinlock used in smart_ptr for ARM architecture (smart_ptr/details/spinlock_gcc_arm.hpp) relies on swp/mcr instruction sequence or ldrex/strex/dmb depending on ARM version. Both these implementations are affected by an ARM issue described in errata 754327 for ARM Cortex-A9 CPU.

Suggested fix is to add "dmb" instruction to change spinlock::unlock() method:

void unlock() {

asm volatile( BOOST_SP_ARM_BARRIER ::: "memory" ); *const_cast< int volatile* >( &v_ ) = 0; asm volatile( BOOST_SP_ARM_BARRIER ::: "memory" );

}

Second barrier was added as recommended workaround from ARM errata document.

Change History (1)

Note: See TracTickets for help on using tickets.