lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.LFD.2.00.0912180724580.3712@localhost.localdomain>
Date:	Fri, 18 Dec 2009 07:30:55 -0800 (PST)
From:	Linus Torvalds <torvalds@...ux-foundation.org>
To:	Peter Zijlstra <peterz@...radead.org>
cc:	Tejun Heo <tj@...nel.org>, awalls@...ix.net,
	linux-kernel@...r.kernel.org, jeff@...zik.org, mingo@...e.hu,
	akpm@...ux-foundation.org, jens.axboe@...cle.com,
	rusty@...tcorp.com.au, cl@...ux-foundation.org,
	dhowells@...hat.com, arjan@...ux.intel.com, avi@...hat.com,
	johannes@...solutions.net, andi@...stfloor.org
Subject: Re: workqueue thing



On Fri, 18 Dec 2009, Peter Zijlstra wrote:

> >    r1. The first design goal of cmwq is solving the issues the current
> >        workqueue implementation has including hard to detect
> >        deadlocks, 
> 
> lockdep is quite proficient at finding these these days.

I don't think so.

The reason it is not is that workqueues fundamentally do _different_ 
things in the same context, adn lockdep has no clue what-so-ever.

IOW, if you hold a lock, and then do 'flush_workqueue()', lockdep has no 
idea that maybe one of the entries on a workqueue might need the lock that 
you are holding. But I don't think lockdep sees the dependency that gets 
created by the flush - because it's not a direct code execution 
dependency.

It's not a deadlock _directly_ due to lock ordering, but indirectly due to 
waiting for unrelated code that needs locks.

Now, maybe lockdep could be _taught_ to consider workqueues themselves to 
be 'locks', and ordering those pseudo-locks wrt the real locks they take. 
So if workqueue Q takes lock A, the fact that it is _taken_ in a workqueue 
makes the ordering be Q->A. Then, if somebody does a "flush_workqueue" 
while holding lock B, the flush implies a "lock ordering" of B->Q (where 
"Q" is the set of all workqueues that could be flushed).

		Linus
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