[dpdk-dev] [PATCH v2] net/ixgbe: fix resource leak after thread exits normally
Ananyev, Konstantin
konstantin.ananyev at intel.com
Fri Apr 10 14:09:43 CEST 2020
Hi Tao,
> From: Zhu Tao <taox.zhu at intel.com>
>
> When the thread exits normally, pthread_join() is not called, which can
> result in a resource leak. Therefore, the thread is set to separation
> mode using function pthread_detach(), so that no program call
> pthread_join() is required to recycle, and when the thread exits,
> the system automatically reclaims resources.
>
> Fixes: 819d0d1d57f1 ("net/ixgbe: fix blocking system events")
> Cc: stable at dpdk.org
>
> Signed-off-by: Zhu Tao <taox.zhu at intel.com>
> ---
> drivers/net/ixgbe/ixgbe_ethdev.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> v2 changes:
> commit log.
>
> diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
> index 2c57976..f141ae4 100644
> --- a/drivers/net/ixgbe/ixgbe_ethdev.c
> +++ b/drivers/net/ixgbe/ixgbe_ethdev.c
> @@ -4165,11 +4165,9 @@ static int ixgbevf_dev_xstats_get_names(__rte_unused struct rte_eth_dev *dev,
> ixgbe_dev_cancel_link_thread(struct rte_eth_dev *dev)
> {
> struct ixgbe_adapter *ad = dev->data->dev_private;
> - void *retval;
>
> if (!ixgbe_dev_wait_setup_link_complete(dev)) {
> pthread_cancel(ad->link_thread_tid);
> - pthread_join(ad->link_thread_tid, &retval);
As you already waiting for link thread termination in
ixgbe_dev_wait_setup_link_complete(), do you still need
pthread_cancel() here?
> rte_atomic32_clear(&ad->link_thread_running);
> PMD_DRV_LOG(ERR, "Link thread not complete, cancel it!");
> }
> @@ -4186,6 +4184,7 @@ static int ixgbevf_dev_xstats_get_names(__rte_unused struct rte_eth_dev *dev,
> u32 speed;
> bool autoneg = false;
>
> + pthread_detach(pthread_self());
> speed = hw->phy.autoneg_advertised;
> if (!speed)
> ixgbe_get_link_capabilities(hw, &speed, &autoneg);
> --
> 1.8.3.1
More information about the dev
mailing list