DPDK patches and discussions
 help / color / mirror / Atom feed
From: Wei Huang <wei.huang@intel.com>
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	[thread overview]
Message-ID: <20220118073739.2652-3-wei.huang@intel.com> (raw)
In-Reply-To: <20220118073739.2652-1-wei.huang@intel.com>

From: Tianfei Zhang <tianfei.zhang@intel.com>

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 <tianfei.zhang@intel.com>
---
 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


  parent reply	other threads:[~2022-01-18  7:41 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-18  3:17 [PATCH v1 0/4] Fix bugs found in raw/ifpga development for arrow creek Wei Huang
2022-01-18  3:17 ` [PATCH v1 1/4] raw/ifpga/base: fix SPI transaction Wei Huang
2022-01-18  3:17 ` [PATCH v1 2/4] raw/ifpga: fix pthread cannot join Wei Huang
2022-01-18  3:17 ` [PATCH v1 3/4] raw/ifpga: fix ifpga devices cleanup function Wei Huang
2022-01-18  3:17 ` [PATCH v1 4/4] raw/ifpga/base: fix port feature ID Wei Huang
2022-01-18  6:39   ` Xu, Rosen
2022-01-18  7:37 ` [PATCH v2 0/4] Fix bugs found in raw/ifpga development for arrow creek Wei Huang
2022-01-18  7:37   ` [PATCH v2 1/4] raw/ifpga/base: fix SPI transaction Wei Huang
2022-01-18  7:37   ` Wei Huang [this message]
2022-01-18  7:37   ` [PATCH v2 3/4] raw/ifpga: fix ifpga devices cleanup function Wei Huang
2022-01-18  7:37   ` [PATCH v2 4/4] raw/ifpga/base: fix port feature ID Wei Huang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220118073739.2652-3-wei.huang@intel.com \
    --to=wei.huang@intel.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    --cc=qi.z.zhang@intel.com \
    --cc=rosen.xu@intel.com \
    --cc=stable@dpdk.org \
    --cc=tianfei.zhang@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).