[BUG] prvSelectHighestPriorityTask can leave a core with no selectable task and spin the victim in prvCheckForRunStateChange

Aperta
#1,505 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 3 giorni

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
15/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
c

Direzione di ricerca

Start in tasks.c with prvSelectHighestPriorityTask(), where xTaskScheduled can stay pdFALSE and pxCurrentTCBs is left unchanged, then trace how prvYieldCore() skips taskTASK_SCHEDULED_TO_YIELD and how prvCheckForRunStateChange() spins. Reproduce on the POSIX SMP port with configUSE_CORE_AFFINITY 1. Read the closed PR #1264 discussion before choosing between a fix and a bounded wait; done means the victim no longer spins.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Describe the bug

When idle-task affinity plus a task's own mask leave a core with no selectable task, prvSelectHighestPriorityTask() returns with xTaskScheduled == pdFALSE and pxCurrentTCBs untouched. The victim stays taskTASK_SCHEDULED_TO_YIELD, prvYieldCore() suppresses any re-yield for it, and the victim spins forever in prvCheckForRunStateChange().

Target

  • SMP build with configUSE_CORE_AFFINITY 1 (reproduced on a POSIX host-port harness)

To Reproduce

Public affinity APIs: pin idle tasks and a victim such that one core ends up with no selectable task (idle-task affinity plus the victim's own mask), then have the victim call vTaskDelay()/taskENTER_CRITICAL() - it never returns from prvCheckForRunStateChange().

Expected behavior

The run-state handling should not latch taskTASK_SCHEDULED_TO_YIELD when no core can select the task (or the wait in prvCheckForRunStateChange() should have a bounded escape).

Additional context

This is the sub-mechanism already diagnosed in PR #1264 (closed unmerged) - please see the discussion there; this issue is filed for tracking. configIDLE_AFFINITY (PR #1415) is opt-in (default 0) and does not fix the run-state handling. Happy to work on a fix following the direction discussed in #1264.

Lingua principale
C
Stelle
4.6k
Fork
1.6k
Merge medio
2g 22h
PR unite (30g)
4

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di FreeRTOS/FreeRTOS-Kernel

Tutte le issue di FreeRTOS/FreeRTOS-Kernel

Issue simili

Altre issue su C

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.