Hello,

I recently ran into an issue when using DPDK's failsafe pmd on a Microsoft
Azure setup. On this setup, I have the failsafe pmd managing a netvsc
interface with a Mellanox nic (which can be used through the hardware
acceleration feature). A segfault is sometimes seen whenever I unplug the
Mellanox device, which is a case that should be handled by the pmd. On a
more recent DPDK version (I tested with stable v23.11.1), this segfault is
systematic.

This seems to happen because the function rte_eth_dev_release_port() is
called twice when the hotplug_alarm triggers. You can see it in this bit of
code here:
https://git.dpdk.org/dpdk/tree/drivers/net/failsafe/failsafe_ether.c#n276

In the fs_dev_remove() function, the rte_eth_dev_close() calls run the
rte_eth_dev_release_port() the first time, and it is then called a second
time when handling the DEV_PROBED case. I noticed when searching into the
mailing list that this problem was already seen once and a patch was
suggested. Here is the link to the mail:
https://mails.dpdk.org/archives/dev/2022-November/256898.html

Applying this patch on my local branched fixed the issue on my end although
I cannot attest for sure that it is the best possible fix. I could see a
memory leak happening if the fs_dev_remove() function was called as
sdev->state == DEV_PROBED, as the release would never be done. But it is
still weird that if sdev->state == DEV_STARTED, we do
rte_eth_dev_release_port() first then rte_dev_remove(), and if sdev->state
== DEV_PROBED, we call them in the opposite order.

Perhaps someone could look into it?

Regards,
Edwin Brossette.

Reply via email to