DPDK patches and discussions
 help / color / mirror / Atom feed
From: Thomas Monjalon <thomas@monjalon.net>
To: dev@dpdk.org
Cc: Tyler Retzlaff <roretzla@linux.microsoft.com>,
	David Marchand <david.marchand@redhat.com>,
	Ferruh Yigit <ferruh.yigit@amd.com>,
	Chengwen Feng <fengchengwen@huawei.com>,
	Kevin Laatz <kevin.laatz@intel.com>,
	Bruce Richardson <bruce.richardson@intel.com>,
	Jingjing Wu <jingjing.wu@intel.com>,
	Beilei Xing <beilei.xing@intel.com>,
	Qiming Yang <qiming.yang@intel.com>,
	Qi Zhang <qi.z.zhang@intel.com>, Wenjun Wu <wenjun1.wu@intel.com>,
	Jiawen Wu <jiawenwu@trustnetic.com>,
	Jian Wang <jianwang@trustnetic.com>,
	Harman Kalra <hkalra@marvell.com>,
	Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>,
	Narcisa Ana Maria Vasile <navasile@linux.microsoft.com>,
	Dmitry Malloy <dmitrym@microsoft.com>,
	Pallavi Kadam <pallavi.kadam@intel.com>
Subject: [PATCH 03/11] eal: remove attributes from control thread creation
Date: Wed,  6 Sep 2023 18:12:20 +0200	[thread overview]
Message-ID: <20230906162226.1618088-4-thomas@monjalon.net> (raw)
In-Reply-To: <20230906162226.1618088-1-thomas@monjalon.net>

The experimental function rte_thread_create_control()
is supposed to wrap actions needed to create a control thread in DPDK.
This function should be easy to port on any OS.

As such, the thread attributes should not be customizable in this API.
The thread priority should be normal, and the affinity is on "free cores".
That's why the custom attributes parameter thread_attr is dropped.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
---
 app/test/test_threads.c                | 2 +-
 doc/guides/rel_notes/release_23_11.rst | 3 +++
 drivers/dma/skeleton/skeleton_dmadev.c | 3 +--
 drivers/net/iavf/iavf_vchnl.c          | 2 +-
 drivers/net/ice/ice_dcf_parent.c       | 2 +-
 drivers/net/ixgbe/ixgbe_ethdev.c       | 1 -
 drivers/net/txgbe/txgbe_ethdev.c       | 2 +-
 lib/eal/common/eal_common_thread.c     | 5 ++---
 lib/eal/include/rte_thread.h           | 5 +----
 lib/eal/windows/eal_interrupts.c       | 2 +-
 10 files changed, 12 insertions(+), 15 deletions(-)

diff --git a/app/test/test_threads.c b/app/test/test_threads.c
index 8c27e2bae1..4ac3f2671a 100644
--- a/app/test/test_threads.c
+++ b/app/test/test_threads.c
@@ -240,7 +240,7 @@ test_thread_control_create_join(void)
 
 	thread_id_ready = 0;
 	RTE_TEST_ASSERT(rte_thread_create_control(&thread_id, "dpdk-test-thcc",
-		NULL, thread_main, &thread_main_id) == 0,
+		thread_main, &thread_main_id) == 0,
 		"Failed to create thread.");
 
 	while (__atomic_load_n(&thread_id_ready, __ATOMIC_ACQUIRE) == 0)
diff --git a/doc/guides/rel_notes/release_23_11.rst b/doc/guides/rel_notes/release_23_11.rst
index 333e1d95a2..d3d500f294 100644
--- a/doc/guides/rel_notes/release_23_11.rst
+++ b/doc/guides/rel_notes/release_23_11.rst
@@ -113,6 +113,9 @@ API Changes
    Also, make sure to start the actual text at the margin.
    =======================================================
 
+* eal: The thread API has changed.
+  The function ``rte_thread_create_control()`` does not take attributes anymore.
+
 
 ABI Changes
 -----------
diff --git a/drivers/dma/skeleton/skeleton_dmadev.c b/drivers/dma/skeleton/skeleton_dmadev.c
index 493224542f..4fc2319668 100644
--- a/drivers/dma/skeleton/skeleton_dmadev.c
+++ b/drivers/dma/skeleton/skeleton_dmadev.c
@@ -128,8 +128,7 @@ skeldma_start(struct rte_dma_dev *dev)
 	rte_mb();
 
 	snprintf(name, sizeof(name), "dpdk-dma-skel%d", dev->data->dev_id);
