Skip to contentSkip to conversation

add a macro to enable support of backtrace

PATCH In review Wei Dai 3 participants 10 messages Mar 13, 2017 – May 5, 2017

lore
Share & tools
lore

Wei Dai

author
#0 lore raw

v2 cover add a macro to enable support of backtrace

Some LIBC implementation like musl doesn't support backtrace( ) and backtrace_symbols declared in execinfo.h. Currently some DPDK customers fail to build PDDK with musl. In order to build DPDK with musl, there is a need to reomve references toexecinfo.h.

Add a configuration parameter in config/common_linuxapp which equals to y by default. It also generate a macro named as RTE_EAL_ENABLE_BACKTRACE when this configuration paramter equals to y or no above macro when it is n.

---
changes:
v2 -- change configuration parameter name

Wei Dai (3):
examples/performance-thread: remove reference to execinfo.h
config: add a marco to enable backtrace or not
eal: remove references to execinfo.h for musl

 config/common_linuxapp                           | 1 +
 examples/performance-thread/common/lthread_tls.c | 1 -
 lib/librte_eal/linuxapp/eal/eal_debug.c          | 4 ++++
 3 files changed, 5 insertions(+), 1 deletion(-)
Signature · 1 line
2.7.4
author
#1 lore raw

PATCH v2 1/3 examples/performance-thread: remove reference to execinfo.h

There is no function to refer any part of execinfo.h, so remove the reference to it. And there is no this file in musl. So need to remove it to support musl.

The musl is an alternative LIBC to GLIBC and provides the standard C/POSIX library and extensions.
The musl can be got from http://www.musl-libc.org

---
 examples/performance-thread/common/lthread_tls.c | 1 -
 1 file changed, 1 deletion(-)
examples/performance-thread/common/lthread_tls.c +0 -1
index 6876f83..47505f2 100644
@@ -42,7 +42,6 @@
 #include <fcntl.h>
 #include <sys/time.h>
 #include <sys/mman.h>
-#include <execinfo.h>
 #include <sched.h>
 
 #include <rte_malloc.h>
Signature · 1 line
2.7.4
Acked-by on v2 1/3
#2 lore raw

Re: [PATCH v2 1/3] examples/performance-thread: remove reference to execinfo.h

Quoted 26 lines · Wei Dai

There is no function to refer any part of execinfo.h, so remove the reference to it. And there is no this file in musl. So need to remove it to support musl.

The musl is an alternative LIBC to GLIBC and provides the standard C/POSIX library and extensions.
The musl can be got from http://www.musl-libc.org

---
 examples/performance-thread/common/lthread_tls.c | 1 -
 1 file changed, 1 deletion(-)
examples/performance-thread/common/lthread_tls.c +0 -2
index 6876f83..47505f2 100644
@@ -42,7 +42,6 @@
 #include <fcntl.h>
 #include <sys/time.h>
 #include <sys/mman.h>
-#include <execinfo.h>
 #include <sched.h>
 
 #include <rte_malloc.h>
--
Quoted 2 lines

2.7.4

author
#3 lore raw

PATCH v2 2/3 config: add a marco to enable backtrace or not

In reply to Wei Dai

When building DPDK with musl, there is need not to generate the MACRO named RTE_EAL_ENABLE_BACKTRACE in rte_config.h to remove some references to execinfo.h which is not supported by musl now.
This also applies to some other LIBC implementation which doesn't support backtrace( ) and backtrace_symbols( ).

Got more details about musl from http://www.musl-libc.org .

---
 config/common_linuxapp | 1 +
 1 file changed, 1 insertion(+)
config/common_linuxapp +1 -0
index 00ebaac..16e0064 100644
@@ -37,6 +37,7 @@ CONFIG_RTE_EXEC_ENV_LINUXAPP=y
 
 CONFIG_RTE_EAL_IGB_UIO=y
 CONFIG_RTE_EAL_VFIO=y
+CONFIG_RTE_EAL_ENABLE_BACKTRACE=y
 CONFIG_RTE_KNI_KMOD=y
 CONFIG_RTE_LIBRTE_KNI=y
 CONFIG_RTE_LIBRTE_VHOST=y
Signature · 1 line
2.7.4
author
#4 lore raw

PATCH v2 3/3 eal: remove references to execinfo.h for musl

In reply to Wei Dai

