tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

workqueue_destroy() can cause hanging up in the some cases



Hi,

I found workqueue_destroy() for WQ_PERCPU workqueue can cause hanging up
while preempt disabled. The caller of workqueue_destroy() requires
for q_worker kthread to call kthread_exit(). In the implementation,
the caller do cv_wait()(*1) until q_worker sets NULL to q->q_worker(*2).
    - (*1) https://nxr.netbsd.org/xref/src/sys/kern/subr_workqueue.c#227
    - (*2) https://nxr.netbsd.org/xref/src/sys/kern/subr_workqueue.c#208

However, q_worker thread cannot run on the CPU which the caller of
workqueue_destroy() is running, when preempt disabled. That causes
hanging up.

I think it may be enough to just add notice to workqueue_destroy() man,
but it should be fixed if it can.

Do you have any comments or fix ideas?


Thanks,

--
//////////////////////////////////////////////////////////////////////
Internet Initiative Japan Inc.

Device Engineering Section,
Product Development Department,
Product Division,
Technology Unit

Kengo NAKAHARA <k-nakahara%iij.ad.jp@localhost>


Home | Main Index | Thread Index | Old Index