Re: [PATCH] workaround minor lockdep bug triggered by mm_take_all_locks

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Andrea Arcangeli
Date: Monday, August 4, 2008 - 2:30 pm

On Tue, Aug 05, 2008 at 12:14:48AM +0300, Pekka Enberg wrote:

My understand is that lockdep can't do static analysis of code, it's
not a checker. It can only evaluate the locks in the order the cpu
takes them. And if the CPU never takes them in the wrong order because
only your unlikely to happen slow path takes them in the wrong order
while the other cpus hold them in the opposite order, lockdep can't
say nothing at all, how could it? If it would say something when the
cpu doesn't deadlock a moment later, then it would be a false positive
99% of the time.

So now we learn lockdep also lead developers to think if their code
doesn't generate lockdep errors it will be safe in production, so
again more damage thanks to lockdep.

Lockdep is a printk that reports that you were incredibly lucky, that
you got the lock inversion during development even if there was only
once chance in a thousand, and that you can celebrate. But I know I
can figure it out by myself when the system has crashed without
something eating all cpu and polluting kernel common code to tell me.

In other words I imagine lockdep as something like this:

	char *ptr = NULL
	BUG_ON(!ptr); /* this is lockdep */
	*ptr = 100;

Luckily nobody dreams to add BUG_ON that checks for null pointer to
dereference, as there's the mmu for that.

The same way for the null pointer dereference, there are zerocost
means to debug all sort of kernel crashing deadlocks.

Now perhaps I misunderstood lockdep entirely but I doubt as this thing
is driven by calls made by the spin_lock functions, and it can't know
anything about the spin_lock that haven't been run by the cpu yet.
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[RFC][PATCH 7/7] lockdep: spin_lock_nest_lock(), Peter Zijlstra, (Mon Aug 4, 6:03 am)
Re: [RFC][PATCH 7/7] lockdep: spin_lock_nest_lock(), Roland Dreier, (Mon Aug 4, 7:07 am)
Re: [RFC][PATCH 7/7] lockdep: spin_lock_nest_lock(), Peter Zijlstra, (Mon Aug 4, 7:19 am)
Re: [RFC][PATCH 7/7] lockdep: spin_lock_nest_lock(), Roland Dreier, (Mon Aug 4, 7:26 am)
Re: [RFC][PATCH 7/7] lockdep: spin_lock_nest_lock(), Peter Zijlstra, (Mon Aug 4, 7:32 am)
Re: [RFC][PATCH 7/7] lockdep: spin_lock_nest_lock(), Dave Jones, (Mon Aug 4, 7:53 am)
Re: [RFC][PATCH 7/7] lockdep: spin_lock_nest_lock(), Peter Zijlstra, (Mon Aug 4, 7:56 am)
Re: [RFC][PATCH 7/7] lockdep: spin_lock_nest_lock(), Andrea Arcangeli, (Mon Aug 4, 9:26 am)
Re: [RFC][PATCH 7/7] lockdep: spin_lock_nest_lock(), Peter Zijlstra, (Mon Aug 4, 9:38 am)
Re: [RFC][PATCH 7/7] lockdep: spin_lock_nest_lock(), Andrea Arcangeli, (Mon Aug 4, 10:27 am)
Re: [RFC][PATCH 7/7] lockdep: spin_lock_nest_lock(), Andrea Arcangeli, (Mon Aug 4, 10:46 am)
Re: [RFC][PATCH 7/7] lockdep: spin_lock_nest_lock(), Jeremy Fitzhardinge, (Mon Aug 4, 11:06 am)
Re: [RFC][PATCH 7/7] lockdep: spin_lock_nest_lock(), Peter Zijlstra, (Mon Aug 4, 11:48 am)
Re: [RFC][PATCH 7/7] lockdep: spin_lock_nest_lock(), Peter Zijlstra, (Mon Aug 4, 11:54 am)
Re: [RFC][PATCH 7/7] lockdep: spin_lock_nest_lock(), Jeremy Fitzhardinge, (Mon Aug 4, 12:26 pm)
Re: [RFC][PATCH 7/7] lockdep: spin_lock_nest_lock(), Linus Torvalds, (Mon Aug 4, 12:31 pm)
Re: [RFC][PATCH 7/7] lockdep: spin_lock_nest_lock(), Peter Zijlstra, (Mon Aug 4, 12:39 pm)
Re: [RFC][PATCH 7/7] lockdep: spin_lock_nest_lock(), Jeremy Fitzhardinge, (Mon Aug 4, 1:16 pm)
Re: [PATCH] workaround minor lockdep bug triggered by mm_t ..., Andrea Arcangeli, (Mon Aug 4, 2:30 pm)
Re: [RFC][PATCH 7/7] lockdep: spin_lock_nest_lock(), David Miller, (Mon Aug 4, 2:32 pm)
Re: [RFC][PATCH 7/7] lockdep: spin_lock_nest_lock(), Peter Zijlstra, (Thu Aug 7, 4:25 am)
Re: [RFC][PATCH 7/7] lockdep: spin_lock_nest_lock(), Steven Rostedt, (Wed Oct 8, 8:27 am)
Re: [RFC][PATCH 7/7] lockdep: spin_lock_nest_lock(), Linus Torvalds, (Wed Oct 8, 8:43 am)
Re: [RFC][PATCH 7/7] lockdep: spin_lock_nest_lock(), Nick Piggin, (Wed Oct 8, 8:52 am)
Re: [RFC][PATCH 7/7] lockdep: spin_lock_nest_lock(), Steven Rostedt, (Wed Oct 8, 9:03 am)
Re: [RFC][PATCH 7/7] lockdep: spin_lock_nest_lock(), Linus Torvalds, (Wed Oct 8, 9:19 am)
Re: [RFC][PATCH 7/7] lockdep: spin_lock_nest_lock(), Steven Rostedt, (Wed Oct 8, 9:53 am)
Re: [RFC][PATCH 7/7] lockdep: spin_lock_nest_lock(), Steven Rostedt, (Wed Oct 8, 10:18 am)