Skip to content

Conversation

@tsandmann
Copy link

SMP: Bugfix for race condition on RP2040 in vPortEnableInterrupts() and invalid sanity checks

Description

  1. RP2040 SMP port: Since spin_unlock() re-enables interrupts, pxYieldSpinLock has to be updated first to avoid a possible race condition in vPortEnableInterrupts() .
  2. RP2040 SMP port: Testing pxYieldSpinLock for NULL does not work reliable in vPortLockInternalSpinUnlockWithWait() and xPortLockInternalSpinUnlockWithBestEffortWaitOrTimeout() , because another/new lock might already be set after xEventGroupWaitBits() returns and before the configASSERT() statement is executed.

Test Steps

Validated on a Raspberry Pi Pico board with two tasks which both continuously try to lock (and unlock) a mutex.

Related Issue

None.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

RP2040 SMP port: Since spin_unlock() re-enables interrupts, pxYieldSpinLock has to be updated first to avoid a possible race condition.
RP2040 SMP port: Testing pxYieldSpinLock for NULL does not work reliable in these places, because another/new lock might already be set when configASSERT() is executed.
@tsandmann tsandmann requested a review from a team as a code owner December 27, 2021 18:31
@aggarg aggarg merged commit 4832377 into FreeRTOS:smp Dec 28, 2021
@tsandmann tsandmann deleted the bugfix_rp2040 branch February 22, 2022 12:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants