hv: Fix thread status mess if wake_thread() happens in transition stage

2abbb99f6a ("hv: make thread status more accurate") introduced a
transition stage, marked as var be_blocking, between RUNNING->BLOCKED
of thread status. wake_thread() does not work in this transition stage
because it only checks thread->status.

Need to check thread->be_blocking as well in wake_thread(). When
wake_thread() happens in the transition stage, the previous sleep
operation rolled back.

Tracked-On: #5190
Fixes: 2abbb99f6a ("hv: make thread status more accurate")
Signed-off-by: Conghui Chen <conghui.chen@intel.com>
Signed-off-by: Shuo A Liu <shuo.a.liu@intel.com>
This commit is contained in:
Shuo A Liu 2020-08-03 10:53:35 +08:00 committed by wenlingz
parent 5409d14e08
commit 7602304692
1 changed files with 6 additions and 3 deletions

View File

@ -225,13 +225,16 @@ void wake_thread(struct thread_object *obj)
uint64_t rflag;
obtain_schedule_lock(pcpu_id, &rflag);
if (is_blocked(obj)) {
if (is_blocked(obj) || obj->be_blocking) {
scheduler = get_scheduler(pcpu_id);
if (scheduler->wake != NULL) {
scheduler->wake(obj);
}
set_thread_status(obj, THREAD_STS_RUNNABLE);
make_reschedule_request(pcpu_id, DEL_MODE_IPI);
if (is_blocked(obj)) {
set_thread_status(obj, THREAD_STS_RUNNABLE);
make_reschedule_request(pcpu_id, DEL_MODE_IPI);
}
obj->be_blocking = false;
}
release_schedule_lock(pcpu_id, rflag);
}