netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next v2] net: ena: resolve WARN_ON when freeing IRQs
@ 2025-03-17  7:11 David Arinzon
  2025-03-18 23:11 ` Jacob Keller
  2025-03-24 17:00 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: David Arinzon @ 2025-03-17  7:11 UTC (permalink / raw)
  To: David Miller, Jakub Kicinski, netdev
  Cc: David Arinzon, Ahmed Zaki, Eric Dumazet, Paolo Abeni,
	Simon Horman, Richard Cochran, Woodhouse, David, Machulsky, Zorik,
	Matushevsky, Alexander, Saeed Bshara, Wilson, Matt,
	Liguori, Anthony, Bshara, Nafea, Schmeilin, Evgeny,
	Belgazal, Netanel, Saidi, Ali, Herrenschmidt, Benjamin,
	Kiyanovski, Arthur, Dagan, Noam, Bernstein, Amit, Agroskin, Shay,
	Ostrovsky, Evgeny, Tabachnik, Ofir

When IRQs are freed, a WARN_ON is triggered as the
affinity notifier is not released.
This results in the below stack trace:

[  484.544586]  ? __warn+0x84/0x130
[  484.544843]  ? free_irq+0x5c/0x70
[  484.545105]  ? report_bug+0x18a/0x1a0
[  484.545390]  ? handle_bug+0x53/0x90
[  484.545664]  ? exc_invalid_op+0x14/0x70
[  484.545959]  ? asm_exc_invalid_op+0x16/0x20
[  484.546279]  ? free_irq+0x5c/0x70
[  484.546545]  ? free_irq+0x10/0x70
[  484.546807]  ena_free_io_irq+0x5f/0x70 [ena]
[  484.547138]  ena_down+0x250/0x3e0 [ena]
[  484.547435]  ena_destroy_device+0x118/0x150 [ena]
[  484.547796]  __ena_shutoff+0x5a/0xe0 [ena]
[  484.548110]  pci_device_remove+0x3b/0xb0
[  484.548412]  device_release_driver_internal+0x193/0x200
[  484.548804]  driver_detach+0x44/0x90
[  484.549084]  bus_remove_driver+0x69/0xf0
[  484.549386]  pci_unregister_driver+0x2a/0xb0
[  484.549717]  ena_cleanup+0xc/0x130 [ena]
[  484.550021]  __do_sys_delete_module.constprop.0+0x176/0x310
[  484.550438]  ? syscall_trace_enter+0xfb/0x1c0
[  484.550782]  do_syscall_64+0x5b/0x170
[  484.551067]  entry_SYSCALL_64_after_hwframe+0x76/0x7e

Adding a call to `netif_napi_set_irq` with -1 as the IRQ index,
which frees the notifier.

Fixes: de340d8206bf ("net: ena: use napi's aRFS rmap notifers")
Signed-off-by: David Arinzon <darinzon@amazon.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Reviewed-by: Ahmed Zaki <ahmed.zaki@intel.com>
---
Changes in v2:
- Remove an unnecessary cast

Link to v1: https://lore.kernel.org/netdev/20250312143929.GT4159220@kernel.org/T/
---
 drivers/net/ethernet/amazon/ena/ena_netdev.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/net/ethernet/amazon/ena/ena_netdev.c b/drivers/net/ethernet/amazon/ena/ena_netdev.c
index 6aab85a7..70fa3adb 100644
--- a/drivers/net/ethernet/amazon/ena/ena_netdev.c
+++ b/drivers/net/ethernet/amazon/ena/ena_netdev.c
@@ -1716,8 +1716,12 @@ static void ena_free_io_irq(struct ena_adapter *adapter)
 	int i;
 
 	for (i = ENA_IO_IRQ_FIRST_IDX; i < ENA_MAX_MSIX_VEC(io_queue_count); i++) {
+		struct ena_napi *ena_napi;
+
 		irq = &adapter->irq_tbl[i];
 		irq_set_affinity_hint(irq->vector, NULL);
+		ena_napi = irq->data;
+		netif_napi_set_irq(&ena_napi->napi, -1);
 		free_irq(irq->vector, irq->data);
 	}
 }
-- 
2.47.1


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

* Re: [PATCH net-next v2] net: ena: resolve WARN_ON when freeing IRQs
  2025-03-17  7:11 [PATCH net-next v2] net: ena: resolve WARN_ON when freeing IRQs David Arinzon
@ 2025-03-18 23:11 ` Jacob Keller
  2025-03-24 17:00 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: Jacob Keller @ 2025-03-18 23:11 UTC (permalink / raw)
  To: David Arinzon, David Miller, Jakub Kicinski, netdev
  Cc: Ahmed Zaki, Eric Dumazet, Paolo Abeni, Simon Horman,
	Richard Cochran, Woodhouse, David, Machulsky, Zorik,
	Matushevsky, Alexander, Saeed Bshara, Wilson, Matt,
	Liguori, Anthony, Bshara, Nafea, Schmeilin, Evgeny,
	Belgazal, Netanel, Saidi, Ali, Herrenschmidt, Benjamin,
	Kiyanovski, Arthur, Dagan, Noam, Bernstein, Amit, Agroskin, Shay,
	Ostrovsky, Evgeny, Tabachnik, Ofir



