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 3A6D742588; Wed, 13 Sep 2023 12:36:42 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 228F640689; Wed, 13 Sep 2023 12:36:42 +0200 (CEST) Received: from wout5-smtp.messagingengine.com (wout5-smtp.messagingengine.com [64.147.123.21]) by mails.dpdk.org (Postfix) with ESMTP id B8A5240685 for ; Wed, 13 Sep 2023 12:36:40 +0200 (CEST) Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.west.internal (Postfix) with ESMTP id 371E23200034; Wed, 13 Sep 2023 06:36:38 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute5.internal (MEProxy); Wed, 13 Sep 2023 06:36:40 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h= cc:cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:sender:subject:subject:to:to; s=fm2; t= 1694601397; x=1694687797; bh=EUKNyUWMwzAdPPKZvr+lgcbvVSZusN28/YR l3AeLfus=; b=kxlAtWn9BDidL+nMLTPdi0HW1nZoCj1hVpo4DU2aYUSMy8BLL2c SzQaLuwvMFWHHaJv91Fe/TUB5JoWb0GMzo5MArKnB6EGT5CfVrpsqmrbM7Hh+hUH 6UetsTjYKkkCOJpJ0nf79tijHx2GZl7eW3bGGIJwwJrQ3zmtuzol3ljz6Z9qhwQQ D8qJi9lWXGcmWurilEMRENg5x+ykAhCzmzzetMwpcYFEY4aI6SZ6B6rAXEv2XLXo BvMNv+6HNAxUBHcQg4Q0Wxl+LI55Z3t/fTjYgrlZg8w6pD4gICv9sHAfDRwue64i BoTnwHRUi5miVLbVl8nDHY9aUyVq/pfcQFw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:sender:subject:subject:to:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t= 1694601397; x=1694687797; bh=EUKNyUWMwzAdPPKZvr+lgcbvVSZusN28/YR l3AeLfus=; b=KBsbQslg8aq5IQHuhKgyyqFlUusAr9id9rtWNdd8V4ujbS8URag UdxNNqiOXJXQ0wxudIiu85FgcQo991izPTBSU0Q9ELfX9+sZU1f+tWE+v1y1d3qm 8XL0J4990p2sm3KW4UoOUBV+KGuKdRJkXbgM3YIsiQsns8JTM+3ruPhI5KzfdGy0 6mcErv+mizahdTtPxX148fpQCGtvTQvUqSl1YUz1I2YqPGAWyfNrk9xWQSrBtPfW FqQGAwNgjNjcmOJOk+1Ru6IVtHmyY6SZei5C58LB2nxEQvihbcemNdN9UCsiW6H1 tOi0tqt0Wq/v2qeq75jQ8aXr9e1u5hvv44g== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedviedrudeikedgvdelucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvvefufffkofgjfhggtgfgsehtkeertdertdejnecuhfhrohhmpefvhhho mhgrshcuofhonhhjrghlohhnuceothhhohhmrghssehmohhnjhgrlhhonhdrnhgvtheqne cuggftrfgrthhtvghrnheptdeiffffgeefteelhfekueetueduffejgfelvedtieejudek gfevheetheehgeejnecuvehluhhsthgvrhfuihiivgepfeenucfrrghrrghmpehmrghilh hfrhhomhepthhhohhmrghssehmohhnjhgrlhhonhdrnhgvth X-ME-Proxy: Feedback-ID: i47234305:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 13 Sep 2023 06:36:32 -0400 (EDT) From: Thomas Monjalon To: dev@dpdk.org Cc: Tyler Retzlaff , David Marchand , Ferruh Yigit , =?UTF-8?q?Morten=20Br=C3=B8rup?= , Chengwen Feng , Kevin Laatz , Bruce Richardson , Jingjing Wu , Beilei Xing , Qiming Yang , Qi Zhang , Wenjun Wu , Jiawen Wu , Jian Wang , Harman Kalra , Dmitry Kozlyuk , Narcisa Ana Maria Vasile , Dmitry Malloy , Pallavi Kadam Subject: [PATCH v2 03/11] eal: remove attributes from control thread creation Date: Wed, 13 Sep 2023 12:34:22 +0200 Message-ID: <20230913103600.1935292-4-thomas@monjalon.net> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20230913103600.1935292-1-thomas@monjalon.net> References: <20230906162226.1618088-1-thomas@monjalon.net> <20230913103600.1935292-1-thomas@monjalon.net> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 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 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 Acked-by: Morten Brørup Acked-by: Tyler Retzlaff --- 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