mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-05-03 14:06:54 +00:00
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: #5122 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:
parent
d984da9e5b
commit
be5a00307e
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user