diff options
| author | Stephen Hemminger <[email protected]> | 2024-10-27 10:24:38 -0700 |
|---|---|---|
| committer | David Marchand <[email protected]> | 2024-11-08 18:08:35 +0100 |
| commit | 2773d39ffee46f66fd628cebdd401d89fce09f1f (patch) | |
| tree | c92e6d8f9a8214cb257f03f25fecb6cd21fd14c9 /lib | |
| parent | 985130369be32dd68ca104c1ccc86716f6e2bb7b (diff) | |
eal: initialize log before everything else
In order for all log messages (including CPU mismatch) to come out
through the logging library, it must be initialized as early
in rte_eal_init() as possible on all platforms.
Where it was done before was likely historical, based on the support
of non-OS isolated CPU's which required a shared memory buffer.
That support was dropped before DPDK was publicly released.
Signed-off-by: Stephen Hemminger <[email protected]>
Acked-by: Tyler Retzlaff <[email protected]>
Acked-by: Morten Brørup <[email protected]>
Acked-by: Bruce Richardson <[email protected]>
Acked-by: Chengwen Feng <[email protected]>
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/eal/freebsd/eal.c | 13 | ||||
| -rw-r--r-- | lib/eal/linux/eal.c | 14 | ||||
| -rw-r--r-- | lib/eal/windows/eal.c | 10 |
3 files changed, 26 insertions, 11 deletions
diff --git a/lib/eal/freebsd/eal.c b/lib/eal/freebsd/eal.c index e7fd4f141e..a96bbf5836 100644 --- a/lib/eal/freebsd/eal.c +++ b/lib/eal/freebsd/eal.c @@ -53,6 +53,7 @@ #include "eal_options.h" #include "eal_memcfg.h" #include "eal_trace.h" +#include "log_internal.h" #define MEMSIZE_IF_NO_HUGE_PAGE (64ULL * 1024ULL * 1024ULL) @@ -547,6 +548,15 @@ rte_eal_init(int argc, char **argv) bool has_phys_addr; enum rte_iova_mode iova_mode; + /* setup log as early as possible */ + if (eal_parse_log_options(argc, argv) < 0) { + rte_eal_init_alert("invalid log arguments."); + rte_errno = EINVAL; + return -1; + } + + eal_log_init(getprogname()); + /* checks if the machine is adequate */ if (!rte_cpu_is_supported()) { rte_eal_init_alert("unsupported cpu type."); @@ -573,9 +583,6 @@ rte_eal_init(int argc, char **argv) /* clone argv to report out later in telemetry */ eal_save_args(argc, argv); - /* parse log options as early as possible */ - eal_parse_log_options(argc, argv); - if (rte_eal_cpu_init() < 0) { rte_eal_init_alert("Cannot detect lcores."); rte_errno = ENOTSUP; diff --git a/lib/eal/linux/eal.c b/lib/eal/linux/eal.c index c321ea87f3..a6220524a4 100644 --- a/lib/eal/linux/eal.c +++ b/lib/eal/linux/eal.c @@ -927,6 +927,15 @@ rte_eal_init(int argc, char **argv) struct internal_config *internal_conf = eal_get_internal_configuration(); + /* setup log as early as possible */ + if (eal_parse_log_options(argc, argv) < 0) { + rte_eal_init_alert("invalid log arguments."); + rte_errno = EINVAL; + return -1; + } + + eal_log_init(program_invocation_short_name); + /* checks if the machine is adequate */ if (!rte_cpu_is_supported()) { rte_eal_init_alert("unsupported cpu type."); @@ -950,9 +959,6 @@ rte_eal_init(int argc, char **argv) eal_reset_internal_config(internal_conf); - /* parse log options as early as possible */ - eal_parse_log_options(argc, argv); - /* clone argv to report out later in telemetry */ eal_save_args(argc, argv); @@ -1104,8 +1110,6 @@ rte_eal_init(int argc, char **argv) #endif } - eal_log_init(program_invocation_short_name); - #ifdef VFIO_PRESENT if (rte_vfio_enable("vfio")) { rte_eal_init_alert("Cannot init VFIO"); diff --git a/lib/eal/windows/eal.c b/lib/eal/windows/eal.c index b948c52670..5cdc053a02 100644 --- a/lib/eal/windows/eal.c +++ b/lib/eal/windows/eal.c @@ -251,10 +251,14 @@ rte_eal_init(int argc, char **argv) char cpuset[RTE_CPU_AFFINITY_STR_LEN]; char thread_name[RTE_THREAD_NAME_SIZE]; - eal_log_init(NULL); + /* setup log as early as possible */ + if (eal_parse_log_options(argc, argv) < 0) { + rte_eal_init_alert("invalid log arguments."); + rte_errno = EINVAL; + return -1; + } - /* parse log options as early as possible */ - eal_parse_log_options(argc, argv); + eal_log_init(NULL); if (eal_create_cpu_map() < 0) { rte_eal_init_alert("Cannot discover CPU and NUMA."); |
