DPDK-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Bruce Richardson <bruce.richardson@intel.com>
To: Dawid Wesierski <dawid.wesierski@intel.com>
Cc: <dev@dpdk.org>, <vladimir.medvedkin@intel.com>,
	<anatoly.burakov@intel.com>, <marek.kasiewicz@intel.com>,
	<stable@dpdk.org>, Jingjing Wu <jingjing.wu@intel.com>,
	Saurabh Singhal <saurabhs@arista.com>,
	Qi Zhang <qi.z.zhang@intel.com>
Subject: Re: [PATCH] net/iavf: fix interrupt callback race on close
Date: Thu, 22 Oct 2026 16:35:44 +0100	[thread overview]
Message-ID: <atotUOk-9s9IcsFv@bricha3-mobl1.ger.corp.intel.com> (raw)
In-Reply-To: <20261014122427.631805-1-dawid.wesierski@intel.com>

On Wed, Oct 14, 2026 at 12:24:27PM +0000, Dawid Wesierski wrote:
> From: Marek Kasiewicz <marek.kasiewicz@intel.com>
> 
> iavf_dev_close() unregisters iavf_dev_interrupt_handler() with
> rte_intr_callback_unregister() and ignores the result. That call
> returns -EAGAIN, and leaves the callback registered, while the
> interrupt thread is running a callback of the same source.
> 
> Close hits that window. It sends virtchnl commands (RSS, promiscuous
> mode, flows), and iavf_dev_interrupt_handler() handles each response.
> The handler clears the pending command before it returns, so the
> thread waiting in iavf_wait_for_msg() can go on to the unregister
> while the interrupt thread is still inside the callback. This is
> likely when the two threads share a CPU.
> 
> Two failures follow:
> - The interrupt thread resumes the callback after
>   rte_eth_dev_release_port() has set dev->data to NULL, and
>   iavf_handle_virtchnl_msg() dereferences it: segmentation fault.
> - The callback returns, but its source stays registered after the
>   port is closed. At rte_eal_cleanup(),
>   pci_vfio_unmap_resource_primary() closes the interrupt eventfd, and
>   the next rebuild of the epoll set aborts the process:
>     EAL: PANIC in eal_intr_thread_main():
>     Error adding fd 49 epoll_ctl, Bad file descriptor
> 
> Use rte_intr_callback_unregister_sync(), as ice_dev_close() does. The
> iavf_dev_init() error path has the same pattern; fix it too.
> 
> The sync variant waits for a running callback to return. It would
> spin forever only if called from iavf_dev_interrupt_handler() itself,
> and that handler never closes or re-initializes the port: it hands PF
> events and resets to the iavf-event thread with iavf_dev_event_post().
> A close from any other interrupt thread callback, such as an alarm,
> returns at once, because the iavf source is not active then.
> 
> Fixes: 22b123a36d07 ("net/avf: initialize PMD")
> Fixes: e35a5737a746 ("net/iavf: unregister interrupt handler before FD close")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Marek Kasiewicz <marek.kasiewicz@intel.com>
> Signed-off-by: Dawid Wesierski <dawid.wesierski@intel.com>
> ---
>  drivers/net/intel/iavf/iavf_ethdev.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
Acked-by: Bruce Richardson <bruce.richardson@intel.com>

Patch applied to dpdk-next-net-intel.
Thanks,
/Bruce

      parent reply	other threads:[~2026-10-22 15:35 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-14 12:24 [PATCH] net/iavf: fix interrupt callback race on close Dawid Wesierski
2026-10-20 15:22 ` Dawid Wesierski
2026-10-22 15:35 ` Bruce Richardson [this message]

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=atotUOk-9s9IcsFv@bricha3-mobl1.ger.corp.intel.com \
    --to=bruce.richardson@intel.com \
    --cc=anatoly.burakov@intel.com \
    --cc=dawid.wesierski@intel.com \
    --cc=dev@dpdk.org \
    --cc=jingjing.wu@intel.com \
    --cc=marek.kasiewicz@intel.com \
    --cc=qi.z.zhang@intel.com \
    --cc=saurabhs@arista.com \
    --cc=stable@dpdk.org \
    --cc=vladimir.medvedkin@intel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox