DPDK patches and discussions
 help / color / mirror / Atom feed
From: talshn@mellanox.com
To: dev@dpdk.org
Cc: thomas@monjalon.net, pallavi.kadam@intel.com,
	dmitry.kozliuk@gmail.com, david.marchand@redhat.com,
	ranjit.menon@intel.com, navasile@linux.microsoft.com,
	harini.ramakrishnan@microsoft.com, ocardona@microsoft.com,
	bruce.richardson@intel.com, Tal Shnaiderman <talshn@mellanox.com>
Subject: [dpdk-dev] [PATCH v3 1/2] eal: move OS common debug functions to single file
Date: Tue, 23 Jun 2020 23:57:20 +0300
Message-ID: <20200623205721.21200-2-talshn@mellanox.com> (raw)
In-Reply-To: <20200623205721.21200-1-talshn@mellanox.com>

From: Tal Shnaiderman <talshn@mellanox.com>

Move common functions between Unix and Windows to eal_common_debug.c.

Those functions are rte_exit, __rte_panic and rte_dump_registers
which has the same implementation on Unix and Windows.

Signed-off-by: Tal Shnaiderman <talshn@mellanox.com>
---
 lib/librte_eal/common/eal_common_debug.c | 59 ++++++++++++++++++++++++++++++++
 lib/librte_eal/common/meson.build        |  1 +
 lib/librte_eal/freebsd/Makefile          |  1 +
 lib/librte_eal/freebsd/eal_debug.c       | 49 --------------------------
 lib/librte_eal/linux/Makefile            |  1 +
 lib/librte_eal/linux/eal_debug.c         | 49 --------------------------
 6 files changed, 62 insertions(+), 98 deletions(-)
 create mode 100644 lib/librte_eal/common/eal_common_debug.c

diff --git a/lib/librte_eal/common/eal_common_debug.c b/lib/librte_eal/common/eal_common_debug.c
new file mode 100644
index 0000000000..722468754d
--- /dev/null
+++ b/lib/librte_eal/common/eal_common_debug.c
@@ -0,0 +1,59 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2010-2014 Intel Corporation
+ */
+
+#include <stdarg.h>
+#include <rte_eal.h>
+#include <rte_log.h>
+#include <rte_debug.h>
+
+/* not implemented */
+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;
+
+	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;
+
+	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
+	if (rte_eal_cleanup() != 0)
+		RTE_LOG(CRIT, EAL,
+			"EAL could not release all resources\n");
+	exit(exit_code);
+#else
+	rte_dump_stack();
+	rte_dump_registers();
+	abort();
+#endif
+}
diff --git a/lib/librte_eal/common/meson.build b/lib/librte_eal/common/meson.build
index 4bdf77922f..02e5d28d45 100644
--- a/lib/librte_eal/common/meson.build
+++ b/lib/librte_eal/common/meson.build
@@ -35,6 +35,7 @@ sources += files(
 	'eal_common_bus.c',
 	'eal_common_cpuflags.c',
 	'eal_common_class.c',
+	'eal_common_debug.c',
 	'eal_common_devargs.c',
 	'eal_common_dev.c',
 	'eal_common_errno.c',
diff --git a/lib/librte_eal/freebsd/Makefile b/lib/librte_eal/freebsd/Makefile
index d18c00eeae..9988ea5b48 100644
--- a/lib/librte_eal/freebsd/Makefile
+++ b/lib/librte_eal/freebsd/Makefile
@@ -52,6 +52,7 @@ SRCS-$(CONFIG_RTE_EXEC_ENV_FREEBSD) += eal_common_cpuflags.c
 SRCS-$(CONFIG_RTE_EXEC_ENV_FREEBSD) += eal_common_hypervisor.c
 SRCS-$(CONFIG_RTE_EXEC_ENV_FREEBSD) += eal_common_string_fns.c
 SRCS-$(CONFIG_RTE_EXEC_ENV_FREEBSD) += eal_common_hexdump.c
+SRCS-$(CONFIG_RTE_EXEC_ENV_FREEBSD) += eal_common_debug.c
 SRCS-$(CONFIG_RTE_EXEC_ENV_FREEBSD) += eal_common_devargs.c
 SRCS-$(CONFIG_RTE_EXEC_ENV_FREEBSD) += eal_common_class.c
 SRCS-$(CONFIG_RTE_EXEC_ENV_FREEBSD) += eal_common_bus.c
diff --git a/lib/librte_eal/freebsd/eal_debug.c b/lib/librte_eal/freebsd/eal_debug.c
index 5d92500bf5..64dab4e0da 100644
--- a/lib/librte_eal/freebsd/eal_debug.c
+++ b/lib/librte_eal/freebsd/eal_debug.c
@@ -41,52 +41,3 @@ void rte_dump_stack(void)
 	free(symb);
 #endif /* RTE_BACKTRACE */
 }
