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 C028641C84; Mon, 13 Feb 2023 08:31:00 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id AD65040DDB; Mon, 13 Feb 2023 08:31:00 +0100 (CET) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by mails.dpdk.org (Postfix) with ESMTP id 051CC40A81 for ; Mon, 13 Feb 2023 08:30:58 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1676273459; x=1707809459; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=OGcJKlZKmGGpEy4T0FRTupYmc6zRJihLr8EAtE3Dguk=; b=hOTqsOVfuQbrKRLPw+nKnIxKEiUuyC5UhveeZfKvsgDQRuPutS1A8d5D YqkuCzVX3pyDF0YO+M5gag7M0ZduFMDh7+5W++3iiw2GFqa13ITnXTZE/ OyHe3cLo0FBnWhntRca7kY2ZqH8MSNs9ja5ujkWcvbKxxMKOIVofvyi/Z V7L7qOvm+W9OAip203UL/U4XkyryKqb+HHzBJT6f8RYINhd8r3slFVBDA Hb2LY2DO2T0l7xFzVCGRpIZbtYUO8h/RhWjLVPjaIiWQW36uJ/fiKswpm 8pjDHxFxDzjlbnThKsaDL+gldt4m1gkhplesfJ+bjVrmQhSS1DJo8pL3k Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10619"; a="332137616" X-IronPort-AV: E=Sophos;i="5.97,293,1669104000"; d="scan'208";a="332137616" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Feb 2023 23:30:08 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10619"; a="737415750" X-IronPort-AV: E=Sophos;i="5.97,293,1669104000"; d="scan'208";a="737415750" Received: from unknown (HELO localhost.localdomain) ([10.239.252.104]) by fmsmga004-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Feb 2023 23:30:06 -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 contrl thread crash Date: Mon, 13 Feb 2023 15:14:40 +0800 Message-Id: <20230213071440.326064-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