-	ret = rte_thread_create_control(&hw->thread, name, NULL,
-				     cpucopy_thread, dev);
+	ret = rte_thread_create_control(&hw->thread, name, cpucopy_thread, dev);
 	if (ret) {
 		SKELDMA_LOG(ERR, "Start cpucopy thread fail!");
 		return -EINVAL;
diff --git a/drivers/net/iavf/iavf_vchnl.c b/drivers/net/iavf/iavf_vchnl.c
index c31a6d5c98..6baa6d5955 100644
--- a/drivers/net/iavf/iavf_vchnl.c
+++ b/drivers/net/iavf/iavf_vchnl.c
@@ -136,7 +136,7 @@ iavf_dev_event_handler_init(void)
 	pthread_mutex_init(&handler->lock, NULL);
 
 	if (rte_thread_create_control(&handler->tid, "dpdk-iavf-event",
-				NULL, iavf_dev_event_handle, NULL)) {
+				iavf_dev_event_handle, NULL)) {
 		__atomic_fetch_sub(&handler->ndev, 1, __ATOMIC_RELAXED);
 		return -1;
 	}
diff --git a/drivers/net/ice/ice_dcf_parent.c b/drivers/net/ice/ice_dcf_parent.c
index ad98a531de..d3bb65874f 100644
--- a/drivers/net/ice/ice_dcf_parent.c
+++ b/drivers/net/ice/ice_dcf_parent.c
@@ -182,7 +182,7 @@ start_vsi_reset_thread(struct ice_dcf_hw *dcf_hw, bool vfr, uint16_t vf_id)
 	param->vf_id = vf_id;
 
 	snprintf(name, sizeof(name), "dpdk-ice-rst%u", vf_id);