On 3/17/2025 12:11 AM, David Arinzon wrote:
> When IRQs are freed, a WARN_ON is triggered as the
> affinity notifier is not released.
> This results in the below stack trace:
> 
> [  484.544586]  ? __warn+0x84/0x130
> [  484.544843]  ? free_irq+0x5c/0x70
> [  484.545105]  ? report_bug+0x18a/0x1a0
> [  484.545390]  ? handle_bug+0x53/0x90
> [  484.545664]  ? exc_invalid_op+0x14/0x70
> [  484.545959]  ? asm_exc_invalid_op+0x16/0x20
> [  484.546279]  ? free_irq+0x5c/0x70
> [  484.546545]  ? free_irq+0x10/0x70
> [  484.546807]  ena_free_io_irq+0x5f/0x70 [ena]
> [  484.547138]  ena_down+0x250/0x3e0 [ena]
> [  484.547435]  ena_destroy_device+0x118/0x150 [ena]
> [  484.547796]  __ena_shutoff+0x5a/0xe0 [ena]
> [  484.548110]  pci_device_remove+0x3b/0xb0
> [  484.548412]  device_release_driver_internal+0x193/0x200
> [  484.548804]  driver_detach+0x44/0x90
> [  484.549084]  bus_remove_driver+0x69/0xf0
> [  484.549386]  pci_unregister_driver+0x2a/0xb0
> [  484.549717]  ena_cleanup+0xc/0x130 [ena]
> [  484.550021]  __do_sys_delete_module.constprop.0+0x176/0x310
> [  484.550438]  ? syscall_trace_enter+0xfb/0x1c0
> [  484.550782]  do_syscall_64+0x5b/0x170
> [  484.551067]  entry_SYSCALL_64_after_hwframe+0x76/0x7e
> 
> Adding a call to `netif_napi_set_irq` with -1 as the IRQ index,
> which frees the notifier.
> 
> Fixes: de340d8206bf ("net: ena: use napi's aRFS rmap notifers")
> Signed-off-by: David Arinzon <darinzon@amazon.com>
> Reviewed-by: Simon Horman <horms@kernel.org>
> Reviewed-by: Ahmed Zaki <ahmed.zaki@intel.com>
> ---
> Changes in v2:
> - Remove an unnecessary cast
> 
> Link to v1: https://lore.kernel.org/netdev/20250312143929.GT4159220@kernel.org/T/
> ---

Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>

