linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net v3 0/4] net: don't call dev_kfree_skb() under spin_lock_irqsave()
@ 2022-12-08 14:21 Yang Yingliang
  2022-12-08 14:21 ` [PATCH net v3 1/4] net: emaclite: " Yang Yingliang
  2022-12-12 10:10 ` [PATCH net v3 0/4] net: " patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: Yang Yingliang @ 2022-12-08 14:21 UTC (permalink / raw)
  To: netdev
  Cc: davem, edumazet, kuba, pabeni, leon, Yang Yingliang,
	Michal Simek, John Linn, Sadanand M, linux-arm-kernel,
	Ilya Yanok, Joerg Reuter, linux-hams

It is not allowed to call consume_skb() from hardware interrupt context
or with interrupts being disabled. This patchset replace dev_kfree_skb()
with dev_kfree_skb_irq/dev_consume_skb_irq() under spin_lock_irqsave()
in some drivers, or move dev_kfree_skb() after spin_unlock_irqrestore().

v2 -> v3:
  Update commit message, and change to use dev_kfree_skb_irq() in patch #1, #3.

v1 -> v2:
  patch #2 Move dev_kfree_skb() after spin_unlock_irqrestore()

Yang Yingliang (4):
  net: emaclite: don't call dev_kfree_skb() under spin_lock_irqsave()
  net: ethernet: dnet: don't call dev_kfree_skb() under
    spin_lock_irqsave()
  hamradio: don't call dev_kfree_skb() under spin_lock_irqsave()
  net: amd: lance: don't call dev_kfree_skb() under spin_lock_irqsave()

 drivers/net/ethernet/amd/atarilance.c         | 2 +-
 drivers/net/ethernet/amd/lance.c              | 2 +-
 drivers/net/ethernet/dnet.c                   | 4 ++--
 drivers/net/ethernet/xilinx/xilinx_emaclite.c | 2 +-
 drivers/net/hamradio/scc.c                    | 6 +++---
 5 files changed, 8 insertions(+), 8 deletions(-)

-- 
2.25.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH net v3 1/4] net: emaclite: don't call dev_kfree_skb() under spin_lock_irqsave()
  2022-12-08 14:21 [PATCH net v3 0/4] net: don't call dev_kfree_skb() under spin_lock_irqsave() Yang Yingliang
@ 2022-12-08 14:21 ` Yang Yingliang
  2022-12-12 10:10 ` [PATCH net v3 0/4] net: " patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: Yang Yingliang @ 2022-12-08 14:21 UTC (permalink / raw)
  To: netdev
  Cc: davem, edumazet, kuba, pabeni, leon, Yang Yingliang,
	Michal Simek, John Linn, Sadanand M, Harini Katakam,
	linux-arm-kernel

It is not allowed to call kfree_skb() or consume_skb() from hardware
interrupt context or with hardware interrupts being disabled.

It should use dev_kfree_skb_irq() or dev_consume_skb_irq() instead.
The difference between them is free reason, dev_kfree_skb_irq() means
the SKB is dropped in error and dev_consume_skb_irq() means the SKB
is consumed in normal.

In this case, dev_kfree_skb() is called in xemaclite_tx_timeout() to
drop the SKB, when tx timeout, so replace it with dev_kfree_skb_irq().

Fixes: bb81b2ddfa19 ("net: add Xilinx emac lite device driver")
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
---
 drivers/net/ethernet/xilinx/xilinx_emaclite.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/xilinx/xilinx_emaclite.c b/drivers/net/ethernet/xilinx/xilinx_emaclite.c
index a3967f8de417..a1e1387ea84e 100644
--- a/drivers/net/ethernet/xilinx/xilinx_emaclite.c
+++ b/drivers/net/ethernet/xilinx/xilinx_emaclite.c
@@ -536,7 +536,7 @@ static void xemaclite_tx_timeout(struct net_device *dev, unsigned int txqueue)
 	xemaclite_enable_interrupts(lp);
 
 	if (lp->deferred_skb) {
-		dev_kfree_skb(lp->deferred_skb);
+		dev_kfree_skb_irq(lp->deferred_skb);
 		lp->deferred_skb = NULL;
 		dev->stats.tx_errors++;
 	}
-- 
2.25.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH net v3 0/4] net: don't call dev_kfree_skb() under spin_lock_irqsave()
  2022-12-08 14:21 [PATCH net v3 0/4] net: don't call dev_kfree_skb() under spin_lock_irqsave() Yang Yingliang
  2022-12-08 14:21 ` [PATCH net v3 1/4] net: emaclite: " Yang Yingliang
@ 2022-12-12 10:10 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2022-12-12 10:10 UTC (permalink / raw)
  To: Yang Yingliang
  Cc: netdev, davem, edumazet, kuba, pabeni, leon, michal.simek,
	john.linn, sadanan, linux-arm-kernel, yanok, jreuter, linux-hams

Hello:

This series was applied to netdev/net.git (master)
by David S. Miller <davem@davemloft.net>:

On Thu, 8 Dec 2022 22:21:43 +0800 you wrote:
> It is not allowed to call consume_skb() from hardware interrupt context
> or with interrupts being disabled. This patchset replace dev_kfree_skb()
> with dev_kfree_skb_irq/dev_consume_skb_irq() under spin_lock_irqsave()
> in some drivers, or move dev_kfree_skb() after spin_unlock_irqrestore().
> 
> v2 -> v3:
>   Update commit message, and change to use dev_kfree_skb_irq() in patch #1, #3.
> 
> [...]

Here is the summary with links:
  - [net,v3,1/4] net: emaclite: don't call dev_kfree_skb() under spin_lock_irqsave()
    https://git.kernel.org/netdev/net/c/d1678bf45f21
  - [net,v3,2/4] net: ethernet: dnet: don't call dev_kfree_skb() under spin_lock_irqsave()
    https://git.kernel.org/netdev/net/c/f07fadcbee2a
  - [net,v3,3/4] hamradio: don't call dev_kfree_skb() under spin_lock_irqsave()
    https://git.kernel.org/netdev/net/c/3727f742915f
  - [net,v3,4/4] net: amd: lance: don't call dev_kfree_skb() under spin_lock_irqsave()
    https://git.kernel.org/netdev/net/c/6151d105dfce

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-12-12 10:11 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-08 14:21 [PATCH net v3 0/4] net: don't call dev_kfree_skb() under spin_lock_irqsave() Yang Yingliang
2022-12-08 14:21 ` [PATCH net v3 1/4] net: emaclite: " Yang Yingliang
2022-12-12 10:10 ` [PATCH net v3 0/4] net: " patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).