DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Xu, Rosen" <rosen.xu@altera.com>
To: Stephen Hemminger <stephen@networkplumber.org>,
	"dev@dpdk.org" <dev@dpdk.org>
Subject: Re: [RFC 5/6] intel/ipn3ke: avoid use of pthread_cancel
Date: Sun, 28 Sep 2025 01:53:18 +0000	[thread overview]
Message-ID: <CH2PR03MB5239F6E985FC44074E69A283FC18A@CH2PR03MB5239.namprd03.prod.outlook.com> (raw)
In-Reply-To: <20250924165527.268645-6-stephen@networkplumber.org>

[-- Attachment #1: Type: text/plain, Size: 2241 bytes --]

Hi,

________________________________
From: Stephen Hemminger <stephen@networkplumber.org>
Sent: Thursday, September 25, 2025 12:51 AM
To: dev@dpdk.org <dev@dpdk.org>
Cc: Stephen Hemminger <stephen@networkplumber.org>; Xu, Rosen <rosen.xu@altera.com>
Subject: [RFC 5/6] intel/ipn3ke: avoid use of pthread_cancel

[CAUTION: This email is from outside your organization. Unless you trust the sender, do not click on links or open attachments as it may be a fraudulent email attempting to steal your information and/or compromise your computer.]

Can use the existing reference count (scan_num) to control
the thread without using pthread_cancel.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 drivers/net/intel/ipn3ke/ipn3ke_representor.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/net/intel/ipn3ke/ipn3ke_representor.c b/drivers/net/intel/ipn3ke/ipn3ke_representor.c
index feb57420c3..4e831c6924 100644
--- a/drivers/net/intel/ipn3ke/ipn3ke_representor.c
+++ b/drivers/net/intel/ipn3ke/ipn3ke_representor.c
@@ -26,7 +26,7 @@
 #include "ipn3ke_logs.h"
 #include "ipn3ke_ethdev.h"

-static int ipn3ke_rpst_scan_num;
+static volatile int ipn3ke_rpst_scan_num;
 static rte_thread_t ipn3ke_rpst_scan_thread;

 /** Double linked list of representor port. */
@@ -2578,7 +2578,7 @@ ipn3ke_rpst_scan_handle_request(__rte_unused void *param)
 #define MS 1000
 #define SCAN_NUM 32

-       for (;;) {
+       while (ipn3ke_rpst_scan_num > 0) {
                num = 0;
                TAILQ_FOREACH(rpst, &ipn3ke_rpst_list, next) {
                        if (rpst->i40e_pf_eth &&
@@ -2612,10 +2612,6 @@ ipn3ke_rpst_scan_check(void)
                        return -1;
                }
        } else if (ipn3ke_rpst_scan_num == 0) {
-               ret = pthread_cancel((pthread_t)ipn3ke_rpst_scan_thread.opaque_id);
-               if (ret)
-                       IPN3KE_AFU_PMD_ERR("Can't cancel the thread");
-
                ret = rte_thread_join(ipn3ke_rpst_scan_thread, NULL);
                if (ret)
                        IPN3KE_AFU_PMD_ERR("Can't join the thread");
--
2.47.3

Reviewed-by: Rosen Xu <rosen.xu@altera.com>

[-- Attachment #2: Type: text/html, Size: 4878 bytes --]

  reply	other threads:[~2025-09-28  1:53 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-24 16:51 [RFC 0/6] get rid " Stephen Hemminger
2025-09-24 16:51 ` [RFC 1/6] eal: avoid using pthread_cancel Stephen Hemminger
2025-09-24 16:51 ` [RFC 2/6] eventdev: avoid use of pthread_cancel Stephen Hemminger
2025-09-24 16:51 ` [RFC 3/6] raw/ifpga: " Stephen Hemminger
2025-09-28  1:52   ` Xu, Rosen
2025-09-24 16:51 ` [RFC 4/6] dma/skeleton: " Stephen Hemminger
2025-09-25  1:20   ` fengchengwen
2025-09-24 16:51 ` [RFC 5/6] intel/ipn3ke: " Stephen Hemminger
2025-09-28  1:53   ` Xu, Rosen [this message]
2025-09-24 16:51 ` [RFC 6/6] intel/iavf: remove " Stephen Hemminger
2025-09-25 15:11   ` Bruce Richardson

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=CH2PR03MB5239F6E985FC44074E69A283FC18A@CH2PR03MB5239.namprd03.prod.outlook.com \
    --to=rosen.xu@altera.com \
    --cc=dev@dpdk.org \
    --cc=stephen@networkplumber.org \
    /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).