Re: [PATCH v4] workqueue: Warn when work flush own workqueue
From: Tejun Heo
Date: Fri Sep 04 2020 - 13:04:08 EST
On Thu, Aug 27, 2020 at 02:09:11PM +0800, Qianli Zhao wrote:
> @@ -2594,13 +2595,17 @@ static void check_flush_dependency(struct workqueue_struct *target_wq,
> struct work_struct *target_work)
> {
> work_func_t target_func = target_work ? target_work->func : NULL;
> - struct worker *worker;
> + struct worker *worker = current_wq_worker();
> +
> + WARN_ONCE(worker && worker->current_pwq->wq == target_wq &&
> + worker->task == current &&
> + (target_work ? worker->current_work == target_work : true),
> + "workqueue: current work function:%ps is flushing own workqueue:%s",
> + worker->current_func, target_wq->name);
So, the idea is that we catch these with lockdeps. Doesn't lockdep trigger
for the same condition?
Thanks.
--
tejun