From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 7C6B041C84; Mon, 13 Feb 2023 08:32:19 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6BC8A410F2; Mon, 13 Feb 2023 08:32:19 +0100 (CET) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by mails.dpdk.org (Postfix) with ESMTP id 2C0F240A81 for ; Mon, 13 Feb 2023 08:32:17 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1676273537; x=1707809537; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=OGcJKlZKmGGpEy4T0FRTupYmc6zRJihLr8EAtE3Dguk=; b=d6JbGREKZEDEhVuANzciq6H0+nC92pNjTBfGF6/cf5wsxNT7Rb3uEG+i 0JXTHZNglPUMZmKF/9Ut9pO6GHLOg7wS63g7yAUk72+qUxqgEhi5akUZA kDz7MDoEqxKtkf9vteifLTH6k8fPGEGT7YVNCePOyimyqXKVCnNyMcnlR oRGkA1I1tgqU+B72gNSlRGyPf8VhHH5jmLXSRVTX3eclBiaEHaw4Kf6Tj 9HUmk8MWXRHncsZgntF5/cLhFM8anPLyWc1dRkO+AjbxrmXya+74V+9Hm peoayiwuDaLw/VWLhMBc/B/PjJrJU91Y6JzTNm/bG9I6ZjfzwxGgFaHn/ A==; X-IronPort-AV: E=McAfee;i="6500,9779,10619"; a="417054576" X-IronPort-AV: E=Sophos;i="5.97,293,1669104000"; d="scan'208";a="417054576" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Feb 2023 23:32:16 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10619"; a="668715344" X-IronPort-AV: E=Sophos;i="5.97,293,1669104000"; d="scan'208";a="668715344" Received: from unknown (HELO localhost.localdomain) ([10.239.252.104]) by orsmga002-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Feb 2023 23:32:14 -0800 From: Ke Zhang To: qi.z.zhang@intel.com, qiming.yang@intel.com, dev@dpdk.org Cc: Ke Zhang Subject: [PATCH v2] net/ice: fix ice dcf control thread crash Date: Mon, 13 Feb 2023 15:16:48 +0800 Message-Id: <20230213071648.326123-1-ke1x.zhang@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230208083005.290571-1-ke1x.zhang@intel.com> References: <20230208083005.290571-1-ke1x.zhang@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org The control thread accesses the hardware resources after the resources were released, resulting in a segment error. This commit fixes the bug by exiting thread before resource released. Signed-off-by: Ke Zhang --- v2: add pthread_exit() for windows --- drivers/net/ice/ice_dcf.c | 4 ++++ lib/eal/windows/include/pthread.h | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/drivers/net/ice/ice_dcf.c b/drivers/net/ice/ice_dcf.c index 1c3d22ae0f..e58908caf5 100644 --- a/drivers/net/ice/ice_dcf.c +++ b/drivers/net/ice/ice_dcf.c @@ -543,6 +543,8 @@ ice_dcf_handle_vsi_update_event(struct ice_dcf_hw *hw) ice_dcf_disable_irq0(hw); for (;;) { + if (hw->vc_event_msg_cb == NULL) + pthread_exit(NULL); if (ice_dcf_get_vf_resource(hw) == 0 && ice_dcf_get_vf_vsi_map(hw) >= 0) { err = 0; @@ -760,6 +762,8 @@ ice_dcf_uninit_hw(struct rte_eth_dev *eth_dev, struct ice_dcf_hw *hw) rte_intr_callback_unregister(intr_handle, ice_dcf_dev_interrupt_handler, hw); + hw->vc_event_msg_cb = NULL; + ice_dcf_mode_disable(hw); iavf_shutdown_adminq(&hw->avf); diff --git a/lib/eal/windows/include/pthread.h b/lib/eal/windows/include/pthread.h index 27fd2cca52..f0068ebd73 100644 --- a/lib/eal/windows/include/pthread.h +++ b/lib/eal/windows/include/pthread.h @@ -149,6 +149,11 @@ pthread_detach(__rte_unused pthread_t thread) return 0; } +static inline void +pthread_exit(__rte_unused void *__retval) +{ +} + static inline int pthread_join(__rte_unused pthread_t thread, __rte_unused void **value_ptr) -- 2.25.1