]> git.droids-corp.org - dpdk.git/commitdiff
net/ice: fix leak on thread termination
authorDavid Marchand <david.marchand@redhat.com>
Tue, 11 May 2021 11:33:58 +0000 (13:33 +0200)
committerFerruh Yigit <ferruh.yigit@intel.com>
Tue, 11 May 2021 21:40:22 +0000 (23:40 +0200)
A terminated pthread should be joined or detached so that its associated
resources are released.

The "ice-reset-<vf_id>" threads are used to service some reset task in
the background, but they are never joined by the thread that created
them.
The easiest solution is to detach new threads.

The Windows EAL did not provide a pthread_detach wrapper but there is no
resource to release for Windows threads, so add an empty wrapper.

Fixes: 3b3757bda3c3 ("net/ice: get VF hardware index in DCF")
Cc: stable@dpdk.org
Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Haiyue Wang <haiyue.wang@intel.com>
Acked-by: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
drivers/net/ice/ice_dcf_parent.c
lib/eal/windows/include/pthread.h

index c8e433239bf68a8516235e5cc3452f0215c38d5d..1d7aa8bc87a1b9b7a31eb15a5bc254c900e7ddb5 100644 (file)
@@ -121,6 +121,8 @@ ice_dcf_vsi_update_service_handler(void *param)
        struct ice_dcf_hw *hw = reset_param->dcf_hw;
        struct ice_dcf_adapter *adapter;
 
+       pthread_detach(pthread_self());
+
        rte_delay_us(ICE_DCF_VSI_UPDATE_SERVICE_INTERVAL);
 
        rte_spinlock_lock(&vsi_update_lock);
index 1939b0121c8bd03d15029e12f54f8d4b28010c20..27fd2cca523919857e841d8c60d1324201b9109e 100644 (file)
@@ -143,6 +143,12 @@ pthread_create(void *threadid, const void *threadattr, void *threadfunc,
        return ((hThread != NULL) ? 0 : E_FAIL);
 }
 
+static inline int
+pthread_detach(__rte_unused pthread_t thread)
+{
+       return 0;
+}
+
 static inline int
 pthread_join(__rte_unused pthread_t thread,
        __rte_unused void **value_ptr)