Skip to content

Commit

Permalink
pkt_sched: Prevent livelock in TX queue running.
Browse files Browse the repository at this point in the history
If dev_deactivate() is trying to quiesce the queue, it
is theoretically possible for another cpu to livelock
trying to process that queue.  This happens because
dev_deactivate() grabs the queue spinlock as it checks
the queue state, whereas net_tx_action() does a trylock
and reschedules the qdisc if it hits the lock.

This breaks the livelock by adding a check on
__QDISC_STATE_DEACTIVATED to net_tx_action() when
the trylock fails.

Based upon feedback from Herbert Xu and Jarek Poplawski.

Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
David S. Miller committed Aug 19, 2008
1 parent d280539 commit 195648b
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion net/core/dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -1990,7 +1990,9 @@ static void net_tx_action(struct softirq_action *h)
qdisc_run(q);
spin_unlock(root_lock);
} else {
__netif_reschedule(q);
if (!test_bit(__QDISC_STATE_DEACTIVATED,
&q->state))
__netif_reschedule(q);
}
}
}
Expand Down

0 comments on commit 195648b

Please sign in to comment.