DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] eal: fix thread naming on FreeBSD
@ 2016-06-17 15:25 Thomas Monjalon
  2016-06-17 15:56 ` David Marchand
  0 siblings, 1 reply; 7+ messages in thread
From: Thomas Monjalon @ 2016-06-17 15:25 UTC (permalink / raw)
  To: david.marchand; +Cc: reshma.pattan, dev

rte_thread_setname was a macro defined only for Linux.
The function rte_thread_setname() can now be used on FreeBSD
as well on Linux.
It is required to build librte_pdump.

The macro was 0 for old glibc. The function is now returning -1.
The related logs are decreased from error to debug level because
it is not an important failure, just a debug inconvenience.

Fixes: 278f945402c5 ("pdump: add new library for packet capture")

Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
---
 examples/tep_termination/main.c                    |  2 +-
 examples/vhost/main.c                              |  2 +-
 examples/vhost_xen/main.c                          |  2 +-
 lib/librte_eal/bsdapp/eal/eal.c                    |  2 +-
 lib/librte_eal/bsdapp/eal/eal_thread.c             |  7 +++++++
 lib/librte_eal/bsdapp/eal/rte_eal_version.map      |  1 +
 lib/librte_eal/common/include/rte_lcore.h          | 23 ++++++++--------------
 lib/librte_eal/linuxapp/eal/eal.c                  |  2 +-
 lib/librte_eal/linuxapp/eal/eal_interrupts.c       |  2 +-
 lib/librte_eal/linuxapp/eal/eal_pci_vfio_mp_sync.c |  2 +-
 lib/librte_eal/linuxapp/eal/eal_thread.c           | 11 +++++++++++
 lib/librte_eal/linuxapp/eal/eal_timer.c            |  4 ++--
 lib/librte_eal/linuxapp/eal/rte_eal_version.map    |  1 +
 13 files changed, 37 insertions(+), 24 deletions(-)

diff --git a/examples/tep_termination/main.c b/examples/tep_termination/main.c
index b8297dd..aa67a6b 100644
--- a/examples/tep_termination/main.c
+++ b/examples/tep_termination/main.c
@@ -1246,7 +1246,7 @@ main(int argc, char *argv[])
 		snprintf(thread_name, RTE_MAX_THREAD_NAME_LEN, "print-stats");
 		ret = rte_thread_setname(tid, thread_name);
 		if (ret != 0)
-			RTE_LOG(ERR, VHOST_CONFIG, "Cannot set print-stats name\n");
+			RTE_LOG(DEBUG, VHOST_CONFIG, "Cannot set print-stats name\n");
 	}
 
 	/* Launch all data cores. */
diff --git a/examples/vhost/main.c b/examples/vhost/main.c
index 665886e..f849571 100644
--- a/examples/vhost/main.c
+++ b/examples/vhost/main.c
@@ -1474,7 +1474,7 @@ main(int argc, char *argv[])
 		snprintf(thread_name, RTE_MAX_THREAD_NAME_LEN, "print-stats");
 		ret = rte_thread_setname(tid, thread_name);
 		if (ret != 0)
-			RTE_LOG(ERR, VHOST_CONFIG,
+			RTE_LOG(DEBUG, VHOST_CONFIG,
 				"Cannot set print-stats name\n");
 	}
 
diff --git a/examples/vhost_xen/main.c b/examples/vhost_xen/main.c
index 2b04c95..2e40357 100644
--- a/examples/vhost_xen/main.c
+++ b/examples/vhost_xen/main.c
@@ -1494,7 +1494,7 @@ main(int argc, char *argv[])
 		snprintf(thread_name, RTE_MAX_THREAD_NAME_LEN, "print-xen-stats");
 		ret = rte_thread_setname(tid, thread_name);
 		if (ret != 0)
-			RTE_LOG(ERR, VHOST_CONFIG,
+			RTE_LOG(DEBUG, VHOST_CONFIG,
 				"Cannot set print-stats name\n");
 	}
 
diff --git a/lib/librte_eal/bsdapp/eal/eal.c b/lib/librte_eal/bsdapp/eal/eal.c
index 06bfd4e..a0c8f8c 100644
--- a/lib/librte_eal/bsdapp/eal/eal.c
+++ b/lib/librte_eal/bsdapp/eal/eal.c
@@ -605,7 +605,7 @@ rte_eal_init(int argc, char **argv)
 		/* Set thread_name for aid in debugging. */
 		snprintf(thread_name, RTE_MAX_THREAD_NAME_LEN,
 				"lcore-slave-%d", i);
-		pthread_set_name_np(lcore_config[i].thread_id, thread_name);
+		rte_thread_setname(lcore_config[i].thread_id, thread_name);
 	}
 
 	/*
diff --git a/lib/librte_eal/bsdapp/eal/eal_thread.c b/lib/librte_eal/bsdapp/eal/eal_thread.c
index 9a03437..1b8cd8a 100644
--- a/lib/librte_eal/bsdapp/eal/eal_thread.c
+++ b/lib/librte_eal/bsdapp/eal/eal_thread.c
@@ -199,3 +199,10 @@ int rte_sys_gettid(void)
 	thr_self(&lwpid);
 	return (int)lwpid;
 }
+
+int rte_thread_setname(pthread_t id, const char *name)
+{
+	/* this BSD function returns no error */
+	pthread_set_name_np(id, name);
+	return 0;
+}
diff --git a/lib/librte_eal/bsdapp/eal/rte_eal_version.map b/lib/librte_eal/bsdapp/eal/rte_eal_version.map
index 97d091b..3b4dd3b 100644
--- a/lib/librte_eal/bsdapp/eal/rte_eal_version.map
+++ b/lib/librte_eal/bsdapp/eal/rte_eal_version.map
@@ -157,5 +157,6 @@ DPDK_16.07 {
 
 	pci_get_sysfs_path;
 	rte_keepalive_register_relay_callback;
+	rte_thread_setname;
 
 } DPDK_16.04;
diff --git a/lib/librte_eal/common/include/rte_lcore.h b/lib/librte_eal/common/include/rte_lcore.h
index ac15130..1dcfba7 100644
--- a/lib/librte_eal/common/include/rte_lcore.h
+++ b/lib/librte_eal/common/include/rte_lcore.h
@@ -250,23 +250,16 @@ void rte_thread_get_affinity(rte_cpuset_t *cpusetp);
 /**
  * Set thread names.
  *
- * Macro to wrap `pthread_setname_np()` with a glibc version check.
- * Only glibc >= 2.12 supports this feature.
+ * @note Only glibc >= 2.12 supports this feature.
  *
- * This macro only used for Linux, BSD does direct libc call.
- * BSD libc version of function is `pthread_set_name_np()`.
+ * @param id
+ *   Thread id.
+ * @param name
+ *   Thread name to set.
+ * @return
+ *   On success, return 0; otherwise return a negative value.
  */
-#if defined(__DOXYGEN__)
-#define rte_thread_setname(...) pthread_setname_np(__VA_ARGS__)
-#endif
-
-#if defined(__GLIBC__) && defined(__GLIBC_PREREQ)
-#if __GLIBC_PREREQ(2, 12)
-#define rte_thread_setname(...) pthread_setname_np(__VA_ARGS__)
-#else
-#define rte_thread_setname(...) 0
-#endif
-#endif
+int rte_thread_setname(pthread_t id, const char *name);
 
 #ifdef __cplusplus
 }
diff --git a/lib/librte_eal/linuxapp/eal/eal.c b/lib/librte_eal/linuxapp/eal/eal.c
index bba8fea..4f22c18 100644
--- a/lib/librte_eal/linuxapp/eal/eal.c
+++ b/lib/librte_eal/linuxapp/eal/eal.c
@@ -859,7 +859,7 @@ rte_eal_init(int argc, char **argv)
 		ret = rte_thread_setname(lcore_config[i].thread_id,
 						thread_name);
 		if (ret != 0)
-			RTE_LOG(ERR, EAL,
+			RTE_LOG(DEBUG, EAL,
 				"Cannot set name for lcore thread\n");
 	}
 
diff --git a/lib/librte_eal/linuxapp/eal/eal_interrupts.c b/lib/librte_eal/linuxapp/eal/eal_interrupts.c
index a9af396..47a3b20 100644
--- a/lib/librte_eal/linuxapp/eal/eal_interrupts.c
+++ b/lib/librte_eal/linuxapp/eal/eal_interrupts.c
@@ -887,7 +887,7 @@ rte_eal_intr_init(void)
 			"eal-intr-thread");
 		ret_1 = rte_thread_setname(intr_thread, thread_name);
 		if (ret_1 != 0)
-			RTE_LOG(ERR, EAL,
+			RTE_LOG(DEBUG, EAL,
 			"Failed to set thread name for interrupt handling\n");
 	}
 
diff --git a/lib/librte_eal/linuxapp/eal/eal_pci_vfio_mp_sync.c b/lib/librte_eal/linuxapp/eal/eal_pci_vfio_mp_sync.c
index 26d966e..d54ded8 100644
--- a/lib/librte_eal/linuxapp/eal/eal_pci_vfio_mp_sync.c
+++ b/lib/librte_eal/linuxapp/eal/eal_pci_vfio_mp_sync.c
@@ -399,7 +399,7 @@ pci_vfio_mp_sync_setup(void)
 	snprintf(thread_name, RTE_MAX_THREAD_NAME_LEN, "pci-vfio-sync");
 	ret = rte_thread_setname(socket_thread, thread_name);
 	if (ret)
-		RTE_LOG(ERR, EAL,
+		RTE_LOG(DEBUG, EAL,
 			"Failed to set thread name for secondary processes!\n");
 
 	return 0;
diff --git a/lib/librte_eal/linuxapp/eal/eal_thread.c b/lib/librte_eal/linuxapp/eal/eal_thread.c
index 18bd8e0..8c3bf03 100644
--- a/lib/librte_eal/linuxapp/eal/eal_thread.c
+++ b/lib/librte_eal/linuxapp/eal/eal_thread.c
@@ -197,3 +197,14 @@ int rte_sys_gettid(void)
 {
 	return (int)syscall(SYS_gettid);
 }
+
+int rte_thread_setname(pthread_t id, const char *name)
+{
+	int ret = -1;
+#if defined(__GLIBC__) && defined(__GLIBC_PREREQ)
+#if __GLIBC_PREREQ(2, 12)
+	ret = pthread_setname_np(id, name);
+#endif
+#endif
+	return ret;
+}
diff --git a/lib/librte_eal/linuxapp/eal/eal_timer.c b/lib/librte_eal/linuxapp/eal/eal_timer.c
index f2abb7b..afa32f5 100644
--- a/lib/librte_eal/linuxapp/eal/eal_timer.c
+++ b/lib/librte_eal/linuxapp/eal/eal_timer.c
@@ -222,8 +222,8 @@ rte_eal_hpet_init(int make_default)
 	snprintf(thread_name, RTE_MAX_THREAD_NAME_LEN, "hpet-msb-inc");
 	ret = rte_thread_setname(msb_inc_thread_id, thread_name);
 	if (ret != 0)
-		RTE_LOG(ERR, EAL,
-			"ERROR: Cannot set HPET timer thread name!\n");
+		RTE_LOG(DEBUG, EAL,
+			"Cannot set HPET timer thread name!\n");
 
 	if (make_default)
 		eal_timer_source = EAL_TIMER_HPET;
diff --git a/lib/librte_eal/linuxapp/eal/rte_eal_version.map b/lib/librte_eal/linuxapp/eal/rte_eal_version.map
index 4874c92..7330a46 100644
--- a/lib/librte_eal/linuxapp/eal/rte_eal_version.map
+++ b/lib/librte_eal/linuxapp/eal/rte_eal_version.map
@@ -160,5 +160,6 @@ DPDK_16.07 {
 
 	pci_get_sysfs_path;
 	rte_keepalive_register_relay_callback;
+	rte_thread_setname;
 
 } DPDK_16.04;
-- 
2.7.0

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [dpdk-dev] [PATCH] eal: fix thread naming on FreeBSD
  2016-06-17 15:25 [dpdk-dev] [PATCH] eal: fix thread naming on FreeBSD Thomas Monjalon
@ 2016-06-17 15:56 ` David Marchand
  2016-06-17 16:02   ` [dpdk-dev] [PATCH v2] " Thomas Monjalon
  0 siblings, 1 reply; 7+ messages in thread
From: David Marchand @ 2016-06-17 15:56 UTC (permalink / raw)
  To: Thomas Monjalon; +Cc: reshma.pattan, dev

On Fri, Jun 17, 2016 at 5:25 PM, Thomas Monjalon
<thomas.monjalon@6wind.com> wrote:
> rte_thread_setname was a macro defined only for Linux.
> The function rte_thread_setname() can now be used on FreeBSD
> as well on Linux.
> It is required to build librte_pdump.
>
> The macro was 0 for old glibc. The function is now returning -1.
> The related logs are decreased from error to debug level because
> it is not an important failure, just a debug inconvenience.
>
> Fixes: 278f945402c5 ("pdump: add new library for packet capture")
>
> Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>

[snip]

> diff --git a/lib/librte_eal/common/include/rte_lcore.h b/lib/librte_eal/common/include/rte_lcore.h
> index ac15130..1dcfba7 100644
> --- a/lib/librte_eal/common/include/rte_lcore.h
> +++ b/lib/librte_eal/common/include/rte_lcore.h
> @@ -250,23 +250,16 @@ void rte_thread_get_affinity(rte_cpuset_t *cpusetp);
>  /**
>   * Set thread names.
>   *
> - * Macro to wrap `pthread_setname_np()` with a glibc version check.
> - * Only glibc >= 2.12 supports this feature.
> + * @note Only glibc >= 2.12 supports this feature.

This comment is a bit weird since, this only applies to Linux and not
BSD, right ?

The rest looks good to me.


-- 
David Marchand

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [dpdk-dev] [PATCH v2] eal: fix thread naming on FreeBSD
  2016-06-17 15:56 ` David Marchand
