wqueue: workaound g_notifier_pending list unsafe
Situation: thread1 thread2 work_notifier_signal enter_critical_section dq_peek(&g_notifier_pending) dq_rem(&g_notifier_pending) work_queue() // switch --> work_notifier_teardown enter_critical_section dq_rem(&g_notifier_pending) leave_critical_section <--- switch back error occured leave_critical_section Workaound: used sched_lock() to prevent the switch Signed-off-by: ligd <liguiding1@xiaomi.com>
This commit is contained in:
parent
1d5f43664d
commit
f3ada4b666
@ -344,6 +344,7 @@ void work_notifier_signal(enum work_evtype_e evtype,
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
flags = enter_critical_section();
|
flags = enter_critical_section();
|
||||||
|
sched_lock();
|
||||||
|
|
||||||
/* Process the notification at the head of the pending list until the
|
/* Process the notification at the head of the pending list until the
|
||||||
* pending list is empty
|
* pending list is empty
|
||||||
@ -386,6 +387,7 @@ void work_notifier_signal(enum work_evtype_e evtype,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sched_unlock();
|
||||||
leave_critical_section(flags);
|
leave_critical_section(flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user