-	ret = rte_thread_create_control(&thread, name, NULL,
+	ret = rte_thread_create_control(&thread, name,
 				     ice_dcf_vsi_update_service_handler, param);
 	if (ret != 0) {
 		PMD_DRV_LOG(ERR, "Failed to start the thread for reset handling");
diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index 7eac05ee60..64e7e5d7d6 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -4330,7 +4330,6 @@ ixgbe_dev_link_update_share(struct rte_eth_dev *dev,
 				intr->flags |= IXGBE_FLAG_NEED_LINK_CONFIG;
 				if (rte_thread_create_control(&ad->link_thread_tid,
 					"dpdk-ixgbe-link",
-					NULL,
 					ixgbe_dev_setup_link_thread_handler,
 					dev) < 0) {
 					PMD_DRV_LOG(ERR,
diff --git a/drivers/net/txgbe/txgbe_ethdev.c b/drivers/net/txgbe/txgbe_ethdev.c
index 6f2f5a1841..198fac8318 100644
--- a/drivers/net/txgbe/txgbe_ethdev.c
+++ b/drivers/net/txgbe/txgbe_ethdev.c
@@ -2897,7 +2897,7 @@ txgbe_dev_link_update_share(struct rte_eth_dev *dev,
 				 */
 				intr->flags |= TXGBE_FLAG_NEED_LINK_CONFIG;
 				if (rte_thread_create_control(&ad->link_thread_tid,
-					"dpdk-txgbe-link", NULL,
+					"dpdk-txgbe-link",
 					txgbe_dev_setup_link_thread_handler, dev) < 0) {
 					PMD_DRV_LOG(ERR, "Create link thread failed!");
 					__atomic_clear(&ad->link_thread_running, __ATOMIC_SEQ_CST);
diff --git a/lib/eal/common/eal_common_thread.c b/lib/eal/common/eal_common_thread.c
index 6605bd017e..07ac721da1 100644
--- a/lib/eal/common/eal_common_thread.c
+++ b/lib/eal/common/eal_common_thread.c
@@ -349,8 +349,7 @@ rte_ctrl_thread_create(pthread_t *thread, const char *name,
 
 int
 rte_thread_create_control(rte_thread_t *thread, const char *name,
-	const rte_thread_attr_t *attr, rte_thread_func start_routine,
-	void *arg)
+		rte_thread_func start_routine, void *arg)
 {
 	struct rte_thread_ctrl_params *params;
 	enum __rte_ctrl_thread_status ctrl_thread_status;
@@ -365,7 +364,7 @@ rte_thread_create_control(rte_thread_t *thread, const char *name,
 	params->ret = 0;
 	params->ctrl_thread_status = CTRL_THREAD_LAUNCHING;
 
-	ret = rte_thread_create(thread, attr, control_thread_start, params);
+	ret = rte_thread_create(thread, NULL, control_thread_start, params);
 	if (ret != 0) {
 		free(params);
 		return -ret;
diff --git a/lib/eal/include/rte_thread.h b/lib/eal/include/rte_thread.h
index 6233142322..28cc5220a4 100644
--- a/lib/eal/include/rte_thread.h
+++ b/lib/eal/include/rte_thread.h
@@ -116,8 +116,6 @@ int rte_thread_create(rte_thread_t *thread_id,
  * @param name
  *   The name of the control thread
  *   (max RTE_THREAD_NAME_SIZE characters including '\0').
- * @param thread_attr
- *   Attributes for the new thread.
  * @param thread_func
  *   Function to be executed by the new thread.
  * @param arg
@@ -129,8 +127,7 @@ int rte_thread_create(rte_thread_t *thread_id,
 __rte_experimental
 int
 rte_thread_create_control(rte_thread_t *thread, const char *name,
-	const rte_thread_attr_t *thread_attr, rte_thread_func thread_func,
-	void *arg);
+		rte_thread_func thread_func, void *arg);
 
 /**
  * @warning
diff --git a/lib/eal/windows/eal_interrupts.c b/lib/eal/windows/eal_interrupts.c
index b1b1228c2b..66a49c844a 100644
--- a/lib/eal/windows/eal_interrupts.c
+++ b/lib/eal/windows/eal_interrupts.c
@@ -98,7 +98,7 @@ rte_eal_intr_init(void)
 		return -1;
 	}
 
-	ret = rte_thread_create_control(&intr_thread, "dpdk-intr", NULL,
+	ret = rte_thread_create_control(&intr_thread, "dpdk-intr",
 			eal_intr_thread_main, NULL);
 	if (ret != 0) {
 		rte_errno = -ret;
-- 
2.42.0


  parent reply	other threads:[~2023-09-06 16:23 UTC|newest]

Thread overview: 60+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-06 16:12 [PATCH 00/11] rework thread management Thomas Monjalon
2023-09-06 16:12 ` [PATCH 01/11] devtools: warn when adding some pthread calls Thomas Monjalon
2023-09-07  8:20   ` David Marchand
2023-09-06 16:12 ` [PATCH 02/11] eal: rename thread name length definition Thomas Monjalon
2023-09-08  4:00   ` Tyler Retzlaff
2023-09-06 16:12 ` Thomas Monjalon [this message]
2023-09-08  4:02   ` [PATCH 03/11] eal: remove attributes from control thread creation Tyler Retzlaff
2023-09-06 16:12 ` [PATCH 04/11] eal: promote thread API as stable Thomas Monjalon
2023-09-08  4:04   ` Tyler Retzlaff
2023-09-06 16:12 ` [PATCH 05/11] eal: force prefix for internal threads Thomas Monjalon
2023-09-07  8:28   ` David Marchand
2023-09-07  8:50     ` Morten Brørup
2023-09-07  8:53       ` David Marchand
2023-09-07  8:55         ` David Marchand
2023-09-07 11:10           ` Morten Brørup
2023-09-11 16:26             ` Thomas Monjalon
2023-09-11 21:32               ` Morten Brørup
2023-09-06 16:12 ` [PATCH 06/11] lib: convert to internal control threads Thomas Monjalon
2023-09-06 16:12 ` [PATCH 07/11] drivers: " Thomas Monjalon
2023-09-11 13:35   ` Andrew Rybchenko
2023-09-06 16:12 ` [PATCH 08/11] examples: convert to normal " Thomas Monjalon
2023-09-08  4:10   ` Tyler Retzlaff
2023-09-06 16:12 ` [PATCH 09/11] test: convert threads creation Thomas Monjalon
2023-09-08  4:12   ` Tyler Retzlaff
2023-09-06 16:12 ` [PATCH 10/11] eal: remove deprecated thread functions Thomas Monjalon
2023-09-08  4:22   ` Tyler Retzlaff
2023-09-11 16:13     ` Thomas Monjalon
2023-09-12  0:49       ` Tyler Retzlaff
2023-09-06 16:12 ` [PATCH 11/11] lib: remove pthread.h from includes Thomas Monjalon
2023-09-08  4:25   ` Tyler Retzlaff
2023-09-08  4:49     ` Ajit Khaparde
2023-09-10  2:55   ` Xu, Rosen
2023-09-07  8:30 ` [PATCH 00/11] rework thread management Morten Brørup
2023-09-08  4:26   ` Tyler Retzlaff
2023-09-13 10:34 ` [PATCH v2 " Thomas Monjalon
2023-09-13 10:34   ` [PATCH v2 01/11] devtools: warn when adding some pthread calls Thomas Monjalon
2023-09-13 10:34   ` [PATCH v2 02/11] eal: rename thread name length definition Thomas Monjalon
2023-09-13 10:34   ` [PATCH v2 03/11] eal: remove attributes from control thread creation Thomas Monjalon
2023-09-13 10:34   ` [PATCH v2 04/11] eal: promote thread API as stable Thomas Monjalon
2023-09-13 10:34   ` [PATCH v2 05/11] eal: force prefix for internal threads Thomas Monjalon
2023-09-13 10:34   ` [PATCH v2 06/11] lib: convert to internal control threads Thomas Monjalon
2023-09-13 10:34   ` [PATCH v2 07/11] drivers: " Thomas Monjalon
2023-09-13 10:34   ` [PATCH v2 08/11] examples: convert to normal " Thomas Monjalon
2023-09-13 10:34   ` [PATCH v2 09/11] test: convert threads creation Thomas Monjalon
2023-09-13 10:34   ` [PATCH v2 10/11] eal: remove deprecated thread functions Thomas Monjalon
2023-09-13 10:34   ` [PATCH v2 11/11] lib: remove pthread.h from includes Thomas Monjalon
2023-09-13 11:28 ` [PATCH v3 00/11] rework thread management Thomas Monjalon
2023-09-13 11:28   ` [PATCH v3 01/11] devtools: warn when adding some pthread calls Thomas Monjalon
2023-09-13 11:28   ` [PATCH v3 02/11] eal: rename thread name length definition Thomas Monjalon
2023-09-13 11:28   ` [PATCH v3 03/11] eal: remove attributes from control thread creation Thomas Monjalon
2023-09-13 11:28   ` [PATCH v3 04/11] eal: promote thread API as stable Thomas Monjalon
2023-09-13 11:28   ` [PATCH v3 05/11] eal: force prefix for internal threads Thomas Monjalon
2023-09-13 11:28   ` [PATCH v3 06/11] lib: convert to internal control threads Thomas Monjalon
2023-09-13 11:28   ` [PATCH v3 07/11] drivers: " Thomas Monjalon
2023-09-13 11:28   ` [PATCH v3 08/11] examples: convert to normal " Thomas Monjalon
2023-09-13 11:28   ` [PATCH v3 09/11] test: convert threads creation Thomas Monjalon
2023-09-13 11:28   ` [PATCH v3 10/11] eal: remove deprecated thread functions Thomas Monjalon
2023-09-13 11:28   ` [PATCH v3 11/11] lib: remove pthread.h from includes Thomas Monjalon
2023-09-17 12:26   ` [PATCH v3 00/11] rework thread management Konstantin Ananyev
2023-09-22 13:46   ` David Marchand

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=20230906162226.1618088-4-thomas@monjalon.net \
    --to=thomas@monjalon.net \
    --cc=beilei.xing@intel.com \
    --cc=bruce.richardson@intel.com \
    --cc=david.marchand@redhat.com \
    --cc=dev@dpdk.org \
    --cc=dmitry.kozliuk@gmail.com \
    --cc=dmitrym@microsoft.com \
    --cc=fengchengwen@huawei.com \
    --cc=ferruh.yigit@amd.com \
    --cc=hkalra@marvell.com \
    --cc=jianwang@trustnetic.com \
    --cc=jiawenwu@trustnetic.com \
    --cc=jingjing.wu@intel.com \
    --cc=kevin.laatz@intel.com \
    --cc=navasile@linux.microsoft.com \
    --cc=pallavi.kadam@intel.com \
    --cc=qi.z.zhang@intel.com \
    --cc=qiming.yang@intel.com \
    --cc=roretzla@linux.microsoft.com \
    --cc=wenjun1.wu@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).