@ 2016-06-17 16:02   ` Thomas Monjalon
  2016-06-17 16:04     ` David Marchand
  0 siblings, 1 reply; 7+ messages in thread
From: Thomas Monjalon @ 2016-06-17 16:02 UTC (permalink / raw)
  To: david.marchand; +Cc: dev

rte_thread_setname was a macro defined only for Linux.
The function rte_thread_setname() can now be used on FreeBSD
as well on Linux.
It is required to build librte_pdump.

The macro was 0 for old glibc. The function is now returning -1.
The related logs are decreased from error to debug level because
it is not an important failure, just a debug inconvenience.

Fixes: 278f945402c5 ("pdump: add new library for packet capture")

Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
---
v2: fix doxygen comment
---
 examples/tep_termination/main.c                    |  2 +-
 examples/vhost/main.c                              |  2 +-
 examples/vhost_xen/main.c                          |  2 +-
 lib/librte_eal/bsdapp/eal/eal.c                    |  2 +-
 lib/librte_eal/bsdapp/eal/eal_thread.c             |  7 +++++++
 lib/librte_eal/bsdapp/eal/rte_eal_version.map      |  1 +
 lib/librte_eal/common/include/rte_lcore.h          | 23 ++++++++--------------
 lib/librte_eal/linuxapp/eal/eal.c                  |  2 +-
 lib/librte_eal/linuxapp/eal/eal_interrupts.c       |  2 +-
 lib/librte_eal/linuxapp/eal/eal_pci_vfio_mp_sync.c |  2 +-
 lib/librte_eal/linuxapp/eal/eal_thread.c           | 11 +++++++++++
 lib/librte_eal/linuxapp/eal/eal_timer.c            |  4 ++--
 lib/librte_eal/linuxapp/eal/rte_eal_version.map    |  1 +
 13 files changed, 37 insertions(+), 24 deletions(-)

