(Follow-up, not a regression) A task woken by an IRQ handler on CPU 0 can still wait until the sleep ends

Offen
#805 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Maintainer antworten meist innerhalb von 2 Tagen

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Anfängerfreundlichkeit
48/100
Issue-Typ
Bug
Klarheit
Größtenteils klar
Aktivitätsstatus
Aktiv
Tech-Stack
rust

Rechercherichtung

Read kernel/src/lib.rs:109-136 and awkernel_lib/src/cpu/sleep_cpu_no_std.rs, focusing on sleep and wake_up; trace how an IRQ that enqueues a task affects the current CPU while its tag is Active. Check the existing model and identify what must change so this wake path is covered. Done means the task does not wait for the sleep timeout after that IRQ, with a model update covering the path.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

File: kernel/src/lib.rs:109-136, awkernel_lib/src/cpu/sleep_cpu_no_std.rs
(sleep, wake_up).

The primary CPU runs with interrupts disabled except in the IRQ window at the
top of the loop and inside sleep_cpu(). An IRQ that arrives during
wake_task() or wake_workers() is handled right after
InterruptEnable::new() in sleep(), while the tag is still Active. If the
handler wakes a task:

  • wake_cpu(0) targets the current CPU and does nothing.
  • reset_wakeup_timer() does nothing, because the tag is Active.
  • The CPU then moves to Waiting and halts until the timeout (up to 1 second),
    with NUM_TASK_IN_QUEUE > 0 and possibly all workers asleep.

This window existed before, and it was wider in the old order. But the
saturated counter kept the primary CPU spinning, which hid the delay; with an
exact counter it becomes visible, in the same way as the timer case that this
PR fixes.

One possible fix is to let wake_up() on the current CPU change Active to
Continue, so that the next sleep() returns at once. The current model does
not cover this path, because its interrupt handlers do not enqueue tasks, so
such a change should come with a model update.

Vorherrschende Sprache
Rust
Sterne
282
Forks
12
Ø Merge
2 T. 9 Std.
Gemergte PRs (30 T.)
28

Entwicklungsumgebung

Dieses Projekt bietet weder Dev-Container noch Dockerfile noch Beitragsleitfaden – die Einrichtung liegt bei Ihnen. Beginnen Sie mit der README; die allgemeinen Schritte stehen in unserem Leitfaden für den ersten Beitrag.

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus tier4/awkernel

Alle Issues in tier4/awkernel

Ähnliche Issues

Weitere Issues zu Rust

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.