Skip to contentSkip to conversation

Move EAL common functions

PATCH Superseded Ravi Kerur 2 participants 10 messages Dec 27, 2014 – Dec 29, 2014 4 messages not in the archive

v2 of 8 Superseded Latest is v8 →

lore
Share & tools
lore

Ravi Kerur

author
#0 lore raw

v2 cover Move EAL common functions

Fix Neil's patch review comments.

Common functions in linuxapp and bsdapp are moved into librte_eal/common directory.
New files added follow _common_ naming conventions.

Following checkpatch warnings are treated as false-positive.
1. WARNING: quoted string split across lines

Tested against ubuntu and FreeBSD.

Ravi Kerur (6):
Move EAL common functions
Move EAL common functions
Move EAL common functions
Move EAL common functions
Move EAL common functions
Move EAL common functions

 app/test/test_debug.c                     |   1 -
 lib/librte_eal/bsdapp/eal/Makefile        |  11 +-
 lib/librte_eal/bsdapp/eal/eal.c           | 233 +--------------------
 lib/librte_eal/bsdapp/eal/eal_debug.c     | 113 -----------
 lib/librte_eal/bsdapp/eal/eal_lcore.c     |  62 ++----
 lib/librte_eal/bsdapp/eal/eal_memory.c    |  40 +---
 lib/librte_eal/bsdapp/eal/eal_thread.c    | 233 ---------------------
 lib/librte_eal/bsdapp/eal/eal_timer.c     |  50 +----
 lib/librte_eal/common/eal_common.c        | 326 ++++++++++++++++++++++++++++++
 lib/librte_eal/common/eal_common_debug.c  | 106 ++++++++++
 lib/librte_eal/common/eal_common_lcore.c  | 106 ++++++++++
 lib/librte_eal/common/eal_common_memory.c |  38 +++-
 lib/librte_eal/common/eal_common_thread.c | 248 +++++++++++++++++++++++
 lib/librte_eal/common/eal_common_timer.c  |  95 +++++++++
 lib/librte_eal/common/eal_externs.h       |  45 +++++
 lib/librte_eal/common/eal_hugepages.h     |   1 +
 lib/librte_eal/common/eal_private.h       | 112 ++++++++++
 lib/librte_eal/common/include/rte_debug.h |   7 -
 lib/librte_eal/linuxapp/eal/Makefile      |  11 +-
 lib/librte_eal/linuxapp/eal/eal.c         | 246 +---------------------
 lib/librte_eal/linuxapp/eal/eal_debug.c   | 113 -----------
 lib/librte_eal/linuxapp/eal/eal_lcore.c   |  55 +----
 lib/librte_eal/linuxapp/eal/eal_memory.c  |  36 +---
 lib/librte_eal/linuxapp/eal/eal_thread.c  | 233 ---------------------
 lib/librte_eal/linuxapp/eal/eal_timer.c   |  54 +----
 25 files changed, 1134 insertions(+), 1441 deletions(-)
 delete mode 100644 lib/librte_eal/bsdapp/eal/eal_debug.c
 delete mode 100644 lib/librte_eal/bsdapp/eal/eal_thread.c
 create mode 100644 lib/librte_eal/common/eal_common.c
 create mode 100644 lib/librte_eal/common/eal_common_debug.c
 create mode 100644 lib/librte_eal/common/eal_common_lcore.c
 create mode 100644 lib/librte_eal/common/eal_common_thread.c
 create mode 100644 lib/librte_eal/common/eal_common_timer.c
 create mode 100644 lib/librte_eal/common/eal_externs.h
 delete mode 100644 lib/librte_eal/linuxapp/eal/eal_debug.c
 delete mode 100644 lib/librte_eal/linuxapp/eal/eal_thread.c
Signature · 1 line
1.9.1
author
#2 lore raw

PATCH v2 1/6 Move EAL common functions

In reply to a message not in the archive

Changes in v2
1. Remove rte_dump_registers() function since it is not implemented.
2. Fix comment for _rte_exit()

eal_debug.c has no difference between Linux and BSD, move into common directory.
Rename eal_debug.c to eal_common_debug.c Makefile changes to reflect file move and name change. Fix checkpatch warnings.

---
 app/test/test_debug.c                     |   1 -
 lib/librte_eal/bsdapp/eal/Makefile        |   2 +-
 lib/librte_eal/bsdapp/eal/eal_debug.c     | 113 ------------------------------
 lib/librte_eal/common/eal_common_debug.c  | 106 ++++++++++++++++++++++++++++
 lib/librte_eal/common/include/rte_debug.h |   7 --
 lib/librte_eal/linuxapp/eal/Makefile      |   2 +-
 lib/librte_eal/linuxapp/eal/eal_debug.c   | 113 ------------------------------
 7 files changed, 108 insertions(+), 236 deletions(-)
 delete mode 100644 lib/librte_eal/bsdapp/eal/eal_debug.c
 create mode 100644 lib/librte_eal/common/eal_common_debug.c
 delete mode 100644 lib/librte_eal/linuxapp/eal/eal_debug.c
app/test/test_debug.c +0 -1
index 7c3ee92..01d4b76 100644
@@ -136,7 +136,6 @@ static int
 test_debug(void)
 {
 	rte_dump_stack();
-	rte_dump_registers();
 	if (test_panic() < 0)
 		return -1;
 	if (test_exit() < 0)
lib/librte_eal/bsdapp/eal/Makefile +1 -1
index d434882..9b83e11 100644
@@ -53,7 +53,6 @@ SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_hugepage_info.c
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_thread.c
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_log.c
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_pci.c
-SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_debug.c
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_lcore.c
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_timer.c
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_interrupts.c
@@ -73,6 +72,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_common_hexdump.c
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_common_devargs.c
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_common_dev.c
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_common_options.c
+SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_common_debug.c
 
 CFLAGS_eal.o := -D_GNU_SOURCE
 #CFLAGS_eal_thread.o := -D_GNU_SOURCE
lib/librte_eal/bsdapp/eal/eal_debug.c deleted +0 -113

113 lines not on this page · raw message

lib/librte_eal/common/eal_common_debug.c new file +106 -0

106 lines not on this page · raw message

lib/librte_eal/common/include/rte_debug.h +0 -7
index 82ee3b3..3fb0307 100644
@@ -53,13 +53,6 @@ extern "C" {
 void rte_dump_stack(void);
 
 /**
- * Dump the registers of the calling core to the console.
- *
- * Note: Not implemented in a userapp environment; use gdb instead.
- */
-void rte_dump_registers(void);
-
-/**
  * Provide notification of a critical non-recoverable error and terminate
  * execution abnormally.
  *
lib/librte_eal/linuxapp/eal/Makefile +1 -1
index 72ecf3a..87b9bfc 100644
@@ -62,7 +62,6 @@ SRCS-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP) += eal_pci.c
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP) += eal_pci_uio.c
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP) += eal_pci_vfio.c
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP) += eal_pci_vfio_mp_sync.c
-SRCS-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP) += eal_debug.c
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP) += eal_lcore.c
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP) += eal_timer.c
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP) += eal_interrupts.c
@@ -85,6 +84,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP) += eal_common_hexdump.c
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP) += eal_common_devargs.c
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP) += eal_common_dev.c
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP) += eal_common_options.c
+SRCS-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP) += eal_common_debug.c
 
 CFLAGS_eal.o := -D_GNU_SOURCE
 CFLAGS_eal_thread.o := -D_GNU_SOURCE
lib/librte_eal/linuxapp/eal/eal_debug.c deleted +0 -113

113 lines not on this page · raw message

Signature · 1 line
1.9.1
author
#4 lore raw

PATCH v2 2/6 Move EAL common functions

In reply to a message not in the archive

Changes in v2
None

eal_thread.c has minor difference between Linux and BSD, move into common directory.
Use RTE_EXEC_ENV_BSDAPP to differentiate minor difference. Rename eal_thread.c to eal_common_thread.c
Makefile changes to reflect file move and name change. Fix checkpatch warnings.

---
 lib/librte_eal/bsdapp/eal/Makefile        |   6 +-
 lib/librte_eal/bsdapp/eal/eal_thread.c    | 233 ----------------------------
 lib/librte_eal/common/eal_common_thread.c | 248 ++++++++++++++++++++++++++++++
 lib/librte_eal/linuxapp/eal/Makefile      |   6 +-
 lib/librte_eal/linuxapp/eal/eal_thread.c  | 233 ----------------------------
 5 files changed, 254 insertions(+), 472 deletions(-)
 delete mode 100644 lib/librte_eal/bsdapp/eal/eal_thread.c
 create mode 100644 lib/librte_eal/common/eal_common_thread.c
 delete mode 100644 lib/librte_eal/linuxapp/eal/eal_thread.c
lib/librte_eal/bsdapp/eal/Makefile +3 -3
index 9b83e11..92dd9a6 100644
@@ -50,7 +50,6 @@ CFLAGS += $(WERROR_FLAGS) -O3
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) := eal.c
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_memory.c
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_hugepage_info.c
-SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_thread.c
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_log.c
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_pci.c
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_lcore.c
@@ -73,16 +72,17 @@ SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_common_devargs.c
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_common_dev.c
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_common_options.c
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_common_debug.c
+SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_common_thread.c
 
 CFLAGS_eal.o := -D_GNU_SOURCE
-#CFLAGS_eal_thread.o := -D_GNU_SOURCE
+#CFLAGS_eal_common_thread.o := -D_GNU_SOURCE
 CFLAGS_eal_log.o := -D_GNU_SOURCE
 CFLAGS_eal_common_log.o := -D_GNU_SOURCE
 
 # workaround for a gcc bug with noreturn attribute
 # http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12603
 ifeq ($(CONFIG_RTE_TOOLCHAIN_GCC),y)
-CFLAGS_eal_thread.o += -Wno-return-type
+CFLAGS_eal_common_thread.o += -Wno-return-type
 CFLAGS_eal_hpet.o += -Wno-return-type
 endif
 
lib/librte_eal/bsdapp/eal/eal_thread.c deleted +0 -233

233 lines not on this page · raw message

lib/librte_eal/common/eal_common_thread.c new file +248 -0

248 lines not on this page · raw message

lib/librte_eal/linuxapp/eal/Makefile +3 -3
index 87b9bfc..9252333 100644
@@ -56,7 +56,6 @@ SRCS-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP) += eal_memory.c
 ifeq ($(CONFIG_RTE_LIBRTE_XEN_DOM0),y)
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP) += eal_xen_memory.c
 endif
-SRCS-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP) += eal_thread.c
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP) += eal_log.c
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP) += eal_pci.c
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP) += eal_pci_uio.c
@@ -85,9 +84,10 @@ SRCS-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP) += eal_common_devargs.c
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP) += eal_common_dev.c
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP) += eal_common_options.c
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP) += eal_common_debug.c
+SRCS-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP) += eal_common_thread.c
 
 CFLAGS_eal.o := -D_GNU_SOURCE
-CFLAGS_eal_thread.o := -D_GNU_SOURCE
+CFLAGS_eal_common_thread.o := -D_GNU_SOURCE
 CFLAGS_eal_log.o := -D_GNU_SOURCE
 CFLAGS_eal_common_log.o := -D_GNU_SOURCE
 CFLAGS_eal_hugepage_info.o := -D_GNU_SOURCE
@@ -98,7 +98,7 @@ CFLAGS_eal_common_whitelist.o := -D_GNU_SOURCE
 # workaround for a gcc bug with noreturn attribute
 # http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12603
 ifeq ($(CONFIG_RTE_TOOLCHAIN_GCC),y)
-CFLAGS_eal_thread.o += -Wno-return-type
+CFLAGS_eal_common_thread.o += -Wno-return-type
 endif
 
 INC := rte_interrupts.h rte_kni_common.h rte_dom0_common.h
lib/librte_eal/linuxapp/eal/eal_thread.c deleted +0 -233

233 lines not on this page · raw message

Signature · 1 line
1.9.1
author
#5 lore raw

PATCH v2 3/6 Move EAL common functions

In reply to a message not in the archive

Changes in v2
1. In function rte_eal_config_create remove #ifdef _BSDAPP_ and initialize mem_cfg_addr unconditionally.

Move common functions in eal.c to librte_eal/common directory. Makefile changes to reflect new file added.
Fix checkpatch warnings and errors.

---
 lib/librte_eal/bsdapp/eal/Makefile    |   1 +
 lib/librte_eal/bsdapp/eal/eal.c       | 233 +-----------------------
 lib/librte_eal/common/eal_common.c    | 326 ++++++++++++++++++++++++++++++++++
 lib/librte_eal/common/eal_externs.h   |  42 +++++
 lib/librte_eal/common/eal_hugepages.h |   1 +
 lib/librte_eal/common/eal_private.h   |  47 +++++
 lib/librte_eal/linuxapp/eal/Makefile  |   1 +
 lib/librte_eal/linuxapp/eal/eal.c     | 246 ++-----------------------
 8 files changed, 437 insertions(+), 460 deletions(-)
 create mode 100644 lib/librte_eal/common/eal_common.c
 create mode 100644 lib/librte_eal/common/eal_externs.h
lib/librte_eal/bsdapp/eal/Makefile +1 -0
index 92dd9a6..050d70b 100644
@@ -58,6 +58,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_interrupts.c
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_alarm.c
 
 # from common dir
+SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_common.c
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_common_memzone.c
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_common_log.c
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_common_launch.c
lib/librte_eal/bsdapp/eal/eal.c +9 -224

281 lines not on this page · raw message

lib/librte_eal/common/eal_common.c new file +326 -0

326 lines not on this page · raw message

lib/librte_eal/common/eal_externs.h new file +42 -0

42 lines not on this page · raw message

lib/librte_eal/common/eal_hugepages.h +1 -0
index 38edac0..0b4d7a2 100644
@@ -63,5 +63,6 @@ struct hugepage_file {
  * for the EAL to use
  */
 int eal_hugepage_info_init(void);
+inline size_t eal_get_hugepage_mem_size(void);
 
 #endif /* EAL_HUGEPAGES_H */
lib/librte_eal/common/eal_private.h +47 -0

51 lines not on this page · raw message

lib/librte_eal/linuxapp/eal/Makefile +1 -0
index 9252333..60cc448 100644
@@ -70,6 +70,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP) += eal_ivshmem.c
 endif
 
 # from common dir
+SRCS-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP) += eal_common.c
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP) += eal_common_memzone.c
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP) += eal_common_log.c
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP) += eal_common_launch.c
lib/librte_eal/linuxapp/eal/eal.c +10 -236

