From: Simon Horman <horms@kernel.org>
To: David Arinzon <darinzon@amazon.com>
Cc: David Miller <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>,
netdev@vger.kernel.org, Ahmed Zaki <ahmed.zaki@intel.com>,
Eric Dumazet <edumazet@google.com>,
Paolo Abeni <pabeni@redhat.com>,
Richard Cochran <richardcochran@gmail.com>,
"Woodhouse, David" <dwmw@amazon.com>,
"Machulsky, Zorik" <zorik@amazon.com>,
"Matushevsky, Alexander" <matua@amazon.com>,
Saeed Bshara <saeedb@amazon.com>, "Wilson, Matt" <msw@amazon.com>,
"Liguori, Anthony" <aliguori@amazon.com>,
"Bshara, Nafea" <nafea@amazon.com>,
"Schmeilin, Evgeny" <evgenys@amazon.com>,
"Belgazal, Netanel" <netanel@amazon.com>,
"Saidi, Ali" <alisaidi@amazon.com>,
"Herrenschmidt, Benjamin" <benh@amazon.com>,
"Kiyanovski, Arthur" <akiyano@amazon.com>,
"Dagan, Noam" <ndagan@amazon.com>,
"Bernstein, Amit" <amitbern@amazon.com>,
"Agroskin, Shay" <shayagr@amazon.com>,
"Ostrovsky, Evgeny" <evostrov@amazon.com>,
"Tabachnik, Ofir" <ofirt@amazon.com>
Subject: Re: [PATCH net-next] net: ena: resolve WARN_ON when freeing IRQs
Date: Wed, 12 Mar 2025 15:39:29 +0100 [thread overview]
Message-ID: <20250312143929.GT4159220@kernel.org> (raw)
In-Reply-To: <20250310080149.757-1-darinzon@amazon.com>
On Mon, Mar 10, 2025 at 10:01:48AM +0200, 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>
Thanks David,
I agree that having a notifier set should result in a WARN_ON,
and that your patch addresses this problem.
So, the nit below not withstanding this looks good to me.
Reviewed-by: Simon Horman <horms@kernel.org>
> ---
> 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..9e007c60 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 = (struct ena_napi *)irq->data;
nit: I don't think it is necessary to explicitly cast irq->data
to the pointer type of ena_napi because irq->data is a void *.
> + netif_napi_set_irq(&ena_napi->napi, -1);
> free_irq(irq->vector, irq->data);
> }
> }
> --
> 2.47.1
>
next prev parent reply other threads:[~2025-03-12 14:39 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-10 8:01 [PATCH net-next] net: ena: resolve WARN_ON when freeing IRQs David Arinzon
2025-03-12 14:39 ` Simon Horman [this message]
2025-03-12 20:55 ` Ahmed Zaki
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250312143929.GT4159220@kernel.org \
--to=horms@kernel.org \
--cc=ahmed.zaki@intel.com \
--cc=akiyano@amazon.com \
--cc=aliguori@amazon.com \
--cc=alisaidi@amazon.com \
--cc=amitbern@amazon.com \
--cc=benh@amazon.com \
--cc=darinzon@amazon.com \
--cc=davem@davemloft.net \
--cc=dwmw@amazon.com \
--cc=edumazet@google.com \
--cc=evgenys@amazon.com \
--cc=evostrov@amazon.com \
--cc=kuba@kernel.org \
--cc=matua@amazon.com \
--cc=msw@amazon.com \
--cc=nafea@amazon.com \
--cc=ndagan@amazon.com \
--cc=netanel@amazon.com \
--cc=netdev@vger.kernel.org \
--cc=ofirt@amazon.com \
--cc=pabeni@redhat.com \
--cc=richardcochran@gmail.com \
--cc=saeedb@amazon.com \
--cc=shayagr@amazon.com \
--cc=zorik@amazon.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.