diff --git a/examples/tep_termination/main.c b/examples/tep_termination/main.c
index b8297dd..aa67a6b 100644
--- a/examples/tep_termination/main.c
+++ b/examples/tep_termination/main.c
@@ -1246,7 +1246,7 @@ main(int argc, char *argv[])
 		snprintf(thread_name, RTE_MAX_THREAD_NAME_LEN, "print-stats");
 		ret = rte_thread_setname(tid, thread_name);
 		if (ret != 0)
-			RTE_LOG(ERR, VHOST_CONFIG, "Cannot set print-stats name\n");
+			RTE_LOG(DEBUG, VHOST_CONFIG, "Cannot set print-stats name\n");
 	}
 
 	/* Launch all data cores. */
diff --git a/examples/vhost/main.c b/examples/vhost/main.c
index 665886e..f849571 100644
--- a/examples/vhost/main.c
+++ b/examples/vhost/main.c
@@ -1474,7 +1474,7 @@ main(int argc, char *argv[])
 		snprintf(thread_name, RTE_MAX_THREAD_NAME_LEN, "print-stats");
 		ret = rte_thread_setname(tid, thread_name);
 		if (ret != 0)
-			RTE_LOG(ERR, VHOST_CONFIG,
+			RTE_LOG(DEBUG, VHOST_CONFIG,
 				"Cannot set print-stats name\n");
 	}
 
diff --git a/examples/vhost_xen/main.c b/examples/vhost_xen/main.c
index 2b04c95..2e40357 100644
--- a/examples/vhost_xen/main.c
+++ b/examples/vhost_xen/main.c
@@ -1494,7 +1494,7 @@ main(int argc, char *argv[])
 		snprintf(thread_name, RTE_MAX_THREAD_NAME_LEN, "print-xen-stats");
 		ret = rte_thread_setname(tid, thread_name);
 		if (ret != 0)
-			RTE_LOG(ERR, VHOST_CONFIG,
+			RTE_LOG(DEBUG, VHOST_CONFIG,
 				"Cannot set print-stats name\n");
 	}
 
diff --git a/lib/librte_eal/bsdapp/eal/eal.c b/lib/librte_eal/bsdapp/eal/eal.c
index 06bfd4e..a0c8f8c 100644
--- a/lib/librte_eal/bsdapp/eal/eal.c
+++ b/lib/librte_eal/bsdapp/eal/eal.c
@@ -605,7 +605,7 @@ rte_eal_init(int argc, char **argv)
 		/* Set thread_name for aid in debugging. */
 		snprintf(thread_name, RTE_MAX_THREAD_NAME_LEN,
 				"lcore-slave-%d", i);
-		pthread_set_name_np(lcore_config[i].thread_id, thread_name);
+		rte_thread_setname(lcore_config[i].thread_id, thread_name);
 	}
 
 	/*
diff --git a/lib/librte_eal/bsdapp/eal/eal_thread.c b/lib/librte_eal/bsdapp/eal/eal_thread.c
index 9a03437..1b8cd8a 100644
--- a/lib/librte_eal/bsdapp/eal/eal_thread.c
+++ b/lib/librte_eal/bsdapp/eal/eal_thread.c
@@ -199,3 +199,10 @@ int rte_sys_gettid(void)
 	thr_self(&lwpid);
 	return (int)lwpid;
 }
+
+int rte_thread_setname(pthread_t id, const char *name)
+{
+	/* this BSD function returns no error */
+	pthread_set_name_np(id, name);
+	return 0;
+}
diff --git a/lib/librte_eal/bsdapp/eal/rte_eal_version.map b/lib/librte_eal/bsdapp/eal/rte_eal_version.map
index 97d091b..3b4dd3b 100644
--- a/lib/librte_eal/bsdapp/eal/rte_eal_version.map
+++ b/lib/librte_eal/bsdapp/eal/rte_eal_version.map
@@ -157,5 +157,6 @@ DPDK_16.07 {
 
 	pci_get_sysfs_path;
 	rte_keepalive_register_relay_callback;
+	rte_thread_setname;
 
 } DPDK_16.04;
