From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <stephen@networkplumber.org>
Received: from mail-pg0-f41.google.com (mail-pg0-f41.google.com [74.125.83.41])
 by dpdk.org (Postfix) with ESMTP id E8DFE11F5
 for <dev@dpdk.org>; Mon, 28 Aug 2017 19:57:07 +0200 (CEST)
Received: by mail-pg0-f41.google.com with SMTP id 63so3504641pgc.2
 for <dev@dpdk.org>; Mon, 28 Aug 2017 10:57:07 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=networkplumber-org.20150623.gappssmtp.com; s=20150623;
 h=from:to:cc:subject:date:message-id;
 bh=IJEPSoArl5cslPr3dzkSF2dGhlGeoOTHGf9hmIv/IcU=;
 b=TbCfEk09fzKVXs1Y3nkzh1yNvoEmulgmcYzYj74Eqs+x86TEPmrPZ/2EJLBojXwn85
 6PHE35xIaSTt5ysFcHmz1UwDA7QxMz50CEOIoKcmMvm2q+K1Vqg+taffhbzh7VR1Rnk2
 pt8OdXu72+YT55A4kosSmt/pMbLiHZ0aHiuMLCZyaP6kMBjLy1fA/TfPBgV5pGOYQc8O
 Gncoj7qc7/oDpgNFGycT98Q2gdEii/3vXrZ1rSyuWn8tPnFHLHyuQ01r6VgXdrjdGojz
 bL9s3BShAMZH+wfLUtBn0PbXNDhJkGlwqRkMVLDCeemoHP/L+dTLszIQ32jrFQzVpBxv
 /oFw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:cc:subject:date:message-id;
 bh=IJEPSoArl5cslPr3dzkSF2dGhlGeoOTHGf9hmIv/IcU=;
 b=ZayIoa2PoGAF2fSxv8Y3agImGo+tZDKlIHPjJh/MiKGsKxPQQgm9VBJO8ybg5on5AV
 4p2WfC99dnZLW/pkdzarqscZX2POMwQbLP49FIqTlqnaGZAxzD03NaJ7h0iHFEyoAZ9y
 htSO3kejhz17YJbat7vG4u5PvWsKD5l3zvztk7QdgySzLXDXqN8bg+g092NiX/wL6qQP
 Grnl2utsMqdgbxHCNjYmPcvfLCigDqs1EmlMKXd/h5EVVFLcsCCfeDkAeUSkc/sPd5fT
 srDD4XUG6eYy9HqQZp+E+quNdJwzSn2AcdhOv0lkdZBClENKq3SstgrUVg+RJ+OgpMFW
 9BJA==
X-Gm-Message-State: AHYfb5g8ZrFeRk/z6UZP6lmQCKZdtOw73bG1/VXSignFwY14p9u4d0Vk
 a53bMjW4nKGvymxx0RFXiQ==
X-Received: by 10.84.231.196 with SMTP id g4mr1734543pln.34.1503943026885;
 Mon, 28 Aug 2017 10:57:06 -0700 (PDT)
Received: from xeon-e3.lan (76-14-207-240.or.wavecable.com. [76.14.207.240])
 by smtp.gmail.com with ESMTPSA id w26sm1735762pgc.18.2017.08.28.10.57.05
 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
 Mon, 28 Aug 2017 10:57:05 -0700 (PDT)
From: Stephen Hemminger <stephen@networkplumber.org>
To: dev@dpdk.org
Cc: Stephen Hemminger <stephen@networkplumber.org>,
 Stephen Hemminger <sthemmin@microsoft.com>
Date: Mon, 28 Aug 2017 10:57:03 -0700
Message-Id: <20170828175703.5746-1-stephen@networkplumber.org>
X-Mailer: git-send-email 2.11.0
Subject: [dpdk-dev] [PATCH] rte: initialize logging before bus
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <http://dpdk.org/ml/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://dpdk.org/ml/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <http://dpdk.org/ml/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Mon, 28 Aug 2017 17:57:08 -0000

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")
Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com>
---
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(-)

diff --git a/lib/librte_eal/common/eal_common_log.c b/lib/librte_eal/common/eal_common_log.c
index 0e3b9320954f..b62b0a6d61c8 100644
--- a/lib/librte_eal/common/eal_common_log.c
+++ b/lib/librte_eal/common/eal_common_log.c
@@ -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)
 {
diff --git a/lib/librte_eal/common/include/rte_bus.h b/lib/librte_eal/common/include/rte_bus.h
index c79368d3c882..8f8b09954abc 100644
--- a/lib/librte_eal/common/include/rte_bus.h
+++ b/lib/librte_eal/common/include/rte_bus.h
@@ -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);\
-- 
2.11.0