318 lines not on this page · raw message

Signature · 1 line
1.9.1
author
#6 lore raw

PATCH v2 4/6 Move EAL common functions

In reply to a message not in the archive

Changes in v2
None

Move common functions in eal_lcore.c to librte_eal/common directory.
Use RTE_EXEC_ENV_BSDAPP to differentiate minor differences in common functions.
Makefile changes to reflect new file added.
Fix checkpatch warnings and errors.

---
 lib/librte_eal/bsdapp/eal/Makefile       |   1 +
 lib/librte_eal/bsdapp/eal/eal_lcore.c    |  62 ++++--------------
 lib/librte_eal/common/eal_common_lcore.c | 106 +++++++++++++++++++++++++++++++
 lib/librte_eal/common/eal_private.h      |  32 ++++++++++
 lib/librte_eal/linuxapp/eal/Makefile     |   1 +
 lib/librte_eal/linuxapp/eal/eal_lcore.c  |  55 +---------------
 6 files changed, 155 insertions(+), 102 deletions(-)
 create mode 100644 lib/librte_eal/common/eal_common_lcore.c
lib/librte_eal/bsdapp/eal/Makefile +1 -0
index 050d70b..560b7a3 100644
@@ -74,6 +74,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_common_dev.c
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_common_options.c
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_common_debug.c
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_common_thread.c
+SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_common_lcore.c
 
 CFLAGS_eal.o := -D_GNU_SOURCE
 #CFLAGS_eal_common_thread.o := -D_GNU_SOURCE
lib/librte_eal/bsdapp/eal/eal_lcore.c +12 -50

72 lines not on this page · raw message

lib/librte_eal/common/eal_common_lcore.c new file +106 -0

106 lines not on this page · raw message

lib/librte_eal/common/eal_private.h +32 -0
index b1d68bc..9fe91b3 100644
@@ -250,4 +250,36 @@ void rte_eal_config_attach(void);
  */
 void rte_eal_config_reattach(void);
 
+/**
+ * This function gets cpu socket_id
+ *
+ * This function is private to the EAL.
+ */
+unsigned cpu_socket_id(unsigned lcore_id);
+
+/**
+ * This function gets cpu core_id
+ *
+ * This function is private to the EAL.
+ */
+unsigned cpu_core_id(unsigned lcore_id);
+
+#ifdef RTE_EXEC_ENV_BSDAPP
+/**
+ * This function gets no. of cpus
+ *
+ * This function is private to the EAL.
+ */
+int get_ncpus(void);
+
+#else /* RTE_EXEC_ENV_BSDAPP */
+/**
+ * This function check if cpu is present
+ *
+ * This function is private to the EAL.
+ */
+int cpu_detected(unsigned lcore_id);
+
+#endif /* RTE_EXEC_ENV_BSDAPP */
+
 #endif /* _EAL_PRIVATE_H_ */
lib/librte_eal/linuxapp/eal/Makefile +1 -0
index 60cc448..ff185fd 100644
@@ -86,6 +86,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP) += eal_common_dev.c
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP) += eal_common_options.c
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP) += eal_common_debug.c
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP) += eal_common_thread.c
+SRCS-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP) += eal_common_lcore.c
 
 CFLAGS_eal.o := -D_GNU_SOURCE
 CFLAGS_eal_common_thread.o := -D_GNU_SOURCE
lib/librte_eal/linuxapp/eal/eal_lcore.c +3 -52

76 lines not on this page · raw message

Signature · 1 line
1.9.1
author
#7 lore raw

PATCH v2 5/6 Move EAL common functions

In reply to a message not in the archive

Changes in v2
1. Use common function name set_tsc_freq_from_sysctl for BSD and Linux. Update comments about its actuality in function declaration.

Move common functions in eal_timer.c to librte_eal/common directory.
Makefile changes to reflect new file added.
Fix checkpatch warnings and errors.

---
 lib/librte_eal/bsdapp/eal/Makefile       |  1 +
 lib/librte_eal/bsdapp/eal/eal_timer.c    | 50 +----------------
 lib/librte_eal/common/eal_common_timer.c | 95 ++++++++++++++++++++++++++++++++
 lib/librte_eal/common/eal_externs.h      |  3 +
 lib/librte_eal/common/eal_private.h      | 15 +++++
 lib/librte_eal/linuxapp/eal/Makefile     |  1 +
 lib/librte_eal/linuxapp/eal/eal_timer.c  | 54 +-----------------
 7 files changed, 120 insertions(+), 99 deletions(-)
 create mode 100644 lib/librte_eal/common/eal_common_timer.c
lib/librte_eal/bsdapp/eal/Makefile +1 -0
index 560b7a3..fb1faa3 100644
@@ -75,6 +75,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_common_options.c
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_common_debug.c
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_common_thread.c
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_common_lcore.c
+SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_common_timer.c
 
 CFLAGS_eal.o := -D_GNU_SOURCE
 #CFLAGS_eal_common_thread.o := -D_GNU_SOURCE
lib/librte_eal/bsdapp/eal/eal_timer.c +2 -48

68 lines not on this page · raw message

lib/librte_eal/common/eal_common_timer.c new file +95 -0

95 lines not on this page · raw message

lib/librte_eal/common/eal_externs.h +3 -0
index b19bea6..124ab65 100644
@@ -39,4 +39,7 @@ extern struct rte_config rte_config;
 extern int mem_cfg_fd;
 extern rte_usage_hook_t	rte_application_usage_hook;
 
+/* Extern declarations defined in eal_common_timer.c */
+extern uint64_t eal_tsc_resolution_hz;
+
 #endif
lib/librte_eal/common/eal_private.h +15 -0
index 9fe91b3..98a08f0 100644
@@ -264,6 +264,21 @@ unsigned cpu_socket_id(unsigned lcore_id);
  */
 unsigned cpu_core_id(unsigned lcore_id);
 
