All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Byungchul Park <max.byungchul.park@gmail.com>
Cc: Tejun Heo <tj@kernel.org>,
	Byungchul Park <byungchul.park@lge.com>,
	johannes.berg@intel.com, Ingo Molnar <mingo@kernel.org>,
	tglx@linutronix.de,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	kernel-team@lge.com
Subject: Re: [RFC] workqueue: remove manual lockdep uses to detect deadlocks
Date: Tue, 29 Aug 2017 20:57:27 +0200	[thread overview]
Message-ID: <20170829185727.GY32112@worktop.programming.kicks-ass.net> (raw)
In-Reply-To: <CANrsvRP_os8F4qZSEo_cfuM1oBcMnUGx-H28kGfzv0OGmcygLg@mail.gmail.com>

On Sat, Aug 26, 2017 at 12:49:26AM +0900, Byungchul Park wrote:
> > However, how would it distinguish things like flushing another work
> 
> I think it must be distinguished with what it actually waits for, e.i.
> completion
> variables instead of work or wq. I will make it next week and let you know.

So no. The existing annotations are strictly better than relying on
cross-release.

As you know the problem with cross-release is that it is timing
dependent. You need to actually observe the problematic sequence before
it can warn, and only the whole instance->class mapping saves us from
actually hitting the deadlock.

Cross-release can result in deadlocks without warnings. If you were to
run:

	mutex_lock(A);
					mutex_lock(A);
					complete(C);
	wait_for_completion(C);

You'd deadlock without issue. Only if we observe this:

	mutex_lock(A);
	wait_for_completion(C);
					mutex_lock(A);
					complete(C);

Where we acquire A after wait_for_completion() but before complete()
will we observe the deadlock.

The same would be true for using cross-release for workqueues as well,
something like:

					W:
					mutex_lock(A)

	mutex_lock(A)
	flush_work(W)

would go unreported whereas the current workqueue annotation will
generate a splat.


This does not mean cross-release isn't worth it, its better than nothing,
but its strictly weaker than traditional annotations.

So where a traditional annotation is possible, we should use them.

  reply	other threads:[~2017-08-29 18:57 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-25  8:41 [RFC] workqueue: remove manual lockdep uses to detect deadlocks Byungchul Park
2017-08-25  8:52 ` Byungchul Park
2017-08-25 13:34 ` Tejun Heo
2017-08-25 15:49   ` Byungchul Park
2017-08-29 18:57     ` Peter Zijlstra [this message]
2017-08-30  1:53       ` Byungchul Park
2017-08-30  6:23         ` Peter Zijlstra
2017-08-29  0:23   ` Byungchul Park
2017-08-28  6:55 ` Peter Zijlstra
2017-08-28 10:53   ` Byungchul Park
2017-08-29  0:55   ` Byungchul Park

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=20170829185727.GY32112@worktop.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=byungchul.park@lge.com \
    --cc=johannes.berg@intel.com \
    --cc=kernel-team@lge.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=max.byungchul.park@gmail.com \
    --cc=mingo@kernel.org \
    --cc=tglx@linutronix.de \
    --cc=tj@kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.