Skip to contentSkip to conversation

rte: initialize logging before bus

PATCH Superseded Stephen Hemminger 2 participants 3 messages Aug 28, 2017 – Oct 3, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 rte: initialize logging before bus

Any log messages during bus initialization maybeZZ lost because the bus registration constructor is called befor the logging constructor.

Fixes a97725791eec ("bus: introduce bus abstraction")

---
Patch against current but also should be applied to stable.

 lib/librte_eal/common/eal_common_log.c  | 3 ++-
 lib/librte_eal/common/include/rte_bus.h | 2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)
lib/librte_eal/common/eal_common_log.c +2 -1
index 0e3b9320954f..b62b0a6d61c8 100644
@@ -289,7 +289,8 @@ static const struct logtype logtype_strings[] = {
 	{RTE_LOGTYPE_USER8,      "user8"}
 };
 
-RTE_INIT(rte_log_init);
+/* Logging should be first initialzer (before drivers and bus) */
+RTE_INIT_PRIO(rte_log_init, 101);
 static void
 rte_log_init(void)
 {
lib/librte_eal/common/include/rte_bus.h +1 -1
index c79368d3c882..8f8b09954abc 100644
@@ -285,7 +285,7 @@ struct rte_bus *rte_bus_find_by_name(const char *busname);
  * The constructor has higher priority than PMD constructors.
  */
 #define RTE_REGISTER_BUS(nm, bus) \
-RTE_INIT_PRIO(businitfn_ ##nm, 101); \
+RTE_INIT_PRIO(businitfn_ ##nm, 110); \
 static void businitfn_ ##nm(void) \
 {\
 	(bus).name = RTE_STR(nm);\
Signature · 1 line
2.11.0
#1 lore raw

PATCH v2 1/1 rte: initialize logging before bus

Any log messages during bus initialization maybe lost because the bus registration constructor is called before the logging constructor.

Fixes a97725791eec ("bus: introduce bus abstraction")

---
v2 - fix commit message typos

 lib/librte_eal/common/eal_common_log.c  | 3 ++-
 lib/librte_eal/common/include/rte_bus.h | 2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)
lib/librte_eal/common/eal_common_log.c +2 -1
index 0e3b9320954f..b62b0a6d61c8 100644
@@ -289,7 +289,8 @@ static const struct logtype logtype_strings[] = {
 	{RTE_LOGTYPE_USER8,      "user8"}
 };
 
-RTE_INIT(rte_log_init);
+/* Logging should be first initialzer (before drivers and bus) */
+RTE_INIT_PRIO(rte_log_init, 101);
 static void
 rte_log_init(void)
 {
lib/librte_eal/common/include/rte_bus.h +1 -1
index c79368d3c882..8f8b09954abc 100644
@@ -285,7 +285,7 @@ struct rte_bus *rte_bus_find_by_name(const char *busname);
  * The constructor has higher priority than PMD constructors.
  */
 #define RTE_REGISTER_BUS(nm, bus) \
-RTE_INIT_PRIO(businitfn_ ##nm, 101); \
+RTE_INIT_PRIO(businitfn_ ##nm, 110); \
 static void businitfn_ ##nm(void) \
 {\
 	(bus).name = RTE_STR(nm);\
Signature · 1 line
2.11.0
#2 lore raw

28/08/2017 20:13, Stephen Hemminger:

Quoted 4 lines

Any log messages during bus initialization maybe lost because the bus registration constructor is called before the logging constructor.

Fixes a97725791eec ("bus: introduce bus abstraction")
Quoted 1 line

Applied, thanks