execinfo.h is not supported by musl now.
need to remove references to execinfo.h to
build DPDK with musl.

musl is an implementation of the userspace portion of the standard library functionality described in the ISO C and POSIX standards, plus common extensions.

Get more details about musl from
http://www.musl-libc.org

This also aplies to some other LIBC implementation which doesn't support backtrace( ) and backtrace_symbols( ).

---
 lib/librte_eal/linuxapp/eal/eal_debug.c | 4 ++++
 1 file changed, 4 insertions(+)
lib/librte_eal/linuxapp/eal/eal_debug.c +4 -0
index 5fbc17c..3a9aee9 100644
@@ -31,7 +31,9 @@
  *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+#ifdef RTE_EAL_ENABLE_BACKTRACE
 #include <execinfo.h>
+#endif
 #include <stdarg.h>
 #include <signal.h>
 #include <stdlib.h>
@@ -47,6 +49,7 @@
 /* dump the stack of the calling core */
 void rte_dump_stack(void)
 {
+#ifdef RTE_EAL_ENABLE_BACKTRACE
 	void *func[BACKTRACE_SIZE];
 	char **symb = NULL;
 	int size;
@@ -64,6 +67,7 @@ void rte_dump_stack(void)
 	}
 
 	free(symb);
+#endif
 }
 
 /* not implemented in this environment */
Signature · 1 line
2.7.4
author
#5 lore raw
In reply to Wei Dai

Hi, Thomas

I noticed that my following patch set has been superseded.
It address the compile errors when DPDK is built with musl.
I know some customer products like Yocto Linux and that from Roph are using DPDK with musl and
they have to manually change something to build it.
Roph also referenced to use DPDK with musl in his mail titled " [dpdk-dev] Compiling DPDK 17.02 using musl instead of glibc " sent on 2017-03-14

Thanks & Best Regards
-Wei

Quoted 36 lines

-----Original Message-----
From: Dai, Wei
Sent: Monday, March 13, 2017 4:59 PM
To: [email protected]
Cc: [email protected]; Mcnamara, John <[email protected]>; [email protected]; Tan, Raymond <[email protected]>; Dai, Wei <[email protected]>
Subject: [PATCH v2 0/3] add a macro to enable support of backtrace

Some LIBC implementation like musl doesn't support backtrace( ) and backtrace_symbols declared in execinfo.h.
Currently some DPDK customers fail to build PDDK with musl. In order to build DPDK with musl, there is a need to reomve references toexecinfo.h.

Add a configuration parameter in config/common_linuxapp which equals to y by default. It also generate a macro named as RTE_EAL_ENABLE_BACKTRACE when this configuration paramter equals to y or no above macro when it is n.

---
changes:
v2 -- change configuration parameter name

Wei Dai (3):
examples/performance-thread: remove reference to execinfo.h
config: add a marco to enable backtrace or not
eal: remove references to execinfo.h for musl

 config/common_linuxapp                           | 1 +
 examples/performance-thread/common/lthread_tls.c | 1 -
 lib/librte_eal/linuxapp/eal/eal_debug.c          | 4 ++++
 3 files changed, 5 insertions(+), 1 deletion(-)

--
2.7.4

#6 lore raw

v3 cover add a macro to disable support of backtrace

In reply to Wei Dai

Some LIBC implementation like musl doesn't support backtrace() and backtrace_symbols() declared in execinfo.h. Currently some DPDK customers fail to build DPDK with musl. In order to build DPDK with musl, there is a need to remove references to execinfo.h.

Add a configuration parameter which defaults to y.

v3:
- rename option
- apply to BSD
- squash patches

Wei Dai (2):
examples/performance-thread: remove useless include
config: make backtrace optional

 config/common_base                               | 1 +
 examples/performance-thread/common/lthread_tls.c | 1 -
 lib/librte_eal/bsdapp/eal/eal_debug.c            | 4 ++++
 lib/librte_eal/linuxapp/eal/eal_debug.c          | 4 ++++
 4 files changed, 9 insertions(+), 1 deletion(-)
Signature · 1 line
2.12.2
#7 lore raw

PATCH v3 1/2 examples/performance-thread: remove useless include

From: Wei Dai <[email protected]>

There is no function to refer any part of execinfo.h, so remove the reference to it.
And there is no this file in musl. So need to remove it to support musl.

