[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220203184031.1074008-2-yannick.vignon@oss.nxp.com>
Date: Thu, 3 Feb 2022 19:40:31 +0100
From: Yannick Vignon <yannick.vignon@....nxp.com>
To: Giuseppe Cavallaro <peppe.cavallaro@...com>,
Alexandre Torgue <alexandre.torgue@...s.st.com>,
Jose Abreu <joabreu@...opsys.com>,
"David S. Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>,
Maxime Coquelin <mcoquelin.stm32@...il.com>,
Eric Dumazet <edumazet@...gle.com>,
Antoine Tenart <atenart@...nel.org>,
Alexander Lobakin <alexandr.lobakin@...el.com>,
Sebastian Andrzej Siewior <bigeasy@...utronix.de>,
Paolo Abeni <pabeni@...hat.com>, Wei Wang <weiwan@...gle.com>,
Kumar Kartikeya Dwivedi <memxor@...il.com>,
Yunsheng Lin <linyunsheng@...wei.com>,
Arnd Bergmann <arnd@...db.de>, netdev@...r.kernel.org,
Vladimir Oltean <olteanv@...il.com>,
Xiaoliang Yang <xiaoliang.yang_1@....com>, mingkai.hu@....com,
Joakim Zhang <qiangqing.zhang@....com>,
sebastien.laveze@....com
Cc: Yannick Vignon <yannick.vignon@....com>
Subject: [PATCH net-next 2/2] net: stmmac: move to threaded IRQ
From: Yannick Vignon <yannick.vignon@....com>
When an IRQ is forced threaded (such as with PREEMPT_RT), execution of the
handler remains protected by local_bh_disable()/local_bh_enable() calls to
keep the semantics of the IRQ context and avoid deadlocks. However, this
also creates a contention point where a higher prio interrupt handler gets
blocked by a lower prio task already holding the lock. Even though priority
inheritance kicks in in such a case, the lower prio task can still execute
for an indefinite time.
Move the stmmac interrupts to be explicitly threaded, so that high priority
traffic can be processed without delay even if another piece of code was
already running with BH disabled.
Signed-off-by: Yannick Vignon <yannick.vignon@....com>
---
.../net/ethernet/stmicro/stmmac/stmmac_main.c | 28 +++++++++----------
1 file changed, 14 insertions(+), 14 deletions(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index bde76ea2deec..4bfc2cb89456 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -3459,8 +3459,8 @@ static int stmmac_request_irq_multi_msi(struct net_device *dev)
/* For common interrupt */
int_name = priv->int_name_mac;
sprintf(int_name, "%s:%s", dev->name, "mac");
- ret = request_irq(dev->irq, stmmac_mac_interrupt,
- 0, int_name, dev);
+ ret = request_threaded_irq(dev->irq, NULL, stmmac_mac_interrupt,
+ IRQF_ONESHOT, int_name, dev);
if (unlikely(ret < 0)) {
netdev_err(priv->dev,
"%s: alloc mac MSI %d (error: %d)\n",
@@ -3475,9 +3475,9 @@ static int stmmac_request_irq_multi_msi(struct net_device *dev)
if (priv->wol_irq > 0 && priv->wol_irq != dev->irq) {
int_name = priv->int_name_wol;
sprintf(int_name, "%s:%s", dev->name, "wol");
- ret = request_irq(priv->wol_irq,
- stmmac_mac_interrupt,
- 0, int_name, dev);
+ ret = request_threaded_irq(priv->wol_irq,
+ NULL, stmmac_mac_interrupt,
+ IRQF_ONESHOT, int_name, dev);
if (unlikely(ret < 0)) {
netdev_err(priv->dev,
"%s: alloc wol MSI %d (error: %d)\n",
@@ -3493,9 +3493,9 @@ static int stmmac_request_irq_multi_msi(struct net_device *dev)
if (priv->lpi_irq > 0 && priv->lpi_irq != dev->irq) {
int_name = priv->int_name_lpi;
sprintf(int_name, "%s:%s", dev->name, "lpi");
- ret = request_irq(priv->lpi_irq,
- stmmac_mac_interrupt,
- 0, int_name, dev);
+ ret = request_threaded_irq(priv->lpi_irq,
+ NULL, stmmac_mac_interrupt,
+ IRQF_ONESHOT, int_name, dev);
if (unlikely(ret < 0)) {
netdev_err(priv->dev,
"%s: alloc lpi MSI %d (error: %d)\n",
@@ -3604,8 +3604,8 @@ static int stmmac_request_irq_single(struct net_device *dev)
enum request_irq_err irq_err;
int ret;
- ret = request_irq(dev->irq, stmmac_interrupt,
- IRQF_SHARED, dev->name, dev);
+ ret = request_threaded_irq(dev->irq, NULL, stmmac_interrupt,
+ IRQF_SHARED | IRQF_ONESHOT, dev->name, dev);
if (unlikely(ret < 0)) {
netdev_err(priv->dev,
"%s: ERROR: allocating the IRQ %d (error: %d)\n",
@@ -3618,8 +3618,8 @@ static int stmmac_request_irq_single(struct net_device *dev)
* is used for WoL
*/
if (priv->wol_irq > 0 && priv->wol_irq != dev->irq) {
- ret = request_irq(priv->wol_irq, stmmac_interrupt,
- IRQF_SHARED, dev->name, dev);
+ ret = request_threaded_irq(priv->wol_irq, NULL, stmmac_interrupt,
+ IRQF_SHARED | IRQF_ONESHOT, dev->name, dev);
if (unlikely(ret < 0)) {
netdev_err(priv->dev,
"%s: ERROR: allocating the WoL IRQ %d (%d)\n",
@@ -3631,8 +3631,8 @@ static int stmmac_request_irq_single(struct net_device *dev)
/* Request the IRQ lines */
if (priv->lpi_irq > 0 && priv->lpi_irq != dev->irq) {
- ret = request_irq(priv->lpi_irq, stmmac_interrupt,
- IRQF_SHARED, dev->name, dev);
+ ret = request_threaded_irq(priv->lpi_irq, NULL, stmmac_interrupt,
+ IRQF_SHARED | IRQF_ONESHOT, dev->name, dev);
if (unlikely(ret < 0)) {
netdev_err(priv->dev,
"%s: ERROR: allocating the LPI IRQ %d (%d)\n",
--
2.25.1
Powered by blists - more mailing lists