Subject: Re: + gen_estimator-fix-locking-and-timer-related-bugs.patch added to -mm tree

From: Patrick McHardy <[email-masked]>
Date: Fri, 06 Jul 2007 16:21:13 +0200

Ranko Zivojnovic wrote:
> BUG: spinlock lockup on CPU#0, swapper/0, c03eff80
>  [<c01ed1fe>] _raw_spin_lock+0x108/0x13c
>  [<c02a8468>] __qdisc_run+0x97/0x1b0
>  [<c02a96f3>] qdisc_watchdog+0x19/0x58
>  [<c02fe5e7>] __lock_text_start+0x37/0x43
>  [<c02a9730>] qdisc_watchdog+0x56/0x58
>  [<c02a96da>] qdisc_watchdog+0x0/0x58
>  [<c0135d84>] run_hrtimer_softirq+0x58/0xb5
>  [...]

> BUG: spinlock lockup on CPU#1, swapper/0, c03eff80
>  [<c01ed1fe>] _raw_spin_lock+0x108/0x13c
>  [<c0298b9b>] est_timer+0x53/0x148
>  [<c01294b3>] run_timer_softirq+0x30/0x184
>  [<c01295a4>] run_timer_softirq+0x121/0x184
>  [<c0126252>] __do_softirq+0x66/0xf3
>  [<c0298b48>] est_timer+0x0/0x148
>  [...]

There is at least one ABBA deadlock, est_timer does:

read_lock(&est_lock)
spin_lock(e->stats_lock) (which is dev->queue_lock)

and qdisc_destroy calls htb_destroy under dev->queue_lock, which
calls htb_destroy_class, then gen_kill_estimator and this
write_locks est_lock.

I can't see the problem above though, the qdisc_run path only takes
dev->queue_lock. Please enable lockdep and post the output if any.