AArch64: `reschedule` returns with interrupts enabled

Aperta
#2,779 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
47/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
rust

Direzione di ricerca

Read src/scheduler/mod.rs, especially the AArch64 reschedule implementation at lines 146–177 and the x86_64 and RISC-V implementations for comparison. Trace how the AArch64 reschedule mechanism affects the caller’s interrupt state, then determine whether the function’s contract requires restoring that state or requires callers to have interrupts enabled. Done means the intended contract and a safe behavior are established, with relevant scheduler tests or architecture checks updated.

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

Descrizione

On AArch64, reschedule unconditionally enables interrupts so that the reschedule SGI is taken (src/scheduler/mod.rs#L146-L177), so it always returns with interrupts enabled. On x86_64 and RISC-V, it returns with the caller's state (#L119-L144, #L179-L182).

This matters when a task blocks inside without_interrupts or while holding an InterruptSpinMutex/InterruptTicketMutex. After the task wakes up, the rest of that section runs with interrupts enabled until the guard is dropped. Since every interrupt handler ends in scheduler(), an interrupt in that window can switch away from the task while it still holds the lock, and if the next task on that core takes the same lock, it spins with interrupts disabled and the core hangs. Blocking in such a section is a bug on every architecture, and #2772 and #2778 fix two paths that did so, but on AArch64 it additionally leaves the remaining critical section unprotected.

Should reschedule on AArch64 restore the caller's state, e.g. by yielding with svc instead of a self-SGI, or is it only meant to be called with interrupts enabled?

Lingua principale
Rust
Stelle
1.5k
Fork
138
Merge medio
1g 9h
PR unite (30g)
18

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 hermit-os/kernel

Tutte le issue di hermit-os/kernel

Issue simili

Altre issue su Rust

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.