[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20091218153930.GA15922@elte.hu>
Date:	Fri, 18 Dec 2009 16:39:30 +0100
From:	Ingo Molnar <mingo@...e.hu>
To:	Linus Torvalds <torvalds@...ux-foundation.org>
Cc:	Peter Zijlstra <peterz@...radead.org>, Tejun Heo <tj@...nel.org>,
	awalls@...ix.net, linux-kernel@...r.kernel.org, jeff@...zik.org,
	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
* Linus Torvalds <torvalds@...ux-foundation.org> wrote:
> 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.
Do you mean like the annotations we added in:
  4e6045f: workqueue: debug flushing deadlocks with lockdep
  a67da70: workqueues: lockdep annotations for flush_work()
?
It looks like this currently in the worklet:
                lock_map_acquire(&cwq->wq->lockdep_map);
                lock_map_acquire(&lockdep_map);
                f(work);
                lock_map_release(&lockdep_map);
                lock_map_release(&cwq->wq->lockdep_map);
and like this in flush:
        lock_map_acquire(&wq->lockdep_map);
        lock_map_release(&wq->lockdep_map);
        for_each_cpu(cpu, cpu_map)
                flush_cpu_workqueue(per_cpu_ptr(wq->cpu_wq, cpu));
We basically track the implicit dependencies even if they are not executed 
(only theoretically possible) - and we subsequently caught a few bugs that 
way.
Or did you have some other dependency in mind?
	Ingo
--
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