All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] stmmac: Don't access tx_q->dirty_tx before netif_tx_lock
@ 2017-10-21  6:51 Bernd Edlinger
  2017-10-22  2:25 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Bernd Edlinger @ 2017-10-21  6:51 UTC (permalink / raw)
  To: Giuseppe Cavallaro, Alexandre Torgue; +Cc: netdev, linux-kernel

This is the possible reason for different hard to reproduce
problems on my ARMv7-SMP test system.

The symptoms are in recent kernels imprecise external aborts,
and in older kernels various kinds of network stalls and
unexpected page allocation failures.

My testing indicates that the trouble started between v4.5 and v4.6
and prevails up to v4.14.

Using the dirty_tx before acquiring the spin lock is clearly
wrong and was first introduced with v4.6.

Fixes: e3ad57c96715 ("stmmac: review RX/TX ring management")

Signed-off-by: Bernd Edlinger <bernd.edlinger@hotmail.de>
---
 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 1763e48..c8e280fa 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -1800,12 +1800,13 @@ static void stmmac_tx_clean(struct stmmac_priv *priv, u32 queue)
 {
 	struct stmmac_tx_queue *tx_q = &priv->tx_queue[queue];
 	unsigned int bytes_compl = 0, pkts_compl = 0;
-	unsigned int entry = tx_q->dirty_tx;
+	unsigned int entry;
 
 	netif_tx_lock(priv->dev);
 
 	priv->xstats.tx_clean++;
 
+	entry = tx_q->dirty_tx;
 	while (entry != tx_q->cur_tx) {
 		struct sk_buff *skb = tx_q->tx_skbuff[entry];
 		struct dma_desc *p;
-- 
1.9.1

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

* Re: [PATCH] stmmac: Don't access tx_q->dirty_tx before netif_tx_lock
  2017-10-21  6:51 [PATCH] stmmac: Don't access tx_q->dirty_tx before netif_tx_lock Bernd Edlinger
@ 2017-10-22  2:25 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2017-10-22  2:25 UTC (permalink / raw)
  To: bernd.edlinger; +Cc: peppe.cavallaro, alexandre.torgue, netdev, linux-kernel

From: Bernd Edlinger <bernd.edlinger@hotmail.de>
Date: Sat, 21 Oct 2017 06:51:30 +0000

> This is the possible reason for different hard to reproduce
> problems on my ARMv7-SMP test system.
> 
> The symptoms are in recent kernels imprecise external aborts,
> and in older kernels various kinds of network stalls and
> unexpected page allocation failures.
> 
> My testing indicates that the trouble started between v4.5 and v4.6
> and prevails up to v4.14.
> 
> Using the dirty_tx before acquiring the spin lock is clearly
> wrong and was first introduced with v4.6.
> 
> Fixes: e3ad57c96715 ("stmmac: review RX/TX ring management")
> 
> Signed-off-by: Bernd Edlinger <bernd.edlinger@hotmail.de>

Applied, thank you.

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

end of thread, other threads:[~2017-10-22  2:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-21  6:51 [PATCH] stmmac: Don't access tx_q->dirty_tx before netif_tx_lock Bernd Edlinger
2017-10-22  2:25 ` David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.