-
-/* 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;
-
-	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;
-
-	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
-	if (rte_eal_cleanup() != 0)
-		RTE_LOG(CRIT, EAL,
-			"EAL could not release all resources\n");
-	exit(exit_code);
-#else
-	rte_dump_stack();
-	rte_dump_registers();
-	abort();
-#endif
-}
diff --git a/lib/librte_eal/linux/Makefile b/lib/librte_eal/linux/Makefile
index 5d97073ed2..180fc51984 100644
--- a/lib/librte_eal/linux/Makefile
+++ b/lib/librte_eal/linux/Makefile
@@ -60,6 +60,7 @@ SRCS-$(CONFIG_RTE_EXEC_ENV_LINUX) += eal_common_cpuflags.c
 SRCS-$(CONFIG_RTE_EXEC_ENV_LINUX) += eal_common_hypervisor.c
 SRCS-$(CONFIG_RTE_EXEC_ENV_LINUX) += eal_common_string_fns.c
 SRCS-$(CONFIG_RTE_EXEC_ENV_LINUX) += eal_common_hexdump.c
+SRCS-$(CONFIG_RTE_EXEC_ENV_LINUX) += eal_common_debug.c
 SRCS-$(CONFIG_RTE_EXEC_ENV_LINUX) += eal_common_devargs.c
 SRCS-$(CONFIG_RTE_EXEC_ENV_LINUX) += eal_common_class.c
 SRCS-$(CONFIG_RTE_EXEC_ENV_LINUX) += eal_common_bus.c
diff --git a/lib/librte_eal/linux/eal_debug.c b/lib/librte_eal/linux/eal_debug.c
index 5d92500bf5..64dab4e0da 100644
--- a/lib/librte_eal/linux/eal_debug.c
+++ b/lib/librte_eal/linux/eal_debug.c
@@ -41,52 +41,3 @@ void rte_dump_stack(void)
 	free(symb);
 #endif /* RTE_BACKTRACE */
 }
-
-/* 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;
-
-	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;
-
-	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
-	if (rte_eal_cleanup() != 0)
-		RTE_LOG(CRIT, EAL,
-			"EAL could not release all resources\n");
-	exit(exit_code);
-#else
-	rte_dump_stack();
-	rte_dump_registers();
-	abort();
-#endif
-}
-- 
2.16.1.windows.4


  reply	other threads:[~2020-06-23 20:58 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-08  8:32 [dpdk-dev] [PATCH v2 0/2] Support EAL debug functions on Windows talshn
2020-06-08  8:32 ` [dpdk-dev] [PATCH v2 1/2] eal: move OS common debug functions to single file talshn
2020-06-23 17:46   ` Thomas Monjalon
2020-06-23 20:57   ` [dpdk-dev] [PATCH v3 0/2] Support EAL debug functions on Windows talshn
2020-06-23 20:57     ` talshn [this message]
2020-06-23 20:57     ` [dpdk-dev] [PATCH v3 2/2] eal/windows: support debug calls talshn
2020-06-23 22:48     ` [dpdk-dev] [PATCH v3 0/2] Support EAL debug functions on Windows Dmitry Kozlyuk
2020-06-24  9:17       ` Thomas Monjalon
2020-06-08  8:32 ` [dpdk-dev] [PATCH v2 2/2] eal/windows: support debug calls talshn

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200623205721.21200-2-talshn@mellanox.com \
    --to=talshn@mellanox.com \
    --cc=bruce.richardson@intel.com \
    --cc=david.marchand@redhat.com \
    --cc=dev@dpdk.org \
    --cc=dmitry.kozliuk@gmail.com \
    --cc=harini.ramakrishnan@microsoft.com \
    --cc=navasile@linux.microsoft.com \
    --cc=ocardona@microsoft.com \
    --cc=pallavi.kadam@intel.com \
    --cc=ranjit.menon@intel.com \
    --cc=thomas@monjalon.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

DPDK patches and discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://inbox.dpdk.org/dev/0 dev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 dev dev/ https://inbox.dpdk.org/dev \
		dev@dpdk.org
	public-inbox-index dev

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.dev


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git