diff options
author | Patrick McHardy <kaber@trash.net> | 2007-07-14 23:49:26 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2007-07-14 23:49:26 -0400 |
commit | 0621ed2e4edbe2f6f83dafbf85eecefae7aaf2e8 (patch) | |
tree | 30e005117719da029a238b88c742b0a7e516ad50 /net/sched | |
parent | 59eecdfb166f6846ae356ddc744abed5820ad965 (diff) |
[NET_SCHED]: Revert "avoid transmit softirq on watchdog wakeup" optimization
As noticed by Ranko Zivojnovic <ranko@spidernet.net>, calling qdisc_run
from the timer handler can result in deadlock:
> CPU#0
>
> qdisc_watchdog() fires and gets dev->queue_lock
> qdisc_run()...qdisc_restart()...
> -> releases dev->queue_lock and enters dev_hard_start_xmit()
>
> CPU#1
>
> tc del qdisc dev ...
> qdisc_graft()...dev_graft_qdisc()...dev_deactivate()...
> -> grabs dev->queue_lock ...
>
> qdisc_reset()...{cbq,hfsc,htb,netem,tbf}_reset()...qdisc_watchdog_cancel()...
> -> hrtimer_cancel() - waiting for the qdisc_watchdog() to exit, while still
> holding dev->queue_lock
>
> CPU#0
>
> dev_hard_start_xmit() returns ...
> -> wants to get dev->queue_lock(!)
>
> DEADLOCK!
The entire optimization is a bit questionable IMO, it moves potentially
large parts of NET_TX_SOFTIRQ work to TIMER_SOFTIRQ/HRTIMER_SOFTIRQ,
which kind of defeats the separation of them.
Signed-off-by: Patrick McHardy <kaber@trash.net>
Acked-by: Ranko Zivojnovic <ranko@spidernet.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/sched')
-rw-r--r-- | net/sched/sch_api.c | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/net/sched/sch_api.c b/net/sched/sch_api.c index d92ea26982c5..4fd0beca9450 100644 --- a/net/sched/sch_api.c +++ b/net/sched/sch_api.c | |||
@@ -278,11 +278,7 @@ static enum hrtimer_restart qdisc_watchdog(struct hrtimer *timer) | |||
278 | 278 | ||
279 | wd->qdisc->flags &= ~TCQ_F_THROTTLED; | 279 | wd->qdisc->flags &= ~TCQ_F_THROTTLED; |
280 | smp_wmb(); | 280 | smp_wmb(); |
281 | if (spin_trylock(&dev->queue_lock)) { | 281 | netif_schedule(dev); |
282 | qdisc_run(dev); | ||
283 | spin_unlock(&dev->queue_lock); | ||
284 | } else | ||
285 | netif_schedule(dev); | ||
286 | 282 | ||
287 | return HRTIMER_NORESTART; | 283 | return HRTIMER_NORESTART; |
288 | } | 284 | } |