mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Tejun Heo <tj@kernel.org>
To: Qianli Zhao <zhaoqianligood@gmail.com>
Cc: jiangshanlai@gmail.com, dan.carpenter@oracle.com,
	Markus.Elfring@web.de, linux-kernel@vger.kernel.org,
	zhaoqianli@xiaomi.com
Subject: Re: [PATCH v4] workqueue: Warn when work flush own workqueue
Date: Fri, 4 Sep 2020 13:04:01 -0400	[thread overview]
Message-ID: <20200904170401.GB4295@mtj.thefacebook.com> (raw)
In-Reply-To: <4c1287b0881e780368623314348f704bd43e9bd2.1598507105.git.zhaoqianli@xiaomi.com>

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

      reply	other threads:[~2020-09-04 18:10 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-27  6:09 Qianli Zhao
2020-09-04 17:04 ` Tejun Heo [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200904170401.GB4295@mtj.thefacebook.com \
    --to=tj@kernel.org \
    --cc=Markus.Elfring@web.de \
    --cc=dan.carpenter@oracle.com \
    --cc=jiangshanlai@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=zhaoqianli@xiaomi.com \
    --cc=zhaoqianligood@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®