shithub: riscv

Download patch

ref: eaffa1ef55825c34e138246fe5db5bbf996a8dbb
parent: 39321d74d876356004c5314fbeb58fdaa36545aa
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Thu Jan 4 21:12:42 EST 2024

kernel: fix EDF scheduler double ready() and more robust double-ready detection

Move the "double-ready" check into queueproc() function,
doing it while holding the runq lock, meaning
all transitions to Ready state are serialized.

We do not just check for double-ready but for any
"illegal" transisions:

ready() on Dead, Moribund, New, Ready, Running and Waitrelease
is not allowed.

ready() on Queueing*, Wakeme, Broken, Stopped and Rendez
is only valid when done from another process.

For rescheduling, we have to go to Scheding state
before calling ready(). (rebalance(), schedinit()...)

The EDF scheduler had this bug where it could ready() multiple
times as it was staying in Waitrelease state after releasing
the edflock. Now it transitions thru Scheding avoiding
the issue.