Skip to content

[BUG] Scheduling stop in the prvCheckForRunStateChange function for SMP #1328

@raceant

Description

@raceant

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions