Skip to content

Commit de106e3

Browse files
aineoae86-sysrawalexe
authored andcommitted
Fix RP2040 task lock acquire ordering
Add an acquire fence after the RP2040 recursive lock fast path because spin_try_lock_unsafe() does not provide acquire ordering when the lock is acquired immediately. Signed-off-by: Old-Ding <ai.neo.ae86@gmail.com>
1 parent 78069a7 commit de106e3

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

portable/ThirdParty/GCC/RP2040/include/portmacro.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,11 @@ static inline void vPortRecursiveLock( BaseType_t xCoreID,
237237
}
238238
spin_lock_unsafe_blocking(pxSpinLock);
239239
}
240+
else
241+
{
242+
/* spin_try_lock_unsafe() does not provide acquire ordering on the fast path. */
243+
__mem_fence_acquire();
244+
}
240245
configASSERT( ucRecursionCountByLock[ ulLockNum ] == 0 );
241246
ucRecursionCountByLock[ ulLockNum ] = 1;
242247
ucOwnedByCore[ xCoreID ][ ulLockNum ] = 1;

0 commit comments

Comments
 (0)