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 A56E3A00C3; Tue, 18 Jan 2022 08:41:00 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4F72F426F6; Tue, 18 Jan 2022 08:40:49 +0100 (CET) Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by mails.dpdk.org (Postfix) with ESMTP id 67F2C426F4; Tue, 18 Jan 2022 08:40:47 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1642491647; x=1674027647; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=QfZtFfcQkK07EZZ7M7FrQ0FxZuMH5UyZmpwyrvNe7I8=; b=ExcBj/LF7IdLqoH3/s+gem1cZQn7G/XsfJbtPeHXkWvzKZ8QzG7N300G JXeHUHup0pu4wn3cxO+In8VYrPQ1vmNtm4Q7V17BAuvnbf14GUICcTodV dg5OO9cNbdjmBB+v4jrXjoHFxgu7+87nIVwSVIBDFCgm3bkrXM3hG5BP1 q3Gj3kOmk33mWS7ewwHY412Cny9eSoSGMC+SDsS0mKutNXL+ttu6H+uW8 HdmU0GbjPVSQdDe62FpJrmHT2ff+DZlbOc3e6zSzzoHGSTMErLD3fWiN6 ka2OZGDJ24Cg66/hHCyIVEGLW+CJse6bmiA2FvIWpATklPGkbQb6Um2+a w==; X-IronPort-AV: E=McAfee;i="6200,9189,10230"; a="225436389" X-IronPort-AV: E=Sophos;i="5.88,296,1635231600"; d="scan'208";a="225436389" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Jan 2022 23:40:46 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.88,296,1635231600"; d="scan'208";a="625422772" Received: from unknown (HELO localhost.localdomain.sh.intel.com) ([10.238.175.107]) by orsmga004.jf.intel.com with ESMTP; 17 Jan 2022 23:40:45 -0800 From: Wei Huang To: dev@dpdk.org, rosen.xu@intel.com, qi.z.zhang@intel.com Cc: stable@dpdk.org, tianfei.zhang@intel.com, ferruh.yigit@intel.com Subject: [PATCH v2 2/4] raw/ifpga: fix pthread cannot join Date: Tue, 18 Jan 2022 02:37:37 -0500 Message-Id: <20220118073739.2652-3-wei.huang@intel.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20220118073739.2652-1-wei.huang@intel.com> References: <20220118031738.2059-1-wei.huang@intel.com> <20220118073739.2652-1-wei.huang@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 From: Tianfei Zhang When we want to close a thread, we should set a flag to thread handler function. Fixes: 9c006c45 ("raw/ifpga: scan PCIe BDF device tree") Cc: stable@dpdk.org Signed-off-by: Tianfei Zhang --- drivers/raw/ifpga/ifpga_rawdev.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/raw/ifpga/ifpga_rawdev.c b/drivers/raw/ifpga/ifpga_rawdev.c index 8d9db58..9663b67 100644 --- a/drivers/raw/ifpga/ifpga_rawdev.c +++ b/drivers/raw/ifpga/ifpga_rawdev.c @@ -497,7 +497,7 @@ static int set_surprise_link_check_aer( int gsd_enable, ret; #define MS 1000 - while (1) { + while (ifpga_monitor_start) { gsd_enable = 0; for (i = 0; i < IFPGA_RAWDEV_NUM; i++) { ifpga_rdev = &ifpga_rawdevices[i]; @@ -544,7 +544,9 @@ static int set_surprise_link_check_aer( { int ret; - if (ifpga_monitor_start == 1) { + if (ifpga_monitor_start == 1 && ifpga_monitor_start_thread) { + ifpga_monitor_start = 0; + ret = pthread_cancel(ifpga_monitor_start_thread); if (ret) IFPGA_RAWDEV_PMD_ERR("Can't cancel the thread"); @@ -553,8 +555,6 @@ static int set_surprise_link_check_aer( if (ret) IFPGA_RAWDEV_PMD_ERR("Can't join the thread"); - ifpga_monitor_start = 0; - return ret; } -- 1.8.3.1