Describe the bug
Running on the SMP system, the system stops scheduling, and an assertion is triggered at configASSERT( pxThisTCB->xTaskRunState == taskTASK_SCHEDULED_TO_YIELD ) in the code of the prvCheckForRunStateChange function.
In the vTaskSuspendAll function, the portSET_INTERRUPT_MASK() macro is used to disable interrupts before calling prvCheckForRunStateChange. However, the prvCheckForRunStateChange function code uses the portENABLE_INTERRUPTS() macro to temporarily enable task switching, which results in task switching not actually being enabled. After calling portENABLE_INTERRUPTS(), the interrupts used for scheduling remain masked.
Target
- Development board: [user-defined]
- Instruction Set Architecture: [ARM_CR82]
- IDE and version: [IAR 9.20]
To Reproduce
- Use multi-task with xSemaphoreXXX function on multi-core system.
- Frequent calls to the
vTaskSuspendAll function
- Frequent calls to the
prvYieldCore( xCoreID ) macro
Additional context
It might be appropriate to use the portDISABLE_INTERRUPTS() macro instead of the portSET_INTERRUPT_MASK() macro in the vTaskSuspendAll function.
Describe the bug
Running on the SMP system, the system stops scheduling, and an assertion is triggered at
configASSERT( pxThisTCB->xTaskRunState == taskTASK_SCHEDULED_TO_YIELD )in the code of theprvCheckForRunStateChangefunction.In the
vTaskSuspendAllfunction, theportSET_INTERRUPT_MASK()macro is used to disable interrupts before callingprvCheckForRunStateChange. However, theprvCheckForRunStateChangefunction code uses theportENABLE_INTERRUPTS()macro to temporarily enable task switching, which results in task switching not actually being enabled. After calling portENABLE_INTERRUPTS(), the interrupts used for scheduling remain masked.Target
To Reproduce
vTaskSuspendAllfunctionprvYieldCore( xCoreID )macroAdditional context
It might be appropriate to use the
portDISABLE_INTERRUPTS()macro instead of theportSET_INTERRUPT_MASK()macro in thevTaskSuspendAllfunction.