Re: Lockup with 2.6.9-ac15 related to netconsole

From: Patrick McHardy
Date: Wed Dec 22 2004 - 05:56:53 EST


Patrick McHardy wrote:
Francois Romieu wrote:

Marc, if the patch below happens to work, it should not drop messages
like the previous one (it is an ugly short-term suggestion).


- spin_lock(&np->dev->xmit_lock);
+ while (!spin_trylock(&np->dev->xmit_lock)) {
+ if (np->dev->xmit_lock_owner == smp_processor_id()) {
+ struct Qdisc *q = dev->qdisc;
+
+ q->ops->enqueue(skb, q);


Shouldn't this be requeue ?

Since the code doesn't dequeue itself, enqueue seems fine to keep
at least the queued messages ordered. But you need to grab
dev->queue_lock, otherwise you risk corrupting qdisc internal data.
You should probably also deal with the noqueue-qdisc, which doesn't
have an enqueue function. So it should look something like this:

while (!spin_trylock(&np->dev->xmit_lock)) {
if (np->dev->xmit_lock_owner == smp_processor_id()) {
struct Qdisc *q;

rcu_read_lock();
q = rcu_dereference(dev->qdisc);
if (q->enqueue) {
spin_lock(&dev->queue_lock);
q->ops->enqueue(skb, q);
spin_unlock(&dev->queue_lock);
netif_schedule(np->dev);
} else
kfree_skb(skb);
rcu_read_unlock();
return;
}
}

Regards
Patrick
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/