diff --git a/lib/librte_eal/common/include/rte_lcore.h b/lib/librte_eal/common/include/rte_lcore.h
index ac15130..fe7b586 100644
--- a/lib/librte_eal/common/include/rte_lcore.h
+++ b/lib/librte_eal/common/include/rte_lcore.h
@@ -250,23 +250,16 @@ void rte_thread_get_affinity(rte_cpuset_t *cpusetp);
 /**
  * Set thread names.
  *
- * Macro to wrap `pthread_setname_np()` with a glibc version check.
- * Only glibc >= 2.12 supports this feature.
+ * @note It fails with glibc < 2.12.
  *
- * This macro only used for Linux, BSD does direct libc call.
- * BSD libc version of function is `pthread_set_name_np()`.
+ * @param id
+ *   Thread id.
+ * @param name
+ *   Thread name to set.
+ * @return
+ *   On success, return 0; otherwise return a negative value.
  */
-#if defined(__DOXYGEN__)
-#define rte_thread_setname(...) pthread_setname_np(__VA_ARGS__)
-#endif
-
-#if defined(__GLIBC__) && defined(__GLIBC_PREREQ)
-#if __GLIBC_PREREQ(2, 12)
-#define rte_thread_setname(...) pthread_setname_np(__VA_ARGS__)
-#else
-#define rte_thread_setname(...) 0
-#endif
-#endif
+int rte_thread_setname(pthread_t id, const char *name);
 
 #ifdef __cplusplus
 }
