Re: irda weirdness

From: Martin Diehl
Date: Sun Oct 05 2003 - 11:02:04 EST


On Sun, 5 Oct 2003, Mikko Korhonen wrote:

> I'm getting
> Debug: sleeping function called from invalid context at
> include/asm/uaccess.h:498

copy_from_user called from context where sleeping is not allowed. No idea
where this is comming from - it's not in your calltrace.

> and Badness in local_bh_enable at kernel/softirq.c:119

local_bh_enable called with irqs_disabled.

Your calltrace suggests it's called from sirdev_hard_xmit, i.e. the final
spin_unlock_bh - definitedly a bad idea because netdev->hard_start_xmit
is already called with bh disabled. However, I'm not sure is this is the
whole story because I fail to see who might call us with interrupts off.

Could you try the patch below?

Martin

------------------------

--- linux-2.6.0-test6-bk5/drivers/net/irda/sir_dev.c Sat Oct 4 11:45:44 2003
+++ v2.6.0-test6-bk5-md/drivers/net/irda/sir_dev.c Sun Oct 5 17:20:13 2003
@@ -306,8 +306,8 @@ static int sirdev_hard_xmit(struct sk_bu
IRDA_DEBUG(3, "%s(), write not completed\n", __FUNCTION__);
}

- /* serialize with write completion */
- spin_lock_bh(&dev->tx_lock);
+ /* serialize with write completion - bh's already disabled */
+ spin_lock(&dev->tx_lock);

/* Copy skb to tx_buff while wrapping, stuffing and making CRC */
dev->tx_buff.len = async_wrap_skb(skb, dev->tx_buff.data, dev->tx_buff.truesize);
@@ -337,7 +337,7 @@ static int sirdev_hard_xmit(struct sk_bu
dev->stats.tx_dropped++;
netif_wake_queue(ndev);
}
- spin_unlock_bh(&dev->tx_lock);
+ spin_unlock(&dev->tx_lock);

return 0;
}

-
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/