+/**
+ * This function measures TSC frequency
+ *
+ * This function is private to the EAL.
+ */
+void set_tsc_freq(void);
+
+/**
+ * This function sets TSC frequency from sysctl
+ * for BSD and from clock for Linux.
+ *
+ * This function is private to the EAL.
+ */
+int set_tsc_freq_from_sysctl(void);
+
 #ifdef RTE_EXEC_ENV_BSDAPP
 /**
  * This function gets no. of cpus
lib/librte_eal/linuxapp/eal/Makefile +1 -0
index ff185fd..2404423 100644
@@ -87,6 +87,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP) += eal_common_options.c
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP) += eal_common_debug.c
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP) += eal_common_thread.c
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP) += eal_common_lcore.c
+SRCS-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP) += eal_common_timer.c
 
 CFLAGS_eal.o := -D_GNU_SOURCE
 CFLAGS_eal_common_thread.o := -D_GNU_SOURCE
lib/librte_eal/linuxapp/eal/eal_timer.c +3 -51

81 lines not on this page · raw message

Signature · 1 line
1.9.1
author
#8 lore raw

PATCH v2 6/6 Move EAL common functions

In reply to a message not in the archive

Changes in v2
1. Use common function names rte_eal_hugepage_init and rte_eal_hugepage_attach for BSD and Linux.
Update comments about its actuality in function declaration.

Move common functions in eal_memory.c to librte_eal/common directory.
Fix checkpatch warnings and errors.

---
 lib/librte_eal/bsdapp/eal/eal_memory.c    | 40 ++++---------------------------
 lib/librte_eal/common/eal_common_memory.c | 38 +++++++++++++++++++++++++++--
 lib/librte_eal/common/eal_private.h       | 18 ++++++++++++++
 lib/librte_eal/linuxapp/eal/eal_memory.c  | 36 ++--------------------------
 4 files changed, 60 insertions(+), 72 deletions(-)
lib/librte_eal/bsdapp/eal/eal_memory.c +4 -36
index 65ee87d..0b62d6d 100644
@@ -59,8 +59,8 @@ rte_mem_virt2phy(const void *virtaddr)
 	return RTE_BAD_PHYS_ADDR;
 }
 
-static int
-rte_eal_contigmem_init(void)
+int
+rte_eal_hugepage_init(void)
 {
 	struct rte_mem_config *mcfg;
 	uint64_t total_mem = 0;
@@ -130,8 +130,8 @@ rte_eal_contigmem_init(void)
 	return 0;
 }
 
-static int
-rte_eal_contigmem_attach(void)
+int
+rte_eal_hugepage_attach(void)
 {
 	const struct hugepage_info *hpi;
 	int fd_hugepage_info, fd_hugepage = -1;
@@ -190,35 +190,3 @@ error:
 	return -1;
 }
 
-
-static int
-rte_eal_memdevice_init(void)
-{
-	struct rte_config *config;
-
-	if (rte_eal_process_type() == RTE_PROC_SECONDARY)
-		return 0;
-
-	config = rte_eal_get_configuration();
-	config->mem_config->nchannel = internal_config.force_nchannel;
-	config->mem_config->nrank = internal_config.force_nrank;
-
-	return 0;
-}
-
-/* init memory subsystem */
-int
-rte_eal_memory_init(void)
-{
-	RTE_LOG(INFO, EAL, "Setting up physically contiguous memory...\n");
-	const int retval = rte_eal_process_type() == RTE_PROC_PRIMARY ?
-			rte_eal_contigmem_init() :
-			rte_eal_contigmem_attach();
-	if (retval < 0)
-		return -1;
-
-	if (internal_config.no_shconf == 0 && rte_eal_memdevice_init() < 0)
-		return -1;
-
-	return 0;
-}
lib/librte_eal/common/eal_common_memory.c +36 -2
index 77830f8..cb27930 100644
@@ -46,6 +46,7 @@
 #include <rte_log.h>
 
 #include "eal_private.h"
+#include "eal_internal_cfg.h"
 
 /*
  * Return a pointer to a read-only table of struct rte_physmem_desc
@@ -70,7 +71,7 @@ rte_eal_get_physmem_size(void)
 	/* get pointer to global configuration */
 	mcfg = rte_eal_get_configuration()->mem_config;
 
