netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] net: stmmac: use __napi_schedule() for PREEMPT_RT
@ 2021-01-12 14:01 Sebastien Laveze
  2021-01-13 23:50 ` Jakub Kicinski
  0 siblings, 1 reply; 2+ messages in thread
From: Sebastien Laveze @ 2021-01-12 14:01 UTC (permalink / raw)
  To: Giuseppe Cavallaro, Alexandre Torgue, Jose Abreu,
	David S . Miller, Jakub Kicinski, Maxime Coquelin, netdev,
	linux-stm32, linux-arm-kernel, linux-kernel
  Cc: linux-rt-users

From: Seb Laveze <sebastien.laveze@nxp.com>

Use of __napi_schedule_irqoff() is not safe with PREEMPT_RT in which
hard interrupts are not disabled while running the threaded interrupt.

Using __napi_schedule() works for both PREEMPT_RT and mainline Linux,
just at the cost of an additional check if interrupts are disabled for
mainline (since they are already disabled).

Similar to the fix done for enetc:
215602a8d212 ("enetc: use napi_schedule to be compatible with PREEMPT_RT")

Signed-off-by: Seb Laveze <sebastien.laveze@nxp.com>
---
 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 5b1c12ff98c0..2d90d6856ec5 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -2184,7 +2184,7 @@ static int stmmac_napi_check(struct stmmac_priv *priv, u32 chan)
 			spin_lock_irqsave(&ch->lock, flags);
 			stmmac_disable_dma_irq(priv, priv->ioaddr, chan, 1, 0);
 			spin_unlock_irqrestore(&ch->lock, flags);
-			__napi_schedule_irqoff(&ch->rx_napi);
+			__napi_schedule(&ch->rx_napi);
 		}
 	}
 
@@ -2193,7 +2193,7 @@ static int stmmac_napi_check(struct stmmac_priv *priv, u32 chan)
 			spin_lock_irqsave(&ch->lock, flags);
 			stmmac_disable_dma_irq(priv, priv->ioaddr, chan, 0, 1);
 			spin_unlock_irqrestore(&ch->lock, flags);
-			__napi_schedule_irqoff(&ch->tx_napi);
+			__napi_schedule(&ch->tx_napi);
 		}
 	}
 
-- 
2.25.1


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

* Re: [PATCH net] net: stmmac: use __napi_schedule() for PREEMPT_RT
  2021-01-12 14:01 [PATCH net] net: stmmac: use __napi_schedule() for PREEMPT_RT Sebastien Laveze
@ 2021-01-13 23:50 ` Jakub Kicinski
  0 siblings, 0 replies; 2+ messages in thread
From: Jakub Kicinski @ 2021-01-13 23:50 UTC (permalink / raw)
  To: Sebastien Laveze
  Cc: Giuseppe Cavallaro, Alexandre Torgue, Jose Abreu,
	David S . Miller, Maxime Coquelin, netdev, linux-stm32,
	linux-arm-kernel, linux-kernel, linux-rt-users

On Tue, 12 Jan 2021 15:01:22 +0100 Sebastien Laveze wrote:
> From: Seb Laveze <sebastien.laveze@nxp.com>
> 
> Use of __napi_schedule_irqoff() is not safe with PREEMPT_RT in which
> hard interrupts are not disabled while running the threaded interrupt.
> 
> Using __napi_schedule() works for both PREEMPT_RT and mainline Linux,
> just at the cost of an additional check if interrupts are disabled for
> mainline (since they are already disabled).
> 
> Similar to the fix done for enetc:
> 215602a8d212 ("enetc: use napi_schedule to be compatible with PREEMPT_RT")
> 
> Signed-off-by: Seb Laveze <sebastien.laveze@nxp.com>

Fixed up the commit message to appease checkpatch and applied, thanks!

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

end of thread, other threads:[~2021-01-13 23:55 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-12 14:01 [PATCH net] net: stmmac: use __napi_schedule() for PREEMPT_RT Sebastien Laveze
2021-01-13 23:50 ` Jakub Kicinski

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).