>  drivers/net/ethernet/amazon/ena/ena_netdev.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/drivers/net/ethernet/amazon/ena/ena_netdev.c b/drivers/net/ethernet/amazon/ena/ena_netdev.c
> index 6aab85a7..70fa3adb 100644
> --- a/drivers/net/ethernet/amazon/ena/ena_netdev.c
> +++ b/drivers/net/ethernet/amazon/ena/ena_netdev.c
> @@ -1716,8 +1716,12 @@ static void ena_free_io_irq(struct ena_adapter *adapter)
>  	int i;
>  
>  	for (i = ENA_IO_IRQ_FIRST_IDX; i < ENA_MAX_MSIX_VEC(io_queue_count); i++) {
> +		struct ena_napi *ena_napi;
> +
>  		irq = &adapter->irq_tbl[i];
>  		irq_set_affinity_hint(irq->vector, NULL);
> +		ena_napi = irq->data;
> +		netif_napi_set_irq(&ena_napi->napi, -1);
>  		free_irq(irq->vector, irq->data);
>  	}
>  }


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

* Re: [PATCH net-next v2] net: ena: resolve WARN_ON when freeing IRQs
  2025-03-17  7:11 [PATCH net-next v2] net: ena: resolve WARN_ON when freeing IRQs David Arinzon
  2025-03-18 23:11 ` Jacob Keller
@ 2025-03-24 17:00 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2025-03-24 17:00 UTC (permalink / raw)
  To: David Arinzon
  Cc: davem, kuba, netdev, ahmed.zaki, edumazet, pabeni, horms,
	richardcochran, dwmw, zorik, matua, saeedb, msw, aliguori, nafea,
	evgenys, netanel, alisaidi, benh, akiyano, ndagan, amitbern,
	shayagr, evostrov, ofirt

Hello:

This patch was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Mon, 17 Mar 2025 09:11:47 +0200 you wrote:
> When IRQs are freed, a WARN_ON is triggered as the
> affinity notifier is not released.
> This results in the below stack trace:
> 
> [  484.544586]  ? __warn+0x84/0x130
> [  484.544843]  ? free_irq+0x5c/0x70
> [  484.545105]  ? report_bug+0x18a/0x1a0
> [  484.545390]  ? handle_bug+0x53/0x90
> [  484.545664]  ? exc_invalid_op+0x14/0x70
> [  484.545959]  ? asm_exc_invalid_op+0x16/0x20
> [  484.546279]  ? free_irq+0x5c/0x70
> [  484.546545]  ? free_irq+0x10/0x70
> [  484.546807]  ena_free_io_irq+0x5f/0x70 [ena]
> [  484.547138]  ena_down+0x250/0x3e0 [ena]
> [  484.547435]  ena_destroy_device+0x118/0x150 [ena]
> [  484.547796]  __ena_shutoff+0x5a/0xe0 [ena]
> [  484.548110]  pci_device_remove+0x3b/0xb0
> [  484.548412]  device_release_driver_internal+0x193/0x200
> [  484.548804]  driver_detach+0x44/0x90
> [  484.549084]  bus_remove_driver+0x69/0xf0
> [  484.549386]  pci_unregister_driver+0x2a/0xb0
> [  484.549717]  ena_cleanup+0xc/0x130 [ena]
> [  484.550021]  __do_sys_delete_module.constprop.0+0x176/0x310
> [  484.550438]  ? syscall_trace_enter+0xfb/0x1c0
> [  484.550782]  do_syscall_64+0x5b/0x170
> [  484.551067]  entry_SYSCALL_64_after_hwframe+0x76/0x7e
> 
> [...]

Here is the summary with links:
  - [net-next,v2] net: ena: resolve WARN_ON when freeing IRQs
    https://git.kernel.org/netdev/net-next/c/d39e08b0893b

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



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

end of thread, other threads:[~2025-03-24 16:59 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-17  7:11 [PATCH net-next v2] net: ena: resolve WARN_ON when freeing IRQs David Arinzon
2025-03-18 23:11 ` Jacob Keller
2025-03-24 17:00 ` 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).