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

Aperta
#805 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 2 giorni

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
48/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
rust

Direzione di ricerca

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.

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

Descrizione

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.

Lingua principale
Rust
Stelle
282
Fork
12
Merge medio
2g 9h
PR unite (30g)
28

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

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 tier4/awkernel

Tutte le issue di tier4/awkernel

Issue simili

Altre issue su Rust

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.