On Thu, 12 Nov 2020 13:59:49 -0500 Sven Van Asbroeck wrote:
> From: Sven Van Asbroeck <thesve...@gmail.com>
> 
> When running this chip on arm imx6, we intermittently observe
> the following kernel warning in the log, especially when the
> system is under high load:

> The driver is calling dev_kfree_skb() from code inside a spinlock,
> where h/w interrupts are disabled. This is forbidden, as documented
> in include/linux/netdevice.h. The correct function to use
> dev_kfree_skb_irq(), or dev_kfree_skb_any().
> 
> Fix by using the correct dev_kfree_skb_xxx() functions:
> 
> in lan743x_tx_release_desc():
>   called by lan743x_tx_release_completed_descriptors()
>     called by in lan743x_tx_napi_poll()
>     which holds a spinlock
>   called by lan743x_tx_release_all_descriptors()
>     called by lan743x_tx_close()
>     which can-sleep
> conclusion: use dev_kfree_skb_any()
> 
> in lan743x_tx_xmit_frame():
>   which holds a spinlock
> conclusion: use dev_kfree_skb_irq()
> 
> in lan743x_tx_close():
>   which can-sleep
> conclusion: use dev_kfree_skb()
> 
> in lan743x_rx_release_ring_element():
>   called by lan743x_rx_close()
>     which can-sleep
>   called by lan743x_rx_open()
>     which can-sleep
> conclusion: use dev_kfree_skb()
> 
> Fixes: 23f0703c125b ("lan743x: Add main source files for new lan743x driver")
> Signed-off-by: Sven Van Asbroeck <thesve...@gmail.com>

Applied, thanks.

The _irq() cases look a little strange, are you planning a refactor in
net-next? Seems like the freeing can be moved outside the lock.

Also the driver could stop the queue when there is less than
MAX_SKB_FRAGS + 2 descriptors left, so it doesn't need the
"overflow_skb" thing.

Reply via email to