diff --git a/lib/librte_eal/linuxapp/eal/eal.c b/lib/librte_eal/linuxapp/eal/eal.c
index bba8fea..4f22c18 100644
--- a/lib/librte_eal/linuxapp/eal/eal.c
+++ b/lib/librte_eal/linuxapp/eal/eal.c
@@ -859,7 +859,7 @@ rte_eal_init(int argc, char **argv)
 		ret = rte_thread_setname(lcore_config[i].thread_id,
 						thread_name);
 		if (ret != 0)
-			RTE_LOG(ERR, EAL,
+			RTE_LOG(DEBUG, EAL,
 				"Cannot set name for lcore thread\n");
 	}
 
diff --git a/lib/librte_eal/linuxapp/eal/eal_interrupts.c b/lib/librte_eal/linuxapp/eal/eal_interrupts.c
index a9af396..47a3b20 100644
--- a/lib/librte_eal/linuxapp/eal/eal_interrupts.c
+++ b/lib/librte_eal/linuxapp/eal/eal_interrupts.c
@@ -887,7 +887,7 @@ rte_eal_intr_init(void)
 			"eal-intr-thread");
 		ret_1 = rte_thread_setname(intr_thread, thread_name);
 		if (ret_1 != 0)
-			RTE_LOG(ERR, EAL,
+			RTE_LOG(DEBUG, EAL,
 			"Failed to set thread name for interrupt handling\n");
 	}
 
diff --git a/lib/librte_eal/linuxapp/eal/eal_pci_vfio_mp_sync.c b/lib/librte_eal/linuxapp/eal/eal_pci_vfio_mp_sync.c
index 26d966e..d54ded8 100644
--- a/lib/librte_eal/linuxapp/eal/eal_pci_vfio_mp_sync.c
+++ b/lib/librte_eal/linuxapp/eal/eal_pci_vfio_mp_sync.c
@@ -399,7 +399,7 @@ pci_vfio_mp_sync_setup(void)
 	snprintf(thread_name, RTE_MAX_THREAD_NAME_LEN, "pci-vfio-sync");
 	ret = rte_thread_setname(socket_thread, thread_name);
 	if (ret)
