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

オープン
#1,505 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 3 日以内に返信

まだ誰も着手していません。

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
15/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
活発
技術スタック
c

調査の方向性

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.

索引モデルが issue の本文から書いたものです。

説明

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.

主要言語
C
スター
4.6k
フォーク
1.6k
平均マージ
2日 22時間
マージ済み PR(30日)
4

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

FreeRTOS/FreeRTOS-Kernel のほかの issue

FreeRTOS/FreeRTOS-Kernel の issue をすべて見る

似ている issue

C の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。