DPDK patches and discussions
 help / color / mirror / Atom feed
From: Tyler Retzlaff <roretzla@linux.microsoft.com>
To: dev@dpdk.org
Cc: thomas@monjalon.net, david.marchand@redhat.com,
	jerinjacobk@gmail.com, mb@smartsharesystems.com,
	Tyler Retzlaff <roretzla@linux.microsoft.com>
Subject: [PATCH v9 2/4] eal: remove thread getname API
Date: Tue, 24 Jan 2023 10:02:29 -0800	[thread overview]
Message-ID: <1674583351-15292-3-git-send-email-roretzla@linux.microsoft.com> (raw)
In-Reply-To: <1674583351-15292-1-git-send-email-roretzla@linux.microsoft.com>

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 <roretzla@linux.microsoft.com>
Acked-by: Morten Brørup <mb@smartsharesystems.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
---
 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
-- 
1.8.3.1


  parent reply	other threads:[~2023-01-24 18:02 UTC|newest]

Thread overview: 91+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-07 19:00 [PATCH 0/5] add lcore set name and get name API Tyler Retzlaff
2022-12-07 19:00 ` [PATCH 1/5] eal: " Tyler Retzlaff
2022-12-07 21:03   ` Stephen Hemminger
2022-12-07 22:33     ` Tyler Retzlaff
2022-12-08  4:07       ` Stephen Hemminger
2022-12-08 17:11         ` Tyler Retzlaff
2022-12-07 19:00 ` [PATCH 2/5] eal: set lcore config thread for lcore main Tyler Retzlaff
2022-12-07 19:00 ` [PATCH 3/5] test: add a unit test for set and get lcore name APIs Tyler Retzlaff
2022-12-07 19:00 ` [PATCH 4/5] eal: remove thread getname API Tyler Retzlaff
2022-12-07 19:00 ` [PATCH 5/5] eal: deprecate rte thread setname API Tyler Retzlaff
2022-12-14 16:47 ` [PATCH v2 0/4] add rte_thread_set_name API for rte_thread_t Tyler Retzlaff
2022-12-14 16:47   ` [PATCH v2 1/4] eal: add thread set name API operating on rte thread Tyler Retzlaff
2023-01-11 16:09     ` David Marchand
2023-01-12 21:32       ` Tyler Retzlaff
2023-01-13  4:36       ` Jerin Jacob
2023-01-13 17:09         ` Tyler Retzlaff
2023-01-13 18:56           ` Tyler Retzlaff
2022-12-14 16:47   ` [PATCH v2 2/4] eal: remove thread getname API Tyler Retzlaff
2022-12-14 16:47   ` [PATCH v2 3/4] eal: deprecate rte thread setname API Tyler Retzlaff
2022-12-14 16:47   ` [PATCH v2 4/4] drivers: mlx5 use rte thread set name Tyler Retzlaff
2022-12-14 16:51     ` Morten Brørup
2023-01-10 20:53   ` [PATCH v2 0/4] add rte_thread_set_name API for rte_thread_t Tyler Retzlaff
2023-01-11  7:55     ` Morten Brørup
2023-01-12 21:55 ` [PATCH v3 " Tyler Retzlaff
2023-01-12 21:55   ` [PATCH v3 1/4] eal: add thread set name API operating on rte thread Tyler Retzlaff
2023-01-12 21:55   ` [PATCH v3 2/4] eal: remove thread getname API Tyler Retzlaff
2023-01-12 21:55   ` [PATCH v3 3/4] drivers: mlx5 use rte thread set name Tyler Retzlaff
2023-01-12 21:55   ` [PATCH v3 4/4] eal: deprecate rte thread setname API Tyler Retzlaff
2023-01-13 18:51 ` [PATCH v4 0/4] add rte_thread_set_name API for rte_thread_t Tyler Retzlaff
2023-01-13 18:52   ` [PATCH v4 1/4] eal: add thread set name API operating on rte thread Tyler Retzlaff
2023-01-13 18:52   ` [PATCH v4 2/4] eal: remove thread getname API Tyler Retzlaff
2023-01-17  7:49     ` Jerin Jacob
2023-01-17 18:22       ` Tyler Retzlaff
2023-01-13 18:52   ` [PATCH v4 3/4] drivers: mlx5 use rte thread set name Tyler Retzlaff
2023-01-13 18:52   ` [PATCH v4 4/4] eal: deprecate rte thread setname API Tyler Retzlaff
2023-01-17 18:21 ` [PATCH v5 0/4] add rte_thread_set_name API for rte_thread_t Tyler Retzlaff
2023-01-17 18:21   ` [PATCH v5 1/4] eal: add thread set name API operating on rte thread Tyler Retzlaff
2023-01-18 14:50     ` David Marchand
2023-01-17 18:21   ` [PATCH v5 2/4] eal: remove thread getname API Tyler Retzlaff
2023-01-18  6:28     ` Jerin Jacob
2023-01-18 14:51     ` David Marchand
2023-01-17 18:21   ` [PATCH v5 3/4] drivers: mlx5 use rte thread set name Tyler Retzlaff
2023-01-17 18:21   ` [PATCH v5 4/4] eal: deprecate rte thread setname API Tyler Retzlaff
2023-01-18 11:49     ` David Marchand
2023-01-18 19:54 ` [PATCH v6 0/5] add rte_thread_set_name API for rte_thread_t Tyler Retzlaff
2023-01-18 19:54   ` [PATCH v6 1/5] eal: add thread set name API operating on rte thread Tyler Retzlaff
2023-01-18 23:13     ` Stephen Hemminger
2023-01-18 23:44       ` Tyler Retzlaff
2023-01-18 19:54   ` [PATCH v6 2/5] eal: remove thread getname API Tyler Retzlaff
2023-01-18 19:54   ` [PATCH v6 3/5] eal: set thread name on Windows worker threads Tyler Retzlaff
2023-01-18 19:54   ` [PATCH v6 4/5] drivers: mlx5 use rte thread set name Tyler Retzlaff
2023-01-18 19:54   ` [PATCH v6 5/5] eal: deprecation notice for rte thread setname API Tyler Retzlaff
2023-01-22 13:55   ` [PATCH v6 0/5] add rte_thread_set_name API for rte_thread_t David Marchand
2023-01-23 18:57     ` Tyler Retzlaff
2023-01-23 19:39 ` [PATCH v7 " Tyler Retzlaff
2023-01-23 19:39   ` [PATCH v7 1/5] eal: add thread set name API operating on rte thread Tyler Retzlaff
2023-01-24 15:21     ` Thomas Monjalon
2023-01-23 19:39   ` [PATCH v7 2/5] eal: remove thread getname API Tyler Retzlaff
2023-01-24 15:24     ` Thomas Monjalon
2023-01-24 15:33       ` Tyler Retzlaff
2023-01-23 19:39   ` [PATCH v7 3/5] eal: set thread name on Windows worker threads Tyler Retzlaff
2023-01-24 15:25     ` Thomas Monjalon
2023-01-24 15:33       ` Tyler Retzlaff
2023-01-24 15:47         ` Thomas Monjalon
2023-01-23 19:39   ` [PATCH v7 4/5] drivers: mlx5 use rte thread set name Tyler Retzlaff
2023-01-24 15:50     ` Thomas Monjalon
2023-01-23 19:39   ` [PATCH v7 5/5] eal: deprecation notice for rte thread setname API Tyler Retzlaff
2023-01-24 16:03     ` Thomas Monjalon
2023-01-24 17:42 ` [PATCH v8 0/4] add rte_thread_set_name API for rte_thread_t Tyler Retzlaff
2023-01-24 17:42   ` [PATCH v8 1/4] eal: add thread set name API operating on rte thread Tyler Retzlaff
2023-01-24 17:42   ` [PATCH v8 2/4] eal: remove thread getname API Tyler Retzlaff
2023-01-24 17:42   ` [PATCH v8 3/4] eal: set thread name on Windows worker threads Tyler Retzlaff
2023-01-24 17:42   ` [PATCH v8 4/4] eal: deprecation notice for rte thread setname API Tyler Retzlaff
2023-01-24 18:02 ` [PATCH v9 0/4] add rte_thread_set_name API for rte_thread_t Tyler Retzlaff
2023-01-24 18:02   ` [PATCH v9 1/4] eal: add thread set name API operating on rte thread Tyler Retzlaff
2023-01-24 18:02   ` Tyler Retzlaff [this message]
2023-01-24 18:02   ` [PATCH v9 3/4] eal: set thread name on Windows worker threads Tyler Retzlaff
2023-01-24 18:02   ` [PATCH v9 4/4] eal: deprecation notice for rte thread setname API Tyler Retzlaff
2023-01-24 18:05     ` Thomas Monjalon
2023-01-24 18:21       ` Tyler Retzlaff
2023-01-24 18:12 ` [PATCH v10 0/4] add rte_thread_set_name API for rte_thread_t Tyler Retzlaff
2023-01-24 18:12   ` [PATCH v10 1/4] eal: add thread set name API operating on rte thread Tyler Retzlaff
2023-01-24 18:12   ` [PATCH v10 2/4] eal: remove thread getname API Tyler Retzlaff
2023-01-24 18:12   ` [PATCH v10 3/4] eal: set thread name on Windows worker threads Tyler Retzlaff
2023-01-24 18:12   ` [PATCH v10 4/4] eal: deprecation notice for rte thread setname API Tyler Retzlaff
2023-01-30 15:46     ` Thomas Monjalon
2023-01-30 16:19       ` David Marchand
2023-01-30 20:34         ` Tyler Retzlaff
2023-01-31  9:53           ` David Marchand
2023-01-31 17:09             ` Tyler Retzlaff
2023-01-31  9:54   ` [PATCH v10 0/4] add rte_thread_set_name API for rte_thread_t 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=1674583351-15292-3-git-send-email-roretzla@linux.microsoft.com \
    --to=roretzla@linux.microsoft.com \
    --cc=david.marchand@redhat.com \
    --cc=dev@dpdk.org \
    --cc=jerinjacobk@gmail.com \
    --cc=mb@smartsharesystems.com \
    --cc=thomas@monjalon.net \
    /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).