On Sun, Nov 29, 2026 at 01:53:13PM +0000, Anurag Mandal wrote:
> ixgbevf_dev_close() unregisters its interrupt callback only once. If the
> callback is running at that time, rte_intr_callback_unregister() returns
> -EAGAIN and the callback stays registered: its allocation is leaked, it
> keeps a pointer to the closed device, and a reset registers a second one.
> The PF close already retries in that case.
>
> Wait for the running callback to complete before unregistering. When
> close is called from the callback itself, like by an application
> resetting the port on RTE_ETH_EVENT_INTR_RESET, waiting would never end,
> so defer the removal until the callback returns instead.
>
> Fixes: 77234603fba0 ("net/ixgbe: support VF mailbox interrupt for link
> up/down") Cc: [email protected]
>
> Signed-off-by: Anurag Mandal <[email protected]> ---
> drivers/net/intel/ixgbe/ixgbe_ethdev.c | 12 ++++++++++-- 1 file changed,
> 10 insertions(+), 2 deletions(-)
>
Some AI feedback worth considering on this patch too.
deferred unregister does not make close from inside the callback safe. The
new ixgbe_ethdev.c:5648 defers removal of the callback registration, not
release of the ethdev. If an application closes a stopped VF from its reset
callback, ethdev frees dev_private before control returns to the
ixgbe_ethdev.c:7765. That code then executes intr->flags &=
~IXGBE_FLAG_MAILBOX; through the freed pointer and calls
ixgbevf_intr_enable(dev). This lifetime hazard predates the patch, but the
new self-callback branch does not resolve it. I would hold this commit
until the notification is delivered without subsequent handler access to
the device, or teardown itself is deferred until the handler returns. Test
close from the callback as well as reset: only close releases the port.