Skip to content
  • Philippe Gerum's avatar
    evl/thread: fix leaking ready state in evl_switch_inband() · 1641601f
    Philippe Gerum authored
    
    
    When arming T_INBAND for the stage switching thread, we have to remove
    it from the runqueue in the same move if T_READY is present in its
    state flags.
    
    Failing to do so creates a race with another CPU readying that thread
    by calling evl_release_thread(), which leads to an inconsistent
    scheduler state with both T_INBAND and T_READY set for the
    thread. When this happens, evl_switch_inband() may pick the switching
    thread from the runqueue for out-of-band scheduling in
    __evl_schedule() despite being formally blocked by T_INBAND, instead
    of waiting for the inband scheduler to do so for completing the
    transition to inband context.
    
    As a result, dovetail_resume_inband() spuriously runs from the
    out-of-band stage eventually (caught by CONFIG_DEBUG_DOVETAIL), which
    leads to a galactic mess.
    
    Signed-off-by: default avatarPhilippe Gerum <rpm@xenomai.org>
    1641601f