-	for (i=0; i<RTE_MAX_MEMSEG; i++) {
+	for (i = 0; i < RTE_MAX_MEMSEG; i++) {
 		if (mcfg->memseg[i].addr == NULL)
 			break;
 
@@ -90,7 +91,7 @@ rte_dump_physmem_layout(FILE *f)
 	/* get pointer to global configuration */
 	mcfg = rte_eal_get_configuration()->mem_config;
 
-	for (i=0; i<RTE_MAX_MEMSEG; i++) {
+	for (i = 0; i < RTE_MAX_MEMSEG; i++) {
 		if (mcfg->memseg[i].addr == NULL)
 			break;
 
@@ -119,3 +120,36 @@ unsigned rte_memory_get_nrank(void)
 {
 	return rte_eal_get_configuration()->mem_config->nrank;
 }
+
+static int
+rte_eal_memdevice_init(void)
+{
+	struct rte_config *config;
+
+	if (rte_eal_process_type() == RTE_PROC_SECONDARY)
+		return 0;
+
+	config = rte_eal_get_configuration();
+	config->mem_config->nchannel = internal_config.force_nchannel;
+	config->mem_config->nrank = internal_config.force_nrank;
+
+	return 0;
+}
+
+/* init memory subsystem */
+int
+rte_eal_memory_init(void)
+{
+	RTE_LOG(INFO, EAL, "Setting up physically contiguous memory...\n");
+	const int retval = rte_eal_process_type() == RTE_PROC_PRIMARY ?
+			rte_eal_hugepage_init() :
+			rte_eal_hugepage_attach();
+
+	if (retval < 0)
+		return -1;
+
+	if (internal_config.no_shconf == 0 && rte_eal_memdevice_init() < 0)
+		return -1;
+
+	return 0;
+}
lib/librte_eal/common/eal_private.h +18 -0
index 98a08f0..82a724d 100644
@@ -279,6 +279,24 @@ void set_tsc_freq(void);
  */
 int set_tsc_freq_from_sysctl(void);
 
+/**
+ * This function prepares physical memory mapping
+ * i.e. hugepages on Linux and
+ *      contigmem on BSD.
+ *
+ * This function is private to the EAL.
+ */
+int rte_eal_hugepage_init(void);
+
+/**
+ * This function creates memory mapping in secondary
+ * i.e. hugepages on Linux and
+ *      contigmem on BSD.
+ *
+ * This function is private to the EAL.
+ */
+int rte_eal_hugepage_attach(void);
+
 #ifdef RTE_EXEC_ENV_BSDAPP
 /**
  * This function gets no. of cpus
lib/librte_eal/linuxapp/eal/eal_memory.c +2 -34
index bae2507..f4d91df 100644
@@ -1031,7 +1031,7 @@ calc_num_pages_per_socket(uint64_t * memory,
  *  6. unmap the first mapping
  *  7. fill memsegs in configuration with contiguous zones
  */
-static int
+int
 rte_eal_hugepage_init(void)
 {
 	struct rte_mem_config *mcfg;
@@ -1369,7 +1369,7 @@ getFileSize(int fd)
  * configuration and finds the hugepages which form that segment, mapping them
  * in order to form a contiguous block in the virtual memory space
  */
-static int
+int
 rte_eal_hugepage_attach(void)
 {
 	const struct rte_mem_config *mcfg = rte_eal_get_configuration()->mem_config;
@@ -1530,35 +1530,3 @@ error:
 	return -1;
 }
 
-static int
-rte_eal_memdevice_init(void)
-{
-	struct rte_config *config;
-
-	if (rte_eal_process_type() == RTE_PROC_SECONDARY)
-		return 0;
-
-	config = rte_eal_get_configuration();
-	config->mem_config->nchannel = internal_config.force_nchannel;
-	config->mem_config->nrank = internal_config.force_nrank;
-
-	return 0;
-}
-
-
-/* init memory subsystem */
-int
-rte_eal_memory_init(void)
-{
-	RTE_LOG(INFO, EAL, "Setting up memory...\n");
-	const int retval = rte_eal_process_type() == RTE_PROC_PRIMARY ?
-			rte_eal_hugepage_init() :
-			rte_eal_hugepage_attach();
-	if (retval < 0)
-		return -1;
-
-	if (internal_config.no_shconf == 0 && rte_eal_memdevice_init() < 0)
-		return -1;
-
-	return 0;
-}
Signature · 1 line
1.9.1
#9 lore raw
In reply to a message not in the archive
Quoted 11 lines · Ravi Kerur

Changes in v2
1. Remove rte_dump_registers() function since it is not implemented.
2. Fix comment for _rte_exit()

eal_debug.c has no difference between Linux and BSD, move into common directory.
Rename eal_debug.c to eal_common_debug.c Makefile changes to reflect file move and name change. Fix checkpatch warnings.

The subject matter for all of the patches in the series should be more detailed. Just posting move EAL components to common directly isn't overly informative Neil

Quoted 437 lines
---
 app/test/test_debug.c                     |   1 -
 lib/librte_eal/bsdapp/eal/Makefile        |   2 +-
 lib/librte_eal/bsdapp/eal/eal_debug.c     | 113 ------------------------------
 lib/librte_eal/common/eal_common_debug.c  | 106 ++++++++++++++++++++++++++++
 lib/librte_eal/common/include/rte_debug.h |   7 --
 lib/librte_eal/linuxapp/eal/Makefile      |   2 +-
 lib/librte_eal/linuxapp/eal/eal_debug.c   | 113 ------------------------------
 7 files changed, 108 insertions(+), 236 deletions(-)
 delete mode 100644 lib/librte_eal/bsdapp/eal/eal_debug.c
 create mode 100644 lib/librte_eal/common/eal_common_debug.c
 delete mode 100644 lib/librte_eal/linuxapp/eal/eal_debug.c
app/test/test_debug.c +0 -1
index 7c3ee92..01d4b76 100644
@@ -136,7 +136,6 @@ static int
 test_debug(void)
 {
 	rte_dump_stack();
-	rte_dump_registers();
 	if (test_panic() < 0)
 		return -1;
 	if (test_exit() < 0)
lib/librte_eal/bsdapp/eal/Makefile +1 -1
index d434882..9b83e11 100644
@@ -53,7 +53,6 @@ SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_hugepage_info.c
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_thread.c
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_log.c
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_pci.c
-SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_debug.c
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_lcore.c
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_timer.c
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_interrupts.c
@@ -73,6 +72,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_common_hexdump.c
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_common_devargs.c
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_common_dev.c
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_common_options.c
+SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_common_debug.c
 
 CFLAGS_eal.o := -D_GNU_SOURCE
 #CFLAGS_eal_thread.o := -D_GNU_SOURCE
lib/librte_eal/bsdapp/eal/eal_debug.c deleted +0 -113
deleted file mode 100644
index 44fc4f3..0000000
@@ -1,113 +0,0 @@
-/*-
- *   BSD LICENSE
- *
- *   Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
- *   All rights reserved.
- *
- *   Redistribution and use in source and binary forms, with or without
- *   modification, are permitted provided that the following conditions
- *   are met:
- *
- *     * Redistributions of source code must retain the above copyright
- *       notice, this list of conditions and the following disclaimer.
- *     * Redistributions in binary form must reproduce the above copyright
- *       notice, this list of conditions and the following disclaimer in
- *       the documentation and/or other materials provided with the
- *       distribution.
- *     * Neither the name of Intel Corporation nor the names of its
- *       contributors may be used to endorse or promote products derived
- *       from this software without specific prior written permission.
- *
- *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <execinfo.h>
-#include <stdarg.h>
-#include <signal.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <stdint.h>
-
-#include <rte_log.h>
-#include <rte_debug.h>
-#include <rte_common.h>
-
-#define BACKTRACE_SIZE 256
-
-/* dump the stack of the calling core */
-void rte_dump_stack(void)
-{
-	void *func[BACKTRACE_SIZE];
-	char **symb = NULL;
-	int size;
-
-	size = backtrace(func, BACKTRACE_SIZE);
-	symb = backtrace_symbols(func, size);
-	while (size > 0) {
-		rte_log(RTE_LOG_ERR, RTE_LOGTYPE_EAL,
-			"%d: [%s]\n", size, symb[size - 1]);
-		size --;
-	}
-}
-
-/* not implemented in this environment */
-void rte_dump_registers(void)
-{
-	return;
-}
-
-/* call abort(), it will generate a coredump if enabled */
-void __rte_panic(const char *funcname, const char *format, ...)
-{
-	va_list ap;
-
-	/* disable history */
-	rte_log_set_history(0);
-
-	rte_log(RTE_LOG_CRIT, RTE_LOGTYPE_EAL, "PANIC in %s():\n", funcname);
-	va_start(ap, format);
-	rte_vlog(RTE_LOG_CRIT, RTE_LOGTYPE_EAL, format, ap);
-	va_end(ap);
-	rte_dump_stack();
-	rte_dump_registers();
-	abort();
-}
-
-/*
- * Like rte_panic this terminates the application. However, no traceback is
- * provided and no core-dump is generated.
- */
-void
-rte_exit(int exit_code, const char *format, ...)
-{
-	va_list ap;
-
-	/* disable history */
-	rte_log_set_history(0);
-
-	if (exit_code != 0)
-		RTE_LOG(CRIT, EAL, "Error - exiting with code: %d\n"
-				"  Cause: ", exit_code);
-
-	va_start(ap, format);
-	rte_vlog(RTE_LOG_CRIT, RTE_LOGTYPE_EAL, format, ap);
-	va_end(ap);
-
-#ifndef RTE_EAL_ALWAYS_PANIC_ON_ERROR
-	exit(exit_code);
-#else
-	rte_dump_stack();
-	rte_dump_registers();
-	abort();
-#endif
-}
lib/librte_eal/common/eal_common_debug.c new file +106 -0
new file mode 100644
index 0000000..9c10ee4
@@ -0,0 +1,106 @@
+/*-
+ *   BSD LICENSE
+ *
+ *   Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
+ *   All rights reserved.
+ *
+ *   Redistribution and use in source and binary forms, with or without
+ *   modification, are permitted provided that the following conditions
+ *   are met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in
+ *       the documentation and/or other materials provided with the
+ *       distribution.
+ *     * Neither the name of Intel Corporation nor the names of its
+ *       contributors may be used to endorse or promote products derived
+ *       from this software without specific prior written permission.
+ *
+ *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <execinfo.h>
+#include <stdarg.h>
+#include <signal.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <stdint.h>
+
+#include <rte_log.h>
+#include <rte_debug.h>
+#include <rte_common.h>
+
+#define BACKTRACE_SIZE 256
+
+/* dump the stack of the calling core */
+void rte_dump_stack(void)
+{
+	void *func[BACKTRACE_SIZE];
+	char **symb = NULL;
+	int size;
+
+	size = backtrace(func, BACKTRACE_SIZE);
+	symb = backtrace_symbols(func, size);
+	while (size > 0) {
+		rte_log(RTE_LOG_ERR, RTE_LOGTYPE_EAL,
+			"%d: [%s]\n", size, symb[size - 1]);
+		size--;
+	}
+}
+
+/* call abort(), it will generate a coredump if enabled */
+void __rte_panic(const char *funcname, const char *format, ...)
+{
+	va_list ap;
+
+	/* disable history */
+	rte_log_set_history(0);
+
+	rte_log(RTE_LOG_CRIT, RTE_LOGTYPE_EAL, "PANIC in %s():\n", funcname);
+	va_start(ap, format);
+	rte_vlog(RTE_LOG_CRIT, RTE_LOGTYPE_EAL, format, ap);
+	va_end(ap);
+	rte_dump_stack();
+	abort();
+}
+
+/*
+ * Like rte_panic this terminates the application. However, no traceback is
+ * provided and no core-dump is generated. if RTE_EAL_ALWAYS_PANIC_ON_ERROR
+ * is not defined.
+ */
+void
+rte_exit(int exit_code, const char *format, ...)
+{
+	va_list ap;
+
+	/* disable history */
+	rte_log_set_history(0);
+
+	if (exit_code != 0)
+		RTE_LOG(CRIT, EAL, "Error - exiting with code: %d\n"
+				"  Cause: ", exit_code);
+
+	va_start(ap, format);
+	rte_vlog(RTE_LOG_CRIT, RTE_LOGTYPE_EAL, format, ap);
+	va_end(ap);
+
+#ifndef RTE_EAL_ALWAYS_PANIC_ON_ERROR
+	exit(exit_code);
+#else
+	rte_dump_stack();
+	abort();
+#endif
+}
lib/librte_eal/common/include/rte_debug.h +0 -7
index 82ee3b3..3fb0307 100644
@@ -53,13 +53,6 @@ extern "C" {
 void rte_dump_stack(void);
 
 /**
- * Dump the registers of the calling core to the console.
- *
- * Note: Not implemented in a userapp environment; use gdb instead.
- */
-void rte_dump_registers(void);
-
-/**
  * Provide notification of a critical non-recoverable error and terminate
  * execution abnormally.
  *
lib/librte_eal/linuxapp/eal/Makefile +1 -1
index 72ecf3a..87b9bfc 100644
@@ -62,7 +62,6 @@ SRCS-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP) += eal_pci.c
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP) += eal_pci_uio.c
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP) += eal_pci_vfio.c
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP) += eal_pci_vfio_mp_sync.c
-SRCS-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP) += eal_debug.c
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP) += eal_lcore.c
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP) += eal_timer.c
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP) += eal_interrupts.c
@@ -85,6 +84,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP) += eal_common_hexdump.c
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP) += eal_common_devargs.c
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP) += eal_common_dev.c
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP) += eal_common_options.c
+SRCS-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP) += eal_common_debug.c
 
 CFLAGS_eal.o := -D_GNU_SOURCE
 CFLAGS_eal_thread.o := -D_GNU_SOURCE
lib/librte_eal/linuxapp/eal/eal_debug.c deleted +0 -113
deleted file mode 100644
index 44fc4f3..0000000
@@ -1,113 +0,0 @@
-/*-
- *   BSD LICENSE
- *
- *   Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
- *   All rights reserved.
- *
- *   Redistribution and use in source and binary forms, with or without
- *   modification, are permitted provided that the following conditions
- *   are met:
- *
- *     * Redistributions of source code must retain the above copyright
- *       notice, this list of conditions and the following disclaimer.
- *     * Redistributions in binary form must reproduce the above copyright
- *       notice, this list of conditions and the following disclaimer in
- *       the documentation and/or other materials provided with the
- *       distribution.
- *     * Neither the name of Intel Corporation nor the names of its
- *       contributors may be used to endorse or promote products derived
- *       from this software without specific prior written permission.
- *
- *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <execinfo.h>
-#include <stdarg.h>
-#include <signal.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <stdint.h>
-
-#include <rte_log.h>
-#include <rte_debug.h>
-#include <rte_common.h>
-
-#define BACKTRACE_SIZE 256
-
-/* dump the stack of the calling core */
-void rte_dump_stack(void)
-{
-	void *func[BACKTRACE_SIZE];
-	char **symb = NULL;
-	int size;
-
-	size = backtrace(func, BACKTRACE_SIZE);
-	symb = backtrace_symbols(func, size);
-	while (size > 0) {
-		rte_log(RTE_LOG_ERR, RTE_LOGTYPE_EAL,
-			"%d: [%s]\n", size, symb[size - 1]);
-		size --;
-	}
-}
-
-/* not implemented in this environment */
-void rte_dump_registers(void)
-{
-	return;
-}
-
-/* call abort(), it will generate a coredump if enabled */
-void __rte_panic(const char *funcname, const char *format, ...)
-{
-	va_list ap;
-
-	/* disable history */
-	rte_log_set_history(0);
-
-	rte_log(RTE_LOG_CRIT, RTE_LOGTYPE_EAL, "PANIC in %s():\n", funcname);
-	va_start(ap, format);
-	rte_vlog(RTE_LOG_CRIT, RTE_LOGTYPE_EAL, format, ap);
-	va_end(ap);
-	rte_dump_stack();
-	rte_dump_registers();
-	abort();
-}
-
-/*
- * Like rte_panic this terminates the application. However, no traceback is
- * provided and no core-dump is generated.
- */
-void
-rte_exit(int exit_code, const char *format, ...)
-{
-	va_list ap;
-
-	/* disable history */
-	rte_log_set_history(0);
-
-	if (exit_code != 0)
-		RTE_LOG(CRIT, EAL, "Error - exiting with code: %d\n"
-				"  Cause: ", exit_code);
-
-	va_start(ap, format);
-	rte_vlog(RTE_LOG_CRIT, RTE_LOGTYPE_EAL, format, ap);
-	va_end(ap);
-
-#ifndef RTE_EAL_ALWAYS_PANIC_ON_ERROR
-	exit(exit_code);
-#else
-	rte_dump_stack();
-	rte_dump_registers();
-	abort();
-#endif
-}
Signature · 1 line
1.9.1
author
#11 lore raw
In reply to a message not in the archive

I will change the subject and make it more explicit. In addition, I was thinking of adding function names which are moved as part of commit message so that it is easier for everyone to check what is moved rather than going through the patch. Do you think it would be helpful??

Thanks.

Quoted 500 lines · Neil Horman
Quoted 11 lines · Ravi Kerur

Changes in v2
1. Remove rte_dump_registers() function since it is not implemented.
2. Fix comment for _rte_exit()

eal_debug.c has no difference between Linux and BSD, move into common directory.
Rename eal_debug.c to eal_common_debug.c Makefile changes to reflect file move and name change. Fix checkpatch warnings.

The subject matter for all of the patches in the series should be more detailed.
Just posting move EAL components to common directly isn't overly informative
Neil

Quoted 4 lines
---
 app/test/test_debug.c                     |   1 -
 lib/librte_eal/bsdapp/eal/Makefile        |   2 +-
 lib/librte_eal/bsdapp/eal/eal_debug.c     | 113

------------------------------

Quoted 1 line
 lib/librte_eal/common/eal_common_debug.c  | 106

++++++++++++++++++++++++++++

Quoted 3 lines
 lib/librte_eal/common/include/rte_debug.h |   7 --
 lib/librte_eal/linuxapp/eal/Makefile      |   2 +-
 lib/librte_eal/linuxapp/eal/eal_debug.c   | 113

------------------------------

Review

Quoted 18 lines
 7 files changed, 108 insertions(+), 236 deletions(-)
 delete mode 100644 lib/librte_eal/bsdapp/eal/eal_debug.c
 create mode 100644 lib/librte_eal/common/eal_common_debug.c
 delete mode 100644 lib/librte_eal/linuxapp/eal/eal_debug.c
app/test/test_debug.c +0 -1
index 7c3ee92..01d4b76 100644
@@ -136,7 +136,6 @@ static int
 test_debug(void)
 {
      rte_dump_stack();
-     rte_dump_registers();
      if (test_panic() < 0)
              return -1;
      if (test_exit() < 0)
(quoted diff) +0 -0

b/lib/librte_eal/bsdapp/eal/Makefile

lib/librte_eal/bsdapp/eal/Makefile SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) +=

Quoted 4 lines

index d434882..9b83e11 100644

lib/librte_eal/bsdapp/eal/Makefile +0 -0
@@ -53,7 +53,6 @@ SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) +=

eal_hugepage_info.c

lib/librte_eal/bsdapp/eal/Makefile SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) +=

Quoted 8 lines
lib/librte_eal/bsdapp/eal/Makefile +0 -1
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_thread.c
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_log.c
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_pci.c
-SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_debug.c
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_lcore.c
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_timer.c
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_interrupts.c
@@ -73,6 +72,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) +=

eal_common_hexdump.c

Review

Quoted 8 lines
lib/librte_eal/bsdapp/eal/Makefile +1 -0
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_common_devargs.c
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_common_dev.c
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_common_options.c
+SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_common_debug.c
 
 CFLAGS_eal.o := -D_GNU_SOURCE
 #CFLAGS_eal_thread.o := -D_GNU_SOURCE
(quoted diff) +0 -0

b/lib/librte_eal/bsdapp/eal/eal_debug.c

Quoted 8 lines

deleted file mode 100644
index 44fc4f3..0000000

lib/librte_eal/bsdapp/eal/eal_debug.c deleted +0 -3
@@ -1,113 +0,0 @@
-/*-
- *   BSD LICENSE
- *

lib/librte_eal/bsdapp/eal/eal_debug.c line 13

Quoted 10 lines
lib/librte_eal/bsdapp/eal/eal_debug.c deleted +0 -10
- *   Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
- *   All rights reserved.
- *
- *   Redistribution and use in source and binary forms, with or without
- *   modification, are permitted provided that the following conditions
- *   are met:
- *
- *     * Redistributions of source code must retain the above copyright
- *       notice, this list of conditions and the following disclaimer.
- *     * Redistributions in binary form must reproduce the above

copyright

lib/librte_eal/bsdapp/eal/eal_debug.c

Quoted 10 lines
lib/librte_eal/bsdapp/eal/eal_debug.c deleted +0 -10
- *       notice, this list of conditions and the following disclaimer in
- *       the documentation and/or other materials provided with the
- *       distribution.
- *     * Neither the name of Intel Corporation nor the names of its
- *       contributors may be used to endorse or promote products derived
- *       from this software without specific prior written permission.
- *
- *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS

FOR

lib/librte_eal/bsdapp/eal/eal_debug.c line 24

Quoted 1 line
lib/librte_eal/bsdapp/eal/eal_debug.c deleted +0 -1
- *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE

COPYRIGHT

lib/librte_eal/bsdapp/eal/eal_debug.c line 25

Quoted 1 line
lib/librte_eal/bsdapp/eal/eal_debug.c deleted +0 -1
- *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,

INCIDENTAL,

lib/librte_eal/bsdapp/eal/eal_debug.c line 27

Quoted 2 lines
lib/librte_eal/bsdapp/eal/eal_debug.c deleted +0 -2
- *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF

USE,

lib/librte_eal/bsdapp/eal/eal_debug.c line 28

Quoted 1 line
lib/librte_eal/bsdapp/eal/eal_debug.c deleted +0 -1
- *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON

ANY

lib/librte_eal/bsdapp/eal/eal_debug.c line 30

Quoted 2 lines
lib/librte_eal/bsdapp/eal/eal_debug.c deleted +0 -2
- *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE

USE

lib/librte_eal/bsdapp/eal/eal_debug.c line 31

Quoted 1 line
lib/librte_eal/bsdapp/eal/eal_debug.c deleted +0 -1
- *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH

DAMAGE.

Quoted 36 lines
lib/librte_eal/bsdapp/eal/eal_debug.c deleted +0 -36
- */
-
-#include <execinfo.h>
-#include <stdarg.h>
-#include <signal.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <stdint.h>
-
-#include <rte_log.h>
-#include <rte_debug.h>
-#include <rte_common.h>
-
-#define BACKTRACE_SIZE 256
-
-/* dump the stack of the calling core */
-void rte_dump_stack(void)
-{
-     void *func[BACKTRACE_SIZE];
-     char **symb = NULL;
-     int size;
-
-     size = backtrace(func, BACKTRACE_SIZE);
-     symb = backtrace_symbols(func, size);
-     while (size > 0) {
-             rte_log(RTE_LOG_ERR, RTE_LOGTYPE_EAL,
-                     "%d: [%s]\n", size, symb[size - 1]);
-             size --;
-     }
-}
-
-/* not implemented in this environment */
-void rte_dump_registers(void)
-{
-     return;
-}

lib/librte_eal/bsdapp/eal/eal_debug.c

Quoted 10 lines
lib/librte_eal/bsdapp/eal/eal_debug.c deleted +0 -10
-
-/* call abort(), it will generate a coredump if enabled */
-void __rte_panic(const char *funcname, const char *format, ...)
-{
-     va_list ap;
-
-     /* disable history */
-     rte_log_set_history(0);
-
-     rte_log(RTE_LOG_CRIT, RTE_LOGTYPE_EAL, "PANIC in %s():\n",

funcname);

lib/librte_eal/bsdapp/eal/eal_debug.c

Quoted 10 lines
lib/librte_eal/bsdapp/eal/eal_debug.c deleted +0 -10
-     va_start(ap, format);
-     rte_vlog(RTE_LOG_CRIT, RTE_LOGTYPE_EAL, format, ap);
-     va_end(ap);
-     rte_dump_stack();
-     rte_dump_registers();
-     abort();
-}
-
-/*
- * Like rte_panic this terminates the application. However, no

traceback is

Review

Quoted 27 lines
lib/librte_eal/bsdapp/eal/eal_debug.c deleted +0 -26
- * provided and no core-dump is generated.
- */
-void
-rte_exit(int exit_code, const char *format, ...)
-{
-     va_list ap;
-
-     /* disable history */
-     rte_log_set_history(0);
-
-     if (exit_code != 0)
-             RTE_LOG(CRIT, EAL, "Error - exiting with code: %d\n"
-                             "  Cause: ", exit_code);
-
-     va_start(ap, format);
-     rte_vlog(RTE_LOG_CRIT, RTE_LOGTYPE_EAL, format, ap);
-     va_end(ap);
-
-#ifndef RTE_EAL_ALWAYS_PANIC_ON_ERROR
-     exit(exit_code);
-#else
-     rte_dump_stack();
-     rte_dump_registers();
-     abort();
-#endif
-}
(quoted diff) +0 -0

b/lib/librte_eal/common/eal_common_debug.c

Quoted 8 lines

new file mode 100644
index 0000000..9c10ee4

lib/librte_eal/common/eal_common_debug.c new file +3 -0
@@ -0,0 +1,106 @@
+/*-
+ *   BSD LICENSE
+ *

lib/librte_eal/common/eal_common_debug.c line 13

Quoted 10 lines
lib/librte_eal/common/eal_common_debug.c new file +10 -0
+ *   Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
+ *   All rights reserved.
+ *
+ *   Redistribution and use in source and binary forms, with or without
+ *   modification, are permitted provided that the following conditions
+ *   are met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above

copyright

lib/librte_eal/common/eal_common_debug.c

Quoted 10 lines
lib/librte_eal/common/eal_common_debug.c new file +10 -0
+ *       notice, this list of conditions and the following disclaimer in
+ *       the documentation and/or other materials provided with the
+ *       distribution.
+ *     * Neither the name of Intel Corporation nor the names of its
+ *       contributors may be used to endorse or promote products derived
+ *       from this software without specific prior written permission.
+ *
+ *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS

FOR

lib/librte_eal/common/eal_common_debug.c line 24

Quoted 1 line
lib/librte_eal/common/eal_common_debug.c new file +1 -0
+ *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE

COPYRIGHT

lib/librte_eal/common/eal_common_debug.c line 25

Quoted 1 line
lib/librte_eal/common/eal_common_debug.c new file +1 -0
+ *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,

INCIDENTAL,

lib/librte_eal/common/eal_common_debug.c line 27

Quoted 2 lines
lib/librte_eal/common/eal_common_debug.c new file +2 -0
+ *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF

USE,

lib/librte_eal/common/eal_common_debug.c line 28

Quoted 1 line
lib/librte_eal/common/eal_common_debug.c new file +1 -0
+ *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON

ANY

lib/librte_eal/common/eal_common_debug.c line 30

Quoted 2 lines
lib/librte_eal/common/eal_common_debug.c new file +2 -0
+ *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE

USE

lib/librte_eal/common/eal_common_debug.c line 31

Quoted 1 line
lib/librte_eal/common/eal_common_debug.c new file +1 -0
+ *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH

DAMAGE.

Quoted 30 lines
lib/librte_eal/common/eal_common_debug.c new file +30 -0
+ */
+
+#include <execinfo.h>
+#include <stdarg.h>
+#include <signal.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <stdint.h>
+
+#include <rte_log.h>
+#include <rte_debug.h>
+#include <rte_common.h>
+
+#define BACKTRACE_SIZE 256
+
+/* dump the stack of the calling core */
+void rte_dump_stack(void)
+{
+     void *func[BACKTRACE_SIZE];
+     char **symb = NULL;
+     int size;
+
+     size = backtrace(func, BACKTRACE_SIZE);
+     symb = backtrace_symbols(func, size);
+     while (size > 0) {
+             rte_log(RTE_LOG_ERR, RTE_LOGTYPE_EAL,
+                     "%d: [%s]\n", size, symb[size - 1]);
+             size--;
+     }
+}

lib/librte_eal/common/eal_common_debug.c

Quoted 10 lines
lib/librte_eal/common/eal_common_debug.c new file +10 -0
+
+/* call abort(), it will generate a coredump if enabled */
+void __rte_panic(const char *funcname, const char *format, ...)
+{
+     va_list ap;
+
+     /* disable history */
+     rte_log_set_history(0);
+
+     rte_log(RTE_LOG_CRIT, RTE_LOGTYPE_EAL, "PANIC in %s():\n",

funcname);

lib/librte_eal/common/eal_common_debug.c

Quoted 9 lines
lib/librte_eal/common/eal_common_debug.c new file +9 -0
+     va_start(ap, format);
+     rte_vlog(RTE_LOG_CRIT, RTE_LOGTYPE_EAL, format, ap);
+     va_end(ap);
+     rte_dump_stack();
+     abort();
+}
+
+/*
+ * Like rte_panic this terminates the application. However, no

traceback is

lib/librte_eal/common/eal_common_debug.c line 81

Quoted 1 line
lib/librte_eal/common/eal_common_debug.c new file +1 -0
+ * provided and no core-dump is generated. if

RTE_EAL_ALWAYS_PANIC_ON_ERROR

Review

Quoted 26 lines
lib/librte_eal/common/eal_common_debug.c new file +25 -0
+ * is not defined.
+ */
+void
+rte_exit(int exit_code, const char *format, ...)
+{
+     va_list ap;
+
+     /* disable history */
+     rte_log_set_history(0);
+
+     if (exit_code != 0)
+             RTE_LOG(CRIT, EAL, "Error - exiting with code: %d\n"
+                             "  Cause: ", exit_code);
+
+     va_start(ap, format);
+     rte_vlog(RTE_LOG_CRIT, RTE_LOGTYPE_EAL, format, ap);
+     va_end(ap);
+
+#ifndef RTE_EAL_ALWAYS_PANIC_ON_ERROR
+     exit(exit_code);
+#else
+     rte_dump_stack();
+     abort();
+#endif
+}
(quoted diff) +0 -0

b/lib/librte_eal/common/include/rte_debug.h

Quoted 5 lines

index 82ee3b3..3fb0307 100644

lib/librte_eal/common/include/rte_debug.h +0 -0
@@ -53,13 +53,6 @@ extern "C" {
 void rte_dump_stack(void);

lib/librte_eal/common/include/rte_debug.h extern "C" { · line 56

Quoted 10 lines
lib/librte_eal/common/include/rte_debug.h +0 -7
 
 /**
- * Dump the registers of the calling core to the console.
- *
- * Note: Not implemented in a userapp environment; use gdb instead.
- */
-void rte_dump_registers(void);
-
-/**
  * Provide notification of a critical non-recoverable error and

terminate

Review

Quoted 3 lines
lib/librte_eal/common/include/rte_debug.h +0 -0
  * execution abnormally.
  *
(quoted diff) +0 -0

b/lib/librte_eal/linuxapp/eal/Makefile

lib/librte_eal/linuxapp/eal/Makefile SRCS-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP) +=

Quoted 12 lines

index 72ecf3a..87b9bfc 100644

lib/librte_eal/linuxapp/eal/Makefile +0 -1
@@ -62,7 +62,6 @@ SRCS-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP) += eal_pci.c
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP) += eal_pci_uio.c
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP) += eal_pci_vfio.c
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP) += eal_pci_vfio_mp_sync.c
-SRCS-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP) += eal_debug.c
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP) += eal_lcore.c
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP) += eal_timer.c
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP) += eal_interrupts.c
@@ -85,6 +84,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP) +=

eal_common_hexdump.c

Review

Quoted 8 lines
lib/librte_eal/linuxapp/eal/Makefile +1 -0
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP) += eal_common_devargs.c
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP) += eal_common_dev.c
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP) += eal_common_options.c
+SRCS-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP) += eal_common_debug.c
 
 CFLAGS_eal.o := -D_GNU_SOURCE
 CFLAGS_eal_thread.o := -D_GNU_SOURCE
(quoted diff) +0 -0

b/lib/librte_eal/linuxapp/eal/eal_debug.c

Quoted 8 lines

deleted file mode 100644
index 44fc4f3..0000000

lib/librte_eal/linuxapp/eal/eal_debug.c deleted +0 -3
@@ -1,113 +0,0 @@
-/*-
- *   BSD LICENSE
- *

lib/librte_eal/linuxapp/eal/eal_debug.c line 13

Quoted 10 lines
lib/librte_eal/linuxapp/eal/eal_debug.c deleted +0 -10
- *   Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
- *   All rights reserved.
- *
- *   Redistribution and use in source and binary forms, with or without
- *   modification, are permitted provided that the following conditions
- *   are met:
- *
- *     * Redistributions of source code must retain the above copyright
- *       notice, this list of conditions and the following disclaimer.
- *     * Redistributions in binary form must reproduce the above

copyright

lib/librte_eal/linuxapp/eal/eal_debug.c line 23

Quoted 10 lines
lib/librte_eal/linuxapp/eal/eal_debug.c deleted +0 -10
- *       notice, this list of conditions and the following disclaimer in
- *       the documentation and/or other materials provided with the
- *       distribution.
- *     * Neither the name of Intel Corporation nor the names of its
- *       contributors may be used to endorse or promote products derived
- *       from this software without specific prior written permission.
- *
- *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS

FOR

lib/librte_eal/linuxapp/eal/eal_debug.c line 24

Quoted 1 line
lib/librte_eal/linuxapp/eal/eal_debug.c deleted +0 -1
- *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE

COPYRIGHT

lib/librte_eal/linuxapp/eal/eal_debug.c line 25

Quoted 1 line
lib/librte_eal/linuxapp/eal/eal_debug.c deleted +0 -1
- *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,

INCIDENTAL,

lib/librte_eal/linuxapp/eal/eal_debug.c line 27

Quoted 2 lines
lib/librte_eal/linuxapp/eal/eal_debug.c deleted +0 -2
- *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF

USE,

lib/librte_eal/linuxapp/eal/eal_debug.c line 28

Quoted 1 line
lib/librte_eal/linuxapp/eal/eal_debug.c deleted +0 -1
- *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON

ANY

lib/librte_eal/linuxapp/eal/eal_debug.c line 30

Quoted 2 lines
lib/librte_eal/linuxapp/eal/eal_debug.c deleted +0 -2
- *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE

USE

lib/librte_eal/linuxapp/eal/eal_debug.c line 31

Quoted 1 line
lib/librte_eal/linuxapp/eal/eal_debug.c deleted +0 -1
- *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH

DAMAGE.

Quoted 36 lines
lib/librte_eal/linuxapp/eal/eal_debug.c deleted +0 -36
- */
-
-#include <execinfo.h>
-#include <stdarg.h>
-#include <signal.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <stdint.h>
-
-#include <rte_log.h>
-#include <rte_debug.h>
-#include <rte_common.h>
-
-#define BACKTRACE_SIZE 256
-
-/* dump the stack of the calling core */
-void rte_dump_stack(void)
-{
-     void *func[BACKTRACE_SIZE];
-     char **symb = NULL;
-     int size;
-
-     size = backtrace(func, BACKTRACE_SIZE);
-     symb = backtrace_symbols(func, size);
-     while (size > 0) {
-             rte_log(RTE_LOG_ERR, RTE_LOGTYPE_EAL,
-                     "%d: [%s]\n", size, symb[size - 1]);
-             size --;
-     }
-}
-
-/* not implemented in this environment */
-void rte_dump_registers(void)
-{
-     return;
-}

lib/librte_eal/linuxapp/eal/eal_debug.c line 77

Quoted 10 lines
lib/librte_eal/linuxapp/eal/eal_debug.c deleted +0 -10
-
-/* call abort(), it will generate a coredump if enabled */
-void __rte_panic(const char *funcname, const char *format, ...)
-{
-     va_list ap;
-
-     /* disable history */
-     rte_log_set_history(0);
-
-     rte_log(RTE_LOG_CRIT, RTE_LOGTYPE_EAL, "PANIC in %s():\n",

funcname);

lib/librte_eal/linuxapp/eal/eal_debug.c line 87

Quoted 10 lines
lib/librte_eal/linuxapp/eal/eal_debug.c deleted +0 -10
-     va_start(ap, format);
-     rte_vlog(RTE_LOG_CRIT, RTE_LOGTYPE_EAL, format, ap);
-     va_end(ap);
-     rte_dump_stack();
-     rte_dump_registers();
-     abort();
-}
-
-/*
- * Like rte_panic this terminates the application. However, no

traceback is

Quoted 30 lines
lib/librte_eal/linuxapp/eal/eal_debug.c deleted +0 -27
- * provided and no core-dump is generated.
- */
-void
-rte_exit(int exit_code, const char *format, ...)
-{
-     va_list ap;
-
-     /* disable history */
-     rte_log_set_history(0);
-
-     if (exit_code != 0)
-             RTE_LOG(CRIT, EAL, "Error - exiting with code: %d\n"
-                             "  Cause: ", exit_code);
-
-     va_start(ap, format);
-     rte_vlog(RTE_LOG_CRIT, RTE_LOGTYPE_EAL, format, ap);
-     va_end(ap);
-
-#ifndef RTE_EAL_ALWAYS_PANIC_ON_ERROR
-     exit(exit_code);
-#else
-     rte_dump_stack();
-     rte_dump_registers();
-     abort();
-#endif
-}
--

1.9.1

#13 lore raw
In reply to a message not in the archive
Quoted 5 lines · Ravi Kerur

I will change the subject and make it more explicit. In addition, I was thinking of adding function names which are moved as part of commit message so that it is easier for everyone to check what is moved rather than going through the patch. Do you think it would be helpful??

yeah, adding that detail in the changelog, as well as the files updated in the subject would be a big help for historical purposes. Thanks! Neil

Quoted 504 lines

Thanks.

Quoted 500 lines · Neil Horman
Quoted 11 lines · Ravi Kerur

Changes in v2
1. Remove rte_dump_registers() function since it is not implemented.
2. Fix comment for _rte_exit()

eal_debug.c has no difference between Linux and BSD, move into common directory.
Rename eal_debug.c to eal_common_debug.c Makefile changes to reflect file move and name change. Fix checkpatch warnings.

The subject matter for all of the patches in the series should be more detailed.
Just posting move EAL components to common directly isn't overly informative
Neil

Quoted 4 lines
---
 app/test/test_debug.c                     |   1 -
 lib/librte_eal/bsdapp/eal/Makefile        |   2 +-
 lib/librte_eal/bsdapp/eal/eal_debug.c     | 113

------------------------------

Quoted 1 line
 lib/librte_eal/common/eal_common_debug.c  | 106

++++++++++++++++++++++++++++

Quoted 3 lines
 lib/librte_eal/common/include/rte_debug.h |   7 --
 lib/librte_eal/linuxapp/eal/Makefile      |   2 +-
 lib/librte_eal/linuxapp/eal/eal_debug.c   | 113

------------------------------

Review

Quoted 18 lines
 7 files changed, 108 insertions(+), 236 deletions(-)
 delete mode 100644 lib/librte_eal/bsdapp/eal/eal_debug.c
 create mode 100644 lib/librte_eal/common/eal_common_debug.c
 delete mode 100644 lib/librte_eal/linuxapp/eal/eal_debug.c
app/test/test_debug.c +0 -1
index 7c3ee92..01d4b76 100644
@@ -136,7 +136,6 @@ static int
 test_debug(void)
 {
      rte_dump_stack();
-     rte_dump_registers();
      if (test_panic() < 0)
              return -1;
      if (test_exit() < 0)
(quoted diff) +0 -0

b/lib/librte_eal/bsdapp/eal/Makefile

lib/librte_eal/bsdapp/eal/Makefile SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) +=

Quoted 4 lines

index d434882..9b83e11 100644

lib/librte_eal/bsdapp/eal/Makefile +0 -0
@@ -53,7 +53,6 @@ SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) +=

eal_hugepage_info.c

lib/librte_eal/bsdapp/eal/Makefile SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) +=

Quoted 8 lines
lib/librte_eal/bsdapp/eal/Makefile +0 -1
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_thread.c
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_log.c
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_pci.c
-SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_debug.c
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_lcore.c
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_timer.c
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_interrupts.c
@@ -73,6 +72,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) +=

eal_common_hexdump.c

Review

Quoted 8 lines
lib/librte_eal/bsdapp/eal/Makefile +1 -0
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_common_devargs.c
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_common_dev.c
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_common_options.c
+SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_common_debug.c
 
 CFLAGS_eal.o := -D_GNU_SOURCE
 #CFLAGS_eal_thread.o := -D_GNU_SOURCE
(quoted diff) +0 -0

b/lib/librte_eal/bsdapp/eal/eal_debug.c

Quoted 8 lines

deleted file mode 100644
index 44fc4f3..0000000

lib/librte_eal/bsdapp/eal/eal_debug.c deleted +0 -3
@@ -1,113 +0,0 @@
-/*-
- *   BSD LICENSE
- *

lib/librte_eal/bsdapp/eal/eal_debug.c line 13

Quoted 10 lines
lib/librte_eal/bsdapp/eal/eal_debug.c deleted +0 -10
- *   Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
- *   All rights reserved.
- *
- *   Redistribution and use in source and binary forms, with or without
- *   modification, are permitted provided that the following conditions
- *   are met:
- *
- *     * Redistributions of source code must retain the above copyright
- *       notice, this list of conditions and the following disclaimer.
- *     * Redistributions in binary form must reproduce the above

copyright

lib/librte_eal/bsdapp/eal/eal_debug.c

Quoted 10 lines
lib/librte_eal/bsdapp/eal/eal_debug.c deleted +0 -10
- *       notice, this list of conditions and the following disclaimer in
- *       the documentation and/or other materials provided with the
- *       distribution.
- *     * Neither the name of Intel Corporation nor the names of its
- *       contributors may be used to endorse or promote products derived
- *       from this software without specific prior written permission.
- *
- *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS

FOR

lib/librte_eal/bsdapp/eal/eal_debug.c line 24

Quoted 1 line
lib/librte_eal/bsdapp/eal/eal_debug.c deleted +0 -1
- *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE

COPYRIGHT

lib/librte_eal/bsdapp/eal/eal_debug.c line 25

Quoted 1 line
lib/librte_eal/bsdapp/eal/eal_debug.c deleted +0 -1
- *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,

INCIDENTAL,

lib/librte_eal/bsdapp/eal/eal_debug.c line 27

Quoted 2 lines
lib/librte_eal/bsdapp/eal/eal_debug.c deleted +0 -2
- *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF

USE,

lib/librte_eal/bsdapp/eal/eal_debug.c line 28

Quoted 1 line
lib/librte_eal/bsdapp/eal/eal_debug.c deleted +0 -1
- *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON

ANY

lib/librte_eal/bsdapp/eal/eal_debug.c line 30

Quoted 2 lines
lib/librte_eal/bsdapp/eal/eal_debug.c deleted +0 -2
- *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE

USE

lib/librte_eal/bsdapp/eal/eal_debug.c line 31

Quoted 1 line
lib/librte_eal/bsdapp/eal/eal_debug.c deleted +0 -1
- *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH

DAMAGE.

Quoted 36 lines
lib/librte_eal/bsdapp/eal/eal_debug.c deleted +0 -36
- */
-
-#include <execinfo.h>
-#include <stdarg.h>
-#include <signal.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <stdint.h>
-
-#include <rte_log.h>
-#include <rte_debug.h>
-#include <rte_common.h>
-
-#define BACKTRACE_SIZE 256
-
-/* dump the stack of the calling core */
-void rte_dump_stack(void)
-{
-     void *func[BACKTRACE_SIZE];
-     char **symb = NULL;
-     int size;
-
-     size = backtrace(func, BACKTRACE_SIZE);
-     symb = backtrace_symbols(func, size);
-     while (size > 0) {
-             rte_log(RTE_LOG_ERR, RTE_LOGTYPE_EAL,
-                     "%d: [%s]\n", size, symb[size - 1]);
-             size --;
-     }
-}
-
-/* not implemented in this environment */
-void rte_dump_registers(void)
-{
-     return;
-}

lib/librte_eal/bsdapp/eal/eal_debug.c

Quoted 10 lines
lib/librte_eal/bsdapp/eal/eal_debug.c deleted +0 -10
-
-/* call abort(), it will generate a coredump if enabled */
-void __rte_panic(const char *funcname, const char *format, ...)
-{
-     va_list ap;
-
-     /* disable history */
-     rte_log_set_history(0);
-
-     rte_log(RTE_LOG_CRIT, RTE_LOGTYPE_EAL, "PANIC in %s():\n",

funcname);

lib/librte_eal/bsdapp/eal/eal_debug.c

Quoted 10 lines
lib/librte_eal/bsdapp/eal/eal_debug.c deleted +0 -10
-     va_start(ap, format);
-     rte_vlog(RTE_LOG_CRIT, RTE_LOGTYPE_EAL, format, ap);
-     va_end(ap);
-     rte_dump_stack();
-     rte_dump_registers();
-     abort();
-}
-
-/*
- * Like rte_panic this terminates the application. However, no

traceback is

Review

Quoted 27 lines
lib/librte_eal/bsdapp/eal/eal_debug.c deleted +0 -26
- * provided and no core-dump is generated.
- */
-void
-rte_exit(int exit_code, const char *format, ...)
-{
-     va_list ap;
-
-     /* disable history */
-     rte_log_set_history(0);
-
-     if (exit_code != 0)
-             RTE_LOG(CRIT, EAL, "Error - exiting with code: %d\n"
-                             "  Cause: ", exit_code);
-
-     va_start(ap, format);
-     rte_vlog(RTE_LOG_CRIT, RTE_LOGTYPE_EAL, format, ap);
-     va_end(ap);
-
-#ifndef RTE_EAL_ALWAYS_PANIC_ON_ERROR
-     exit(exit_code);
-#else
-     rte_dump_stack();
-     rte_dump_registers();
-     abort();
-#endif
-}
(quoted diff) +0 -0

b/lib/librte_eal/common/eal_common_debug.c

Quoted 8 lines

new file mode 100644
index 0000000..9c10ee4

lib/librte_eal/common/eal_common_debug.c new file +3 -0
@@ -0,0 +1,106 @@
+/*-
+ *   BSD LICENSE
+ *

lib/librte_eal/common/eal_common_debug.c line 13

Quoted 10 lines
lib/librte_eal/common/eal_common_debug.c new file +10 -0
+ *   Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
+ *   All rights reserved.
+ *
+ *   Redistribution and use in source and binary forms, with or without
+ *   modification, are permitted provided that the following conditions
+ *   are met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above

copyright

lib/librte_eal/common/eal_common_debug.c

Quoted 10 lines
lib/librte_eal/common/eal_common_debug.c new file +10 -0
+ *       notice, this list of conditions and the following disclaimer in
+ *       the documentation and/or other materials provided with the
+ *       distribution.
+ *     * Neither the name of Intel Corporation nor the names of its
+ *       contributors may be used to endorse or promote products derived
+ *       from this software without specific prior written permission.
+ *
+ *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS

FOR

lib/librte_eal/common/eal_common_debug.c line 24

Quoted 1 line
lib/librte_eal/common/eal_common_debug.c new file +1 -0
+ *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE

COPYRIGHT

lib/librte_eal/common/eal_common_debug.c line 25

Quoted 1 line
lib/librte_eal/common/eal_common_debug.c new file +1 -0
+ *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,

INCIDENTAL,

lib/librte_eal/common/eal_common_debug.c line 27

Quoted 2 lines
lib/librte_eal/common/eal_common_debug.c new file +2 -0
+ *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF

USE,

lib/librte_eal/common/eal_common_debug.c line 28

Quoted 1 line
lib/librte_eal/common/eal_common_debug.c new file +1 -0
+ *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON

ANY

lib/librte_eal/common/eal_common_debug.c line 30

Quoted 2 lines
lib/librte_eal/common/eal_common_debug.c new file +2 -0
+ *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE

USE

lib/librte_eal/common/eal_common_debug.c line 31

Quoted 1 line
lib/librte_eal/common/eal_common_debug.c new file +1 -0
+ *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH

DAMAGE.

Quoted 30 lines
lib/librte_eal/common/eal_common_debug.c new file +30 -0
+ */
+
+#include <execinfo.h>
+#include <stdarg.h>
+#include <signal.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <stdint.h>
+
+#include <rte_log.h>
+#include <rte_debug.h>
+#include <rte_common.h>
+
+#define BACKTRACE_SIZE 256
+
+/* dump the stack of the calling core */
+void rte_dump_stack(void)
+{
+     void *func[BACKTRACE_SIZE];
+     char **symb = NULL;
+     int size;
+
+     size = backtrace(func, BACKTRACE_SIZE);
+     symb = backtrace_symbols(func, size);
+     while (size > 0) {
+             rte_log(RTE_LOG_ERR, RTE_LOGTYPE_EAL,
+                     "%d: [%s]\n", size, symb[size - 1]);
+             size--;
+     }
+}

lib/librte_eal/common/eal_common_debug.c

Quoted 10 lines
lib/librte_eal/common/eal_common_debug.c new file +10 -0
+
+/* call abort(), it will generate a coredump if enabled */
+void __rte_panic(const char *funcname, const char *format, ...)
+{
+     va_list ap;
+
+     /* disable history */
+     rte_log_set_history(0);
+
+     rte_log(RTE_LOG_CRIT, RTE_LOGTYPE_EAL, "PANIC in %s():\n",

funcname);

lib/librte_eal/common/eal_common_debug.c

Quoted 9 lines
lib/librte_eal/common/eal_common_debug.c new file +9 -0
+     va_start(ap, format);
+     rte_vlog(RTE_LOG_CRIT, RTE_LOGTYPE_EAL, format, ap);
+     va_end(ap);
+     rte_dump_stack();
+     abort();
+}
+
+/*
+ * Like rte_panic this terminates the application. However, no

traceback is

lib/librte_eal/common/eal_common_debug.c line 81

Quoted 1 line
lib/librte_eal/common/eal_common_debug.c new file +1 -0
+ * provided and no core-dump is generated. if

RTE_EAL_ALWAYS_PANIC_ON_ERROR

Review

Quoted 26 lines
lib/librte_eal/common/eal_common_debug.c new file +25 -0
+ * is not defined.
+ */
+void
+rte_exit(int exit_code, const char *format, ...)
+{
+     va_list ap;
+
+     /* disable history */
+     rte_log_set_history(0);
+
+     if (exit_code != 0)
+             RTE_LOG(CRIT, EAL, "Error - exiting with code: %d\n"
+                             "  Cause: ", exit_code);
+
+     va_start(ap, format);
+     rte_vlog(RTE_LOG_CRIT, RTE_LOGTYPE_EAL, format, ap);
+     va_end(ap);
+
+#ifndef RTE_EAL_ALWAYS_PANIC_ON_ERROR
+     exit(exit_code);
+#else
+     rte_dump_stack();
+     abort();
+#endif
+}
(quoted diff) +0 -0

b/lib/librte_eal/common/include/rte_debug.h

Quoted 5 lines

index 82ee3b3..3fb0307 100644

lib/librte_eal/common/include/rte_debug.h +0 -0
@@ -53,13 +53,6 @@ extern "C" {
 void rte_dump_stack(void);

lib/librte_eal/common/include/rte_debug.h extern "C" { · line 56

Quoted 10 lines
lib/librte_eal/common/include/rte_debug.h +0 -7
 
 /**
- * Dump the registers of the calling core to the console.
- *
- * Note: Not implemented in a userapp environment; use gdb instead.
- */
-void rte_dump_registers(void);
-
-/**
  * Provide notification of a critical non-recoverable error and

terminate

Review

Quoted 3 lines
lib/librte_eal/common/include/rte_debug.h +0 -0
  * execution abnormally.
  *
(quoted diff) +0 -0

b/lib/librte_eal/linuxapp/eal/Makefile

lib/librte_eal/linuxapp/eal/Makefile SRCS-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP) +=

Quoted 12 lines

index 72ecf3a..87b9bfc 100644

lib/librte_eal/linuxapp/eal/Makefile +0 -1
@@ -62,7 +62,6 @@ SRCS-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP) += eal_pci.c
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP) += eal_pci_uio.c
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP) += eal_pci_vfio.c
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP) += eal_pci_vfio_mp_sync.c
-SRCS-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP) += eal_debug.c
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP) += eal_lcore.c
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP) += eal_timer.c
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP) += eal_interrupts.c
@@ -85,6 +84,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP) +=

eal_common_hexdump.c

Review

Quoted 8 lines
lib/librte_eal/linuxapp/eal/Makefile +1 -0
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP) += eal_common_devargs.c
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP) += eal_common_dev.c
 SRCS-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP) += eal_common_options.c
+SRCS-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP) += eal_common_debug.c
 
 CFLAGS_eal.o := -D_GNU_SOURCE
 CFLAGS_eal_thread.o := -D_GNU_SOURCE
(quoted diff) +0 -0

b/lib/librte_eal/linuxapp/eal/eal_debug.c

Quoted 8 lines

deleted file mode 100644
index 44fc4f3..0000000

lib/librte_eal/linuxapp/eal/eal_debug.c deleted +0 -3
@@ -1,113 +0,0 @@
-/*-
- *   BSD LICENSE
- *

lib/librte_eal/linuxapp/eal/eal_debug.c line 13

Quoted 10 lines
lib/librte_eal/linuxapp/eal/eal_debug.c deleted +0 -10
- *   Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
- *   All rights reserved.
- *
- *   Redistribution and use in source and binary forms, with or without
- *   modification, are permitted provided that the following conditions
- *   are met:
- *
- *     * Redistributions of source code must retain the above copyright
- *       notice, this list of conditions and the following disclaimer.
- *     * Redistributions in binary form must reproduce the above

copyright

lib/librte_eal/linuxapp/eal/eal_debug.c line 23

Quoted 10 lines
lib/librte_eal/linuxapp/eal/eal_debug.c deleted +0 -10
- *       notice, this list of conditions and the following disclaimer in
- *       the documentation and/or other materials provided with the
- *       distribution.
- *     * Neither the name of Intel Corporation nor the names of its
- *       contributors may be used to endorse or promote products derived
- *       from this software without specific prior written permission.
- *
- *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS

FOR

lib/librte_eal/linuxapp/eal/eal_debug.c line 24

Quoted 1 line
lib/librte_eal/linuxapp/eal/eal_debug.c deleted +0 -1
- *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE

COPYRIGHT

lib/librte_eal/linuxapp/eal/eal_debug.c line 25

Quoted 1 line
lib/librte_eal/linuxapp/eal/eal_debug.c deleted +0 -1
- *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,

INCIDENTAL,

lib/librte_eal/linuxapp/eal/eal_debug.c line 27

Quoted 2 lines
lib/librte_eal/linuxapp/eal/eal_debug.c deleted +0 -2
- *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF

USE,

lib/librte_eal/linuxapp/eal/eal_debug.c line 28

Quoted 1 line
lib/librte_eal/linuxapp/eal/eal_debug.c deleted +0 -1
- *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON

ANY

lib/librte_eal/linuxapp/eal/eal_debug.c line 30

Quoted 2 lines
lib/librte_eal/linuxapp/eal/eal_debug.c deleted +0 -2
- *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE

USE

lib/librte_eal/linuxapp/eal/eal_debug.c line 31

Quoted 1 line
lib/librte_eal/linuxapp/eal/eal_debug.c deleted +0 -1
- *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH

DAMAGE.

Quoted 36 lines
lib/librte_eal/linuxapp/eal/eal_debug.c deleted +0 -36
- */
-
-#include <execinfo.h>
-#include <stdarg.h>
-#include <signal.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <stdint.h>
-
-#include <rte_log.h>
-#include <rte_debug.h>
-#include <rte_common.h>
-
-#define BACKTRACE_SIZE 256
-
-/* dump the stack of the calling core */
-void rte_dump_stack(void)
-{
-     void *func[BACKTRACE_SIZE];
-     char **symb = NULL;
-     int size;
-
-     size = backtrace(func, BACKTRACE_SIZE);
-     symb = backtrace_symbols(func, size);
-     while (size > 0) {
-             rte_log(RTE_LOG_ERR, RTE_LOGTYPE_EAL,
-                     "%d: [%s]\n", size, symb[size - 1]);
-             size --;
-     }
-}
-
-/* not implemented in this environment */
-void rte_dump_registers(void)
-{
-     return;
-}

lib/librte_eal/linuxapp/eal/eal_debug.c line 77

Quoted 10 lines
lib/librte_eal/linuxapp/eal/eal_debug.c deleted +0 -10
-
-/* call abort(), it will generate a coredump if enabled */
-void __rte_panic(const char *funcname, const char *format, ...)
-{
-     va_list ap;
-
-     /* disable history */
-     rte_log_set_history(0);
-
-     rte_log(RTE_LOG_CRIT, RTE_LOGTYPE_EAL, "PANIC in %s():\n",

funcname);

lib/librte_eal/linuxapp/eal/eal_debug.c line 87

Quoted 10 lines
lib/librte_eal/linuxapp/eal/eal_debug.c deleted +0 -10
-     va_start(ap, format);
-     rte_vlog(RTE_LOG_CRIT, RTE_LOGTYPE_EAL, format, ap);
-     va_end(ap);
-     rte_dump_stack();
-     rte_dump_registers();
-     abort();
-}
-
-/*
- * Like rte_panic this terminates the application. However, no

traceback is

Quoted 30 lines
lib/librte_eal/linuxapp/eal/eal_debug.c deleted +0 -27
- * provided and no core-dump is generated.
- */
-void
-rte_exit(int exit_code, const char *format, ...)
-{
-     va_list ap;
-
-     /* disable history */
-     rte_log_set_history(0);
-
-     if (exit_code != 0)
-             RTE_LOG(CRIT, EAL, "Error - exiting with code: %d\n"
-                             "  Cause: ", exit_code);
-
-     va_start(ap, format);
-     rte_vlog(RTE_LOG_CRIT, RTE_LOGTYPE_EAL, format, ap);
-     va_end(ap);
-
-#ifndef RTE_EAL_ALWAYS_PANIC_ON_ERROR
-     exit(exit_code);
-#else
-     rte_dump_stack();
-     rte_dump_registers();
-     abort();
-#endif
-}
--

1.9.1