Subject: Re: [patch] locking, percpu counters: introduce separate lock classes

From: Ingo Molnar <[email-masked]>
Date: Tue, 30 Dec 2008 07:05:36 +0100

* Herbert Xu <[email-masked]> wrote:

> On Mon, Dec 29, 2008 at 03:14:17PM +0100, Ingo Molnar wrote:
> >
> > my testing efforts today are not particularly dominated by luck :-)
> > 
> > Below is the latest splat that i got with Peter's patch plus the revert of 
> > dd24c00191 applied.
> 
> > [   78.679386] 
> > [   78.679389] =================================
> > [   78.680039] [ INFO: inconsistent lock state ]
> > [   78.680039] 2.6.28-tip-03885-g44c31d5-dirty #13188
> > [   78.680039] ---------------------------------
> > [   78.680039] inconsistent {softirq-on-W} -> {in-softirq-W} usage.
> > [   78.680039] ssh/4054 [HC0[0]:SC1[1]:HE1:SE0] takes:
> > [   78.680039]  (key#8){-+..}, at: [<c042710e>] __percpu_counter_add+0x52/0x7a
> > [   78.680039] {softirq-on-W} state was registered at:
> > [   78.680039]   [<c0163e6e>] __lock_acquire+0x288/0xa93
> > [   78.680039]   [<c01646d6>] lock_acquire+0x5d/0x7a
> > [   78.680039]   [<c0ae0473>] _spin_lock+0x20/0x2f
> > [   78.680039]   [<c042710e>] __percpu_counter_add+0x52/0x7a
> > [   78.680039]   [<c09c3e2f>] percpu_counter_add+0xf/0x12
> > [   78.680039]   [<c09c50ef>] tcp_v4_init_sock+0xe5/0xea
> 
> Right, this is the correct version of the earlier splat :)
> 
> Anyway, I've extended Peter's patch to cover the other cases.
> Please let me know if it still bitches with this + Peter's fbc
> patch.
> 
> net: Fix percpu counters deadlock
> 
> When we converted the protocol atomic counters such as the orphan
> count and the total socket count deadlocks were introduced due to
> the mismatch in BH status of the spots that used the percpu counter
> operations.
> 
> Based on the diagnosis and patch by Peter Zijlstra, this patch
> fixes these issues by disabling BH where we may be in process
> context.
> 
> Signed-off-by: Herbert Xu <[email-masked]>

thanks, will start testing it now.

One small nit: could you please add the Reported-by line for Jeff Kirscher 
who reported the problem originally:

 Reported-by: Jeff Kirsher <[email-masked]>

	Ingo