From patchwork Wed Jan 18 19:54:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Tyler Retzlaff X-Patchwork-Id: 122322 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id BACF942411; Wed, 18 Jan 2023 20:54:36 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 95D0142D81; Wed, 18 Jan 2023 20:54:16 +0100 (CET) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 2B8FC41144 for ; Wed, 18 Jan 2023 20:54:11 +0100 (CET) Received: by linux.microsoft.com (Postfix, from userid 1086) id 5369220E0A07; Wed, 18 Jan 2023 11:54:10 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 5369220E0A07 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1674071650; bh=ie6Y0IkgtFymkx4Yv0Dou+aGiyei/lep94bl/uRRioI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ndlk/ltiP4FQzXTtbwvO3gvEDDH5P2IwG96JOrWqMiNP0N747D648mvLmY75pmbTR PgstRA6ENfmx5+ZJnAsW3+9FGf0D4nOt0k3UCpHtY8uQpoURE5A7brIDUq9lrc48y9 9kux6GhE8EjLpcOQUmHkH9Vap9/isnAYzy+5Gn0Y= From: Tyler Retzlaff To: dev@dpdk.org Cc: thomas@monjalon.net, david.marchand@redhat.com, jerinjacobk@gmail.com, mb@smartsharesystems.com, Tyler Retzlaff Subject: [PATCH v6 1/5] eal: add thread set name API operating on rte thread Date: Wed, 18 Jan 2023 11:54:02 -0800 Message-Id: <1674071646-6854-2-git-send-email-roretzla@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1674071646-6854-1-git-send-email-roretzla@linux.microsoft.com> References: <1670439617-9054-1-git-send-email-roretzla@linux.microsoft.com> <1674071646-6854-1-git-send-email-roretzla@linux.microsoft.com> MIME-Version: 1.0 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 Add a rte_thread_set_name that sets the name of an rte_thread_t thread. This is a replacement for the rte_thread_setname(pthread_t, ...) which exposes platform-specific details. Signed-off-by: Tyler Retzlaff Series-acked-by: Morten Brørup --- lib/eal/common/eal_common_thread.c | 8 ++----- lib/eal/freebsd/eal.c | 3 +-- lib/eal/freebsd/eal_thread.c | 11 +++++++++ lib/eal/include/rte_thread.h | 17 ++++++++++++++ lib/eal/linux/eal.c | 6 +---- lib/eal/linux/eal_thread.c | 22 ++++++++++++++++++ lib/eal/version.map | 3 +++ lib/eal/windows/rte_thread.c | 46 ++++++++++++++++++++++++++++++++++++++ 8 files changed, 103 insertions(+), 13 deletions(-) diff --git a/lib/eal/common/eal_common_thread.c b/lib/eal/common/eal_common_thread.c index 38d83a6..3181515 100644 --- a/lib/eal/common/eal_common_thread.c +++ b/lib/eal/common/eal_common_thread.c @@ -288,12 +288,8 @@ static void *ctrl_thread_init(void *arg) return -ret; } - if (name != NULL) { - ret = rte_thread_setname(*thread, name); - if (ret < 0) - RTE_LOG(DEBUG, EAL, - "Cannot set name for ctrl thread\n"); - } + if (name != NULL) + rte_thread_set_name((rte_thread_t){(uintptr_t)*thread}, name); /* Wait for the control thread to initialize successfully */ while ((ctrl_thread_status = diff --git a/lib/eal/freebsd/eal.c b/lib/eal/freebsd/eal.c index 8db5007..9303401 100644 --- a/lib/eal/freebsd/eal.c +++ b/lib/eal/freebsd/eal.c @@ -817,8 +817,7 @@ static void rte_eal_init_alert(const char *msg) /* Set thread_name for aid in debugging. */ snprintf(thread_name, sizeof(thread_name), "rte-worker-%d", i); - rte_thread_setname((pthread_t)lcore_config[i].thread_id.opaque_id, - thread_name); + rte_thread_set_name(lcore_config[i].thread_id, thread_name); ret = rte_thread_set_affinity_by_id(lcore_config[i].thread_id, &lcore_config[i].cpuset); diff --git a/lib/eal/freebsd/eal_thread.c b/lib/eal/freebsd/eal_thread.c index ab81b52..b69f5d3 100644 --- a/lib/eal/freebsd/eal_thread.c +++ b/lib/eal/freebsd/eal_thread.c @@ -32,6 +32,17 @@ int rte_sys_gettid(void) return (int)lwpid; } +void rte_thread_set_name(rte_thread_t thread_id, const char *thread_name) +{ + char truncated[RTE_MAX_THREAD_NAME_LEN]; + const size_t truncatedsz = sizeof(truncated); + + if (strlcpy(truncated, thread_name, truncatedsz) >= truncatedsz) + RTE_LOG(DEBUG, EAL, "Truncated thread name\n"); + + pthread_set_name_np((pthread_t)thread_id.opaque_id, truncated); +} + int rte_thread_setname(pthread_t id, const char *name) { /* this BSD function returns no error */ diff --git a/lib/eal/include/rte_thread.h b/lib/eal/include/rte_thread.h index b9edf70..8a63a52 100644 --- a/lib/eal/include/rte_thread.h +++ b/lib/eal/include/rte_thread.h @@ -146,6 +146,23 @@ int rte_thread_create(rte_thread_t *thread_id, * @warning * @b EXPERIMENTAL: this API may change without prior notice. * + * Set the name of the thread. + * + * @param thread_id + * The id of the thread to set name. + * + * @param thread_name + * The name to set. Truncated to RTE_MAX_THREAD_NAME_LEN, + * including terminating NUL if necessary. + */ +__rte_experimental +void +rte_thread_set_name(rte_thread_t thread_id, const char *thread_name); + +/** + * @warning + * @b EXPERIMENTAL: this API may change without prior notice. + * * Check if 2 thread ids are equal. * * @param t1 diff --git a/lib/eal/linux/eal.c b/lib/eal/linux/eal.c index 60298c0..d4c3507 100644 --- a/lib/eal/linux/eal.c +++ b/lib/eal/linux/eal.c @@ -1261,11 +1261,7 @@ static void rte_eal_init_alert(const char *msg) /* Set thread_name for aid in debugging. */ snprintf(thread_name, sizeof(thread_name), "rte-worker-%d", i); - ret = rte_thread_setname((pthread_t)lcore_config[i].thread_id.opaque_id, - thread_name); - if (ret != 0) - RTE_LOG(DEBUG, EAL, - "Cannot set name for lcore thread\n"); + rte_thread_set_name(lcore_config[i].thread_id, thread_name); ret = rte_thread_set_affinity_by_id(lcore_config[i].thread_id, &lcore_config[i].cpuset); diff --git a/lib/eal/linux/eal_thread.c b/lib/eal/linux/eal_thread.c index 625bde6..d5fddab 100644 --- a/lib/eal/linux/eal_thread.c +++ b/lib/eal/linux/eal_thread.c @@ -10,6 +10,7 @@ #include #include +#include #include /* require calling thread tid by gettid() */ @@ -18,6 +19,27 @@ int rte_sys_gettid(void) return (int)syscall(SYS_gettid); } +void rte_thread_set_name(rte_thread_t thread_id, const char *thread_name) +{ + int ret = ENOSYS; +#if defined(__GLIBC__) && defined(__GLIBC_PREREQ) +#if __GLIBC_PREREQ(2, 12) + char truncated[RTE_MAX_THREAD_NAME_LEN]; + const size_t truncatedsz = sizeof(truncated); + + if (strlcpy(truncated, thread_name, truncatedsz) >= truncatedsz) + RTE_LOG(DEBUG, EAL, "Truncated thread name\n"); + + ret = pthread_setname_np((pthread_t)thread_id.opaque_id, truncated); +#endif +#endif + RTE_SET_USED(thread_id); + RTE_SET_USED(thread_name); + + if (ret != 0) + RTE_LOG(DEBUG, EAL, "Failed to set thread name\n"); +} + int rte_thread_setname(pthread_t id, const char *name) { int ret = ENOSYS; diff --git a/lib/eal/version.map b/lib/eal/version.map index 7ad12a7..c98ba71 100644 --- a/lib/eal/version.map +++ b/lib/eal/version.map @@ -440,6 +440,9 @@ EXPERIMENTAL { rte_thread_detach; rte_thread_equal; rte_thread_join; + + # added in 23.03 + rte_thread_set_name; }; INTERNAL { diff --git a/lib/eal/windows/rte_thread.c b/lib/eal/windows/rte_thread.c index 1c1e9d0..c26659d 100644 --- a/lib/eal/windows/rte_thread.c +++ b/lib/eal/windows/rte_thread.c @@ -4,7 +4,9 @@ */ #include +#include +#include #include #include #include @@ -305,6 +307,50 @@ struct thread_routine_ctx { return thread_id; } +void +rte_thread_set_name(rte_thread_t thread_id, const char *thread_name) +{ + int ret = 0; + wchar_t wname[RTE_MAX_THREAD_NAME_LEN]; + mbstate_t state = {0}; + size_t rv; + HANDLE thread_handle; + + thread_handle = OpenThread(THREAD_ALL_ACCESS, FALSE, + thread_id.opaque_id); + if (thread_handle == NULL) { + ret = thread_log_last_error("OpenThread()"); + goto cleanup; + } + + memset(wname, 0, sizeof(wname)); + rv = mbsrtowcs(wname, &thread_name, RTE_DIM(wname) - 1, &state); + if (rv == (size_t)-1) { + ret = EILSEQ; + goto cleanup; + } + + if (wcslen(wname) < strlen(thread_name)) + RTE_LOG(DEBUG, EAL, "Truncated thread name\n"); + +#ifndef RTE_TOOLCHAIN_GCC + if (FAILED(SetThreadDescription(thread_handle, wname))) { + ret = EINVAL; + goto cleanup; + } +#else + ret = ENOTSUP; + goto cleanup; +#endif + +cleanup: + if (thread_handle != NULL) + CloseHandle(thread_handle); + + if (ret != 0) + RTE_LOG(DEBUG, EAL, "Failed to set thread name\n"); +} + int rte_thread_get_priority(rte_thread_t thread_id, enum rte_thread_priority *priority) From patchwork Wed Jan 18 19:54:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tyler Retzlaff X-Patchwork-Id: 122321 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 460A242411; Wed, 18 Jan 2023 20:54:30 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8D16742D79; Wed, 18 Jan 2023 20:54:15 +0100 (CET) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 19C3340223 for ; Wed, 18 Jan 2023 20:54:11 +0100 (CET) Received: by linux.microsoft.com (Postfix, from userid 1086) id 5FC7A20E0A08; Wed, 18 Jan 2023 11:54:10 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 5FC7A20E0A08 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1674071650; bh=SUHIiAs0LHTz9dbXTIas1dOezbWQY/rvs0pICplRDkk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Gh+7pLHQ12uy5oPpxgS2i+Ik/HbbJaUrZCzLn7C8808iDys1MOPj5N3CsvQitClBt mD+bY4RRAkcSkmr2K3ahaVcQd+QSV5dWNmPu2/ONhIYcZGTeSEbTeR67UMmq8n6bro 0klwHBYEjjgwL1j8gXwDrWq/KIQVQlPAYfxpPpH0= From: Tyler Retzlaff To: dev@dpdk.org Cc: thomas@monjalon.net, david.marchand@redhat.com, jerinjacobk@gmail.com, mb@smartsharesystems.com, Tyler Retzlaff Subject: [PATCH v6 2/5] eal: remove thread getname API Date: Wed, 18 Jan 2023 11:54:03 -0800 Message-Id: <1674071646-6854-3-git-send-email-roretzla@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1674071646-6854-1-git-send-email-roretzla@linux.microsoft.com> References: <1670439617-9054-1-git-send-email-roretzla@linux.microsoft.com> <1674071646-6854-1-git-send-email-roretzla@linux.microsoft.com> 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 Remove the rte_thread_getname API. The API is __rte_experimental and requires no deprecation notice. Fold the platform specific variants into the one place it is used as a special case to retain the functionality for linux only. Adjust the function as follows. * reduce scope where thread_get_name can be used to eal_common_trace.c * change the return type to void since the return value is not consistent reportable depending on glibc version. * change the thread id type to be rte_thread_t. Signed-off-by: Tyler Retzlaff Acked-by: Jerin Jacob --- lib/eal/common/eal_common_trace.c | 15 ++++++++++++++- lib/eal/freebsd/eal_thread.c | 9 --------- lib/eal/include/rte_lcore.h | 17 ----------------- lib/eal/linux/eal_thread.c | 15 --------------- lib/eal/version.map | 1 - 5 files changed, 14 insertions(+), 43 deletions(-) diff --git a/lib/eal/common/eal_common_trace.c b/lib/eal/common/eal_common_trace.c index 5caaac8..75162b7 100644 --- a/lib/eal/common/eal_common_trace.c +++ b/lib/eal/common/eal_common_trace.c @@ -298,6 +298,19 @@ rte_trace_mode rte_trace_mode_get(void) trace_point_dump(f, tp); } +static void +thread_get_name(rte_thread_t id, char *name, size_t len) +{ +#if defined(RTE_EXEC_ENV_LINUX) && defined(__GLIBC__) && defined(__GLIBC_PREREQ) +#if __GLIBC_PREREQ(2, 12) + pthread_getname_np((pthread_t)id.opaque_id, name, len); +#endif +#endif + RTE_SET_USED(id); + RTE_SET_USED(name); + RTE_SET_USED(len); +} + void __rte_trace_mem_per_thread_alloc(void) { @@ -356,7 +369,7 @@ rte_trace_mode rte_trace_mode_get(void) /* Store the thread name */ char *name = header->stream_header.thread_name; memset(name, 0, __RTE_TRACE_EMIT_STRING_LEN_MAX); - rte_thread_getname(pthread_self(), name, + thread_get_name(rte_thread_self(), name, __RTE_TRACE_EMIT_STRING_LEN_MAX); trace->lcore_meta[count].mem = header; diff --git a/lib/eal/freebsd/eal_thread.c b/lib/eal/freebsd/eal_thread.c index b69f5d3..3227d9b 100644 --- a/lib/eal/freebsd/eal_thread.c +++ b/lib/eal/freebsd/eal_thread.c @@ -49,12 +49,3 @@ int rte_thread_setname(pthread_t id, const char *name) pthread_set_name_np(id, name); return 0; } - -int rte_thread_getname(pthread_t id, char *name, size_t len) -{ - RTE_SET_USED(id); - RTE_SET_USED(name); - RTE_SET_USED(len); - - return -ENOTSUP; -} diff --git a/lib/eal/include/rte_lcore.h b/lib/eal/include/rte_lcore.h index 6938c3f..9c78650 100644 --- a/lib/eal/include/rte_lcore.h +++ b/lib/eal/include/rte_lcore.h @@ -352,23 +352,6 @@ enum rte_lcore_role_t { int rte_thread_setname(pthread_t id, const char *name); /** - * Get thread name. - * - * @note It fails with glibc < 2.12. - * - * @param id - * Thread id. - * @param name - * Thread name to set. - * @param len - * Thread name buffer length. - * @return - * On success, return 0; otherwise return a negative value. - */ -__rte_experimental -int rte_thread_getname(pthread_t id, char *name, size_t len); - -/** * Register current non-EAL thread as a lcore. * * @note This API is not compatible with the multi-process feature: diff --git a/lib/eal/linux/eal_thread.c b/lib/eal/linux/eal_thread.c index d5fddab..c07ad9d 100644 --- a/lib/eal/linux/eal_thread.c +++ b/lib/eal/linux/eal_thread.c @@ -55,18 +55,3 @@ int rte_thread_setname(pthread_t id, const char *name) RTE_SET_USED(name); return -ret; } - -int rte_thread_getname(pthread_t id, char *name, size_t len) -{ - int ret = ENOSYS; -#if defined(__GLIBC__) && defined(__GLIBC_PREREQ) -#if __GLIBC_PREREQ(2, 12) - ret = pthread_getname_np(id, name, len); -#endif -#endif - RTE_SET_USED(id); - RTE_SET_USED(name); - RTE_SET_USED(len); - return -ret; - -} diff --git a/lib/eal/version.map b/lib/eal/version.map index c98ba71..6523102 100644 --- a/lib/eal/version.map +++ b/lib/eal/version.map @@ -369,7 +369,6 @@ EXPERIMENTAL { __rte_trace_point_register; per_lcore_trace_mem; per_lcore_trace_point_sz; - rte_thread_getname; # WINDOWS_NO_EXPORT rte_trace_dump; # WINDOWS_NO_EXPORT rte_trace_is_enabled; # WINDOWS_NO_EXPORT rte_trace_metadata_dump; # WINDOWS_NO_EXPORT From patchwork Wed Jan 18 19:54:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tyler Retzlaff X-Patchwork-Id: 122319 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 40D5142411; Wed, 18 Jan 2023 20:54:18 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8751F42D16; Wed, 18 Jan 2023 20:54:13 +0100 (CET) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 2075B4067E for ; Wed, 18 Jan 2023 20:54:11 +0100 (CET) Received: by linux.microsoft.com (Postfix, from userid 1086) id 6BF4F20E0A09; Wed, 18 Jan 2023 11:54:10 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 6BF4F20E0A09 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1674071650; bh=JK33kn+Fp53Awd2PliiIZhJ6/BtWFXhNabnUiUyrK3w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=l24hEeVTi0qYIQQQvJhxokQkgbaSO4ErTRuCJQQTTi8ZRgp5YxEWvq1TGOtwrkY3y K7BiSmq+mlTuhgBOxV1xiL0uOJ6GNMeKlFstUOP2zigWePLrOT13qrK4ihmVvRSt7e 5lVRvyyX4GIgYMc6VoyY5oPvqet5mk6Sl9HthbMs= From: Tyler Retzlaff To: dev@dpdk.org Cc: thomas@monjalon.net, david.marchand@redhat.com, jerinjacobk@gmail.com, mb@smartsharesystems.com, Tyler Retzlaff Subject: [PATCH v6 3/5] eal: set thread name on Windows worker threads Date: Wed, 18 Jan 2023 11:54:04 -0800 Message-Id: <1674071646-6854-4-git-send-email-roretzla@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1674071646-6854-1-git-send-email-roretzla@linux.microsoft.com> References: <1670439617-9054-1-git-send-email-roretzla@linux.microsoft.com> <1674071646-6854-1-git-send-email-roretzla@linux.microsoft.com> 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 Bring Windows EAL worker thread initialization in line with linux & freebsd by setting the worker thread name using the new platform agnostic rte_thread_set_name API. Signed-off-by: Tyler Retzlaff --- lib/eal/windows/eal.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/eal/windows/eal.c b/lib/eal/windows/eal.c index b9f95ed..e561f87 100644 --- a/lib/eal/windows/eal.c +++ b/lib/eal/windows/eal.c @@ -282,6 +282,7 @@ enum rte_proc_type_t enum rte_iova_mode iova_mode; int ret; char cpuset[RTE_CPU_AFFINITY_STR_LEN]; + char thread_name[RTE_MAX_THREAD_NAME_LEN]; eal_log_init(NULL, 0); @@ -437,6 +438,12 @@ enum rte_proc_type_t if (rte_thread_create(&lcore_config[i].thread_id, NULL, eal_thread_loop, (void *)(uintptr_t)i) != 0) rte_panic("Cannot create thread\n"); + + /* Set thread_name for aid in debugging. */ + snprintf(thread_name, sizeof(thread_name), + "rte-worker-%d", i); + rte_thread_set_name(lcore_config[i].thread_id, thread_name); + ret = rte_thread_set_affinity_by_id(lcore_config[i].thread_id, &lcore_config[i].cpuset); if (ret != 0) From patchwork Wed Jan 18 19:54:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tyler Retzlaff X-Patchwork-Id: 122320 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id ADB4E42411; Wed, 18 Jan 2023 20:54:24 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8252B42D67; Wed, 18 Jan 2023 20:54:14 +0100 (CET) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 23A2F41101 for ; Wed, 18 Jan 2023 20:54:11 +0100 (CET) Received: by linux.microsoft.com (Postfix, from userid 1086) id 782CE20E0A0B; Wed, 18 Jan 2023 11:54:10 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 782CE20E0A0B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1674071650; bh=dF/mOuxm6tz0LpnCL6O5V08ZPz70QGofpoe35szXW9k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dxBybAfGlf2A3daaEl0ZdUsbc11T7VALUTFjpZztB5vXMT6TXb/I3o4o4WZ+kj74L RgJ8YbtMI1LjpzRiWVeArTVJxCNNMGyU/ORTLzR94hOG7ssuN06EL2Fy9AP19Sp0nF yRpb17181KPArSKsBx5w/Kza978hECwwIb6B/PKo= From: Tyler Retzlaff To: dev@dpdk.org Cc: thomas@monjalon.net, david.marchand@redhat.com, jerinjacobk@gmail.com, mb@smartsharesystems.com, Tyler Retzlaff Subject: [PATCH v6 4/5] drivers: mlx5 use rte thread set name Date: Wed, 18 Jan 2023 11:54:05 -0800 Message-Id: <1674071646-6854-5-git-send-email-roretzla@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1674071646-6854-1-git-send-email-roretzla@linux.microsoft.com> References: <1670439617-9054-1-git-send-email-roretzla@linux.microsoft.com> <1674071646-6854-1-git-send-email-roretzla@linux.microsoft.com> 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 Use the new internal rte_thread_set_name API instead of the now deprecated rte_thread_setname API. Signed-off-by: Tyler Retzlaff --- drivers/net/mlx5/mlx5_hws_cnt.c | 3 ++- drivers/vdpa/mlx5/mlx5_vdpa_event.c | 3 +-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/net/mlx5/mlx5_hws_cnt.c b/drivers/net/mlx5/mlx5_hws_cnt.c index 51704ef..05cc954 100644 --- a/drivers/net/mlx5/mlx5_hws_cnt.c +++ b/drivers/net/mlx5/mlx5_hws_cnt.c @@ -465,7 +465,8 @@ struct mlx5_hws_cnt_pool * } snprintf(name, CNT_THREAD_NAME_MAX - 1, "%s/svc@%d", sh->ibdev_name, service_core); - rte_thread_setname(sh->cnt_svc->service_thread, name); + rte_thread_set_name((rte_thread_t){(uintptr_t)sh->cnt_svc->service_thread}, + name); CPU_SET(service_core, &cpuset); pthread_setaffinity_np(sh->cnt_svc->service_thread, sizeof(cpuset), &cpuset); diff --git a/drivers/vdpa/mlx5/mlx5_vdpa_event.c b/drivers/vdpa/mlx5/mlx5_vdpa_event.c index 4d81976..f3d392c 100644 --- a/drivers/vdpa/mlx5/mlx5_vdpa_event.c +++ b/drivers/vdpa/mlx5/mlx5_vdpa_event.c @@ -547,8 +547,7 @@ goto out; } snprintf(name, sizeof(name), "vDPA-mlx5-%d", priv->vid); - if (rte_thread_setname(priv->timer_tid, name) != 0) - DRV_LOG(DEBUG, "Cannot set timer thread name."); + rte_thread_set_name((rte_thread_t){(uintptr_t)priv->timer_tid}, name); out: if (attrp != NULL) pthread_attr_destroy(attrp); From patchwork Wed Jan 18 19:54:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Tyler Retzlaff X-Patchwork-Id: 122323 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 06BE342411; Wed, 18 Jan 2023 20:54:43 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 90BB742D88; Wed, 18 Jan 2023 20:54:17 +0100 (CET) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id BE6F4400D6 for ; Wed, 18 Jan 2023 20:54:11 +0100 (CET) Received: by linux.microsoft.com (Postfix, from userid 1086) id 845E120E0A0C; Wed, 18 Jan 2023 11:54:10 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 845E120E0A0C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1674071650; bh=1ksEMCZp0fpPBnGHyyomqz5N+Ojvh9+FK0J7y3RWOeU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Irifj1qXYWQS0sUwpGOildiDnknuCCzX7OMIeCX6X0sAiUMKOn4rXbABVAfZwOiXt TdY4LIIRXUZPkBct52EnLW8NkUdMEwi95ezEmwP3Me0C+6KgELqcUvfbK7pQ1Te3cj 2kEdWc9gLkMIPPYzh4vKe5tblkTe3Iw/TXvSK1FA= From: Tyler Retzlaff To: dev@dpdk.org Cc: thomas@monjalon.net, david.marchand@redhat.com, jerinjacobk@gmail.com, mb@smartsharesystems.com, Tyler Retzlaff Subject: [PATCH v6 5/5] eal: deprecation notice for rte thread setname API Date: Wed, 18 Jan 2023 11:54:06 -0800 Message-Id: <1674071646-6854-6-git-send-email-roretzla@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1674071646-6854-1-git-send-email-roretzla@linux.microsoft.com> References: <1670439617-9054-1-git-send-email-roretzla@linux.microsoft.com> <1674071646-6854-1-git-send-email-roretzla@linux.microsoft.com> MIME-Version: 1.0 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 Notify deprecation of rte_thread_setname API, it will be removed as it exposes platform-specific thread details. The functionality it provided is now available via the new rte_lcore_set_name API. Signed-off-by: Tyler Retzlaff Acked-by: David Marchand Series-acked-by: Morten Brørup --- doc/guides/rel_notes/deprecation.rst | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst index e18ac34..2990bb1 100644 --- a/doc/guides/rel_notes/deprecation.rst +++ b/doc/guides/rel_notes/deprecation.rst @@ -126,3 +126,7 @@ Deprecation Notices Its removal has been postponed to let potential users report interest in maintaining it. In the absence of such interest, this library will be removed in DPDK 23.11. + +* eal: The function ``rte_thread_setname`` will be removed, continuing + the effort to decouple EAL from platform-specific thread + implementations.