[v10,04/10] eal: initialize log earlier in startup
Checks
Commit Message
Want to make sure that as many log messages as possible
get added with the real log stream. Despite the comment,
there is no dependency on memzones in current code.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
lib/eal/freebsd/eal.c | 14 +++++++-------
lib/eal/linux/eal.c | 16 ++++++++--------
lib/eal/unix/eal_unix_log.c | 0
lib/log/log_unix.c | 4 ++--
4 files changed, 17 insertions(+), 17 deletions(-)
create mode 100644 lib/eal/unix/eal_unix_log.c
@@ -571,6 +571,13 @@ rte_eal_init(int argc, char **argv)
/* set log level as early as possible */
eal_log_level_parse(argc, argv);
+ if (eal_log_init(getprogname(), internal_conf->syslog_facility) < 0) {
+ rte_eal_init_alert("Cannot init logging.");
+ rte_errno = ENOMEM;
+ rte_atomic_store_explicit(&run_once, 0, rte_memory_order_relaxed);
+ return -1;
+ }
+
if (rte_eal_cpu_init() < 0) {
rte_eal_init_alert("Cannot detect lcores.");
rte_errno = ENOTSUP;
@@ -719,13 +726,6 @@ rte_eal_init(int argc, char **argv)
#endif
}
- if (eal_log_init(getprogname(), internal_conf->syslog_facility) < 0) {
- rte_eal_init_alert("Cannot init logging.");
- rte_errno = ENOMEM;
- rte_atomic_store_explicit(&run_once, 0, rte_memory_order_relaxed);
- return -1;
- }
-
/* in secondary processes, memory init may allocate additional fbarrays
* not present in primary processes, so to avoid any potential issues,
* initialize memzones first.
@@ -959,6 +959,14 @@ rte_eal_init(int argc, char **argv)
/* clone argv to report out later in telemetry */
eal_save_args(argc, argv);
+ if (eal_log_init(program_invocation_short_name,
+ internal_conf->syslog_facility) < 0) {
+ rte_eal_init_alert("Cannot init logging.");
+ rte_errno = ENOMEM;
+ rte_atomic_store_explicit(&run_once, 0, rte_memory_order_relaxed);
+ return -1;
+ }
+
if (rte_eal_cpu_init() < 0) {
rte_eal_init_alert("Cannot detect lcores.");
rte_errno = ENOTSUP;
@@ -1107,14 +1115,6 @@ rte_eal_init(int argc, char **argv)
#endif
}
- if (eal_log_init(program_invocation_short_name,
- internal_conf->syslog_facility) < 0) {
- rte_eal_init_alert("Cannot init logging.");
- rte_errno = ENOMEM;
- rte_atomic_store_explicit(&run_once, 0, rte_memory_order_relaxed);
- return -1;
- }
-
#ifdef VFIO_PRESENT
if (rte_eal_vfio_setup() < 0) {
rte_eal_init_alert("Cannot init VFIO");
new file mode 100644
@@ -41,8 +41,8 @@ static cookie_io_functions_t console_log_func = {
};
/*
- * set the log to default function, called during eal init process,
- * once memzones are available.
+ * set the log to default function, called early in eal init process;
+ * before lcore's and memzones are setup.
*/
int
eal_log_init(const char *id, int facility)