-		RTE_LOG(ERR, EAL,
+		RTE_LOG(DEBUG, EAL,
 			"Failed to set thread name for secondary processes!\n");
 
 	return 0;
diff --git a/lib/librte_eal/linuxapp/eal/eal_thread.c b/lib/librte_eal/linuxapp/eal/eal_thread.c
index 18bd8e0..8c3bf03 100644
--- a/lib/librte_eal/linuxapp/eal/eal_thread.c
+++ b/lib/librte_eal/linuxapp/eal/eal_thread.c
@@ -197,3 +197,14 @@ int rte_sys_gettid(void)
 {
 	return (int)syscall(SYS_gettid);
 }
+
+int rte_thread_setname(pthread_t id, const char *name)
+{
+	int ret = -1;
+#if defined(__GLIBC__) && defined(__GLIBC_PREREQ)
+#if __GLIBC_PREREQ(2, 12)
+	ret = pthread_setname_np(id, name);
+#endif
+#endif
+	return ret;
+}
diff --git a/lib/librte_eal/linuxapp/eal/eal_timer.c b/lib/librte_eal/linuxapp/eal/eal_timer.c
index f2abb7b..afa32f5 100644
--- a/lib/librte_eal/linuxapp/eal/eal_timer.c
+++ b/lib/librte_eal/linuxapp/eal/eal_timer.c
@@ -222,8 +222,8 @@ rte_eal_hpet_init(int make_default)
 	snprintf(thread_name, RTE_MAX_THREAD_NAME_LEN, "hpet-msb-inc");
 	ret = rte_thread_setname(msb_inc_thread_id, thread_name);
 	if (ret != 0)
-		RTE_LOG(ERR, EAL,
-			"ERROR: Cannot set HPET timer thread name!\n");
+		RTE_LOG(DEBUG, EAL,
+			"Cannot set HPET timer thread name!\n");
 
 	if (make_default)
 		eal_timer_source = EAL_TIMER_HPET;
diff --git a/lib/librte_eal/linuxapp/eal/rte_eal_version.map b/lib/librte_eal/linuxapp/eal/rte_eal_version.map
index 4874c92..7330a46 100644
--- a/lib/librte_eal/linuxapp/eal/rte_eal_version.map
+++ b/lib/librte_eal/linuxapp/eal/rte_eal_version.map
@@ -160,5 +160,6 @@ DPDK_16.07 {
 
 	pci_get_sysfs_path;
 	rte_keepalive_register_relay_callback;
+	rte_thread_setname;
 
 } DPDK_16.04;
-- 
2.7.0

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [dpdk-dev] [PATCH v2] eal: fix thread naming on FreeBSD
  2016-06-17 16:02   ` [dpdk-dev] [PATCH v2] " Thomas Monjalon
@ 2016-06-17 16:04     ` David Marchand
  2016-06-17 16:04       ` Thomas Monjalon
  0 siblings, 1 reply; 7+ messages in thread
From: David Marchand @ 2016-06-17 16:04 UTC (permalink / raw)
  To: Thomas Monjalon; +Cc: dev

On Fri, Jun 17, 2016 at 6:02 PM, Thomas Monjalon
<thomas.monjalon@6wind.com> wrote:
> rte_thread_setname was a macro defined only for Linux.
> The function rte_thread_setname() can now be used on FreeBSD
> as well on Linux.
> It is required to build librte_pdump.
>
> The macro was 0 for old glibc. The function is now returning -1.
> The related logs are decreased from error to debug level because
> it is not an important failure, just a debug inconvenience.
>
> Fixes: 278f945402c5 ("pdump: add new library for packet capture")
>
> Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>

Acked-by: David Marchand <david.marchand@6wind.com>


-- 
David Marchand

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [dpdk-dev] [PATCH v2] eal: fix thread naming on FreeBSD
  2016-06-17 16:04     ` David Marchand
@ 2016-06-17 16:04       ` Thomas Monjalon
  2016-06-19 21:11         ` [dpdk-dev] [PATCH] eal/linux: fix build with glibc < 2.12 Thomas Monjalon
  0 siblings, 1 reply; 7+ messages in thread
From: Thomas Monjalon @ 2016-06-17 16:04 UTC (permalink / raw)
  To: David Marchand; +Cc: dev

2016-06-17 18:04, David Marchand:
> On Fri, Jun 17, 2016 at 6:02 PM, Thomas Monjalon
> <thomas.monjalon@6wind.com> wrote:
> > rte_thread_setname was a macro defined only for Linux.
> > The function rte_thread_setname() can now be used on FreeBSD
> > as well on Linux.
> > It is required to build librte_pdump.
> >
> > The macro was 0 for old glibc. The function is now returning -1.
> > The related logs are decreased from error to debug level because
> > it is not an important failure, just a debug inconvenience.
> >
> > Fixes: 278f945402c5 ("pdump: add new library for packet capture")
> >
> > Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
> 
> Acked-by: David Marchand <david.marchand@6wind.com>

Applied

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [dpdk-dev] [PATCH] eal/linux: fix build with glibc < 2.12
  2016-06-17 16:04       ` Thomas Monjalon
@ 2016-06-19 21:11         ` Thomas Monjalon
  2016-06-20  8:51           ` Thomas Monjalon
  0 siblings, 1 reply; 7+ messages in thread
From: Thomas Monjalon @ 2016-06-19 21:11 UTC (permalink / raw)
  To: david.marchand; +Cc: dev

The function rte_thread_setname needs glibc 2.12,
otherwise it returns -1 without using any parameter.
The macro RTE_SET_USED avoids an "unused parameter" warning.

Fixes: 3901ed99c2f8 ("eal: fix thread naming on FreeBSD")

Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
---
 lib/librte_eal/linuxapp/eal/eal_thread.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/lib/librte_eal/linuxapp/eal/eal_thread.c b/lib/librte_eal/linuxapp/eal/eal_thread.c
index 8c3bf03..9f88530 100644
--- a/lib/librte_eal/linuxapp/eal/eal_thread.c
+++ b/lib/librte_eal/linuxapp/eal/eal_thread.c
@@ -206,5 +206,7 @@ int rte_thread_setname(pthread_t id, const char *name)
 	ret = pthread_setname_np(id, name);
 #endif
 #endif
+	RTE_SET_USED(id);
+	RTE_SET_USED(name);
 	return ret;
 }
-- 
2.7.0

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [dpdk-dev] [PATCH] eal/linux: fix build with glibc < 2.12
  2016-06-19 21:11         ` [dpdk-dev] [PATCH] eal/linux: fix build with glibc < 2.12 Thomas Monjalon
@ 2016-06-20  8:51           ` Thomas Monjalon
  0 siblings, 0 replies; 7+ messages in thread
From: Thomas Monjalon @ 2016-06-20  8:51 UTC (permalink / raw)
  To: dev; +Cc: david.marchand

2016-06-19 23:11, Thomas Monjalon:
> The function rte_thread_setname needs glibc 2.12,
> otherwise it returns -1 without using any parameter.
> The macro RTE_SET_USED avoids an "unused parameter" warning.
> 
> Fixes: 3901ed99c2f8 ("eal: fix thread naming on FreeBSD")
> 
> Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>

Applied

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2016-06-20  8:51 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-17 15:25 [dpdk-dev] [PATCH] eal: fix thread naming on FreeBSD Thomas Monjalon
2016-06-17 15:56 ` David Marchand
2016-06-17 16:02   ` [dpdk-dev] [PATCH v2] " Thomas Monjalon
2016-06-17 16:04     ` David Marchand
2016-06-17 16:04       ` Thomas Monjalon
2016-06-19 21:11         ` [dpdk-dev] [PATCH] eal/linux: fix build with glibc < 2.12 Thomas Monjalon
2016-06-20  8:51           ` Thomas Monjalon

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).