---
 examples/performance-thread/common/lthread_tls.c | 1 -
 1 file changed, 1 deletion(-)
examples/performance-thread/common/lthread_tls.c +0 -1
index 6876f831b..47505f2d4 100644
@@ -42,7 +42,6 @@
 #include <fcntl.h>
 #include <sys/time.h>
 #include <sys/mman.h>
-#include <execinfo.h>
 #include <sched.h>
 
 #include <rte_malloc.h>
Signature · 1 line
2.12.2
#8 lore raw

PATCH v3 2/2 config: make backtrace optional

In reply to Thomas Monjalon

From: Wei Dai <[email protected]>

When building DPDK with musl, there is need not to disable backtrace to remove some references to execinfo.h which is not supported by musl now.
This also applies to some other libc implementation which doesn't support backtrace() and backtrace_symbols().

musl is an implementation of the userspace portion of the standard library functionality described in the ISO C and POSIX standards, plus common extensions. Got more details about musl from http://www.musl-libc.org .

---
 config/common_base                      | 1 +
 lib/librte_eal/bsdapp/eal/eal_debug.c   | 4 ++++
 lib/librte_eal/linuxapp/eal/eal_debug.c | 4 ++++
 3 files changed, 9 insertions(+)
config/common_base +1 -0
index 93e923507..8907bea36 100644
@@ -96,6 +96,7 @@ CONFIG_RTE_MAX_TAILQ=32
 CONFIG_RTE_LOG_LEVEL=RTE_LOG_INFO
 CONFIG_RTE_LOG_DP_LEVEL=RTE_LOG_INFO
 CONFIG_RTE_LOG_HISTORY=256
+CONFIG_RTE_BACKTRACE=y
 CONFIG_RTE_LIBEAL_USE_HPET=n
 CONFIG_RTE_EAL_ALLOW_INV_SOCKET_ID=n
 CONFIG_RTE_EAL_ALWAYS_PANIC_ON_ERROR=n
lib/librte_eal/bsdapp/eal/eal_debug.c +4 -0
index 5fbc17c59..e1c755482 100644
@@ -31,7 +31,9 @@
  *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+#ifdef RTE_BACKTRACE
 #include <execinfo.h>
+#endif
 #include <stdarg.h>
 #include <signal.h>
 #include <stdlib.h>
@@ -47,6 +49,7 @@
 /* dump the stack of the calling core */
 void rte_dump_stack(void)
 {
+#ifdef RTE_BACKTRACE
 	void *func[BACKTRACE_SIZE];
 	char **symb = NULL;
 	int size;
@@ -64,6 +67,7 @@ void rte_dump_stack(void)
 	}
 
 	free(symb);
+#endif /* RTE_BACKTRACE */
 }
 
 /* not implemented in this environment */
lib/librte_eal/linuxapp/eal/eal_debug.c +4 -0
index 5fbc17c59..e1c755482 100644
@@ -31,7 +31,9 @@
  *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+#ifdef RTE_BACKTRACE
 #include <execinfo.h>
+#endif
 #include <stdarg.h>
 #include <signal.h>
 #include <stdlib.h>
@@ -47,6 +49,7 @@
 /* dump the stack of the calling core */
 void rte_dump_stack(void)
 {
+#ifdef RTE_BACKTRACE
 	void *func[BACKTRACE_SIZE];
 	char **symb = NULL;
 	int size;
@@ -64,6 +67,7 @@ void rte_dump_stack(void)
 	}
 
 	free(symb);
+#endif /* RTE_BACKTRACE */
 }
 
 /* not implemented in this environment */
Signature · 1 line
2.12.2
#9 lore raw

Re: [PATCH v3 0/2] add a macro to disable support of backtrace

In reply to Thomas Monjalon

05/05/2017 15:18, Thomas Monjalon:

Quoted 8 lines

Some LIBC implementation like musl doesn't support backtrace() and backtrace_symbols() declared in execinfo.h. Currently some DPDK customers fail to build DPDK with musl. In order to build DPDK with musl, there is a need to remove references to execinfo.h.

Add a configuration parameter which defaults to y.

Quoted 8 lines

v3:
- rename option
- apply to BSD
- squash patches

Wei Dai (2):
examples/performance-thread: remove useless include
config: make backtrace optional

I prefer this version ;)

Applied, thanks