From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 618DFA3168 for ; Wed, 16 Oct 2019 09:42:15 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 158B31E8E9; Wed, 16 Oct 2019 09:42:15 +0200 (CEST) Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by dpdk.org (Postfix) with ESMTP id 3C59D1E8D1 for ; Wed, 16 Oct 2019 09:42:13 +0200 (CEST) Received: from mail-vk1-f198.google.com (mail-vk1-f198.google.com [209.85.221.198]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 920B2C057E9A for ; Wed, 16 Oct 2019 07:42:12 +0000 (UTC) Received: by mail-vk1-f198.google.com with SMTP id 70so9348150vkc.7 for ; Wed, 16 Oct 2019 00:42:12 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=4oxHtE8CFvg6mGzVmN4MTdsFJiHNyX7M8lS26PpJShk=; b=cPHJbCEaVihUSKA4PSfeJ9s1DMA1Xn/WAD9aNkWAjqZ65ge2L/ZM9TBKWM73I+mhjM TGtBHYX8278TmlyJPuzzXNgOnv1IYb+9jZQ2er0YxOn7kSql/zSu6T+Hn1xz93e2IuZR fXiC8Xem1KhcR6wqCanvFKaNwmrpUX9dQhOc2lvmVofQrMhy4k6czl0YERTPQ3VaPC+h +Wm4ZgfKPt7aJgr4ngQCmy+DBKFpF5AtzqXjE5PJYKN/esyQMROQREA+aTudCkXhdVAJ 9/helCQbEiftA0VslDdVpfFx4ddgZGdSNcbArahCQ2OTskcN+F3iAtjPIQ0Kf/rr7o0S DTqg== X-Gm-Message-State: APjAAAXYdQuShUuU+KCsnf/mjygnkuSInWeE3dNY3+GKJDFIlywiV5um 2RGJwl3L/NQ9fPpgH3Y/f0XS5dunVe9+Q2M/5yJlvk+HUgeA6EOEt5x5DWcGqGkDP4vYuNubcW0 8Jnes3tXfa4pyw+uII/4= X-Received: by 2002:a67:fa99:: with SMTP id f25mr23118vsq.141.1571211731828; Wed, 16 Oct 2019 00:42:11 -0700 (PDT) X-Google-Smtp-Source: APXvYqxwbuWpdoMa7jQaZ4S3qiH2VxiHW95RMO7xt9n2vjSe2egq5ncdUfZQ6qBTLFTQU2EKCAirz3A4Dvm4ictypF0= X-Received: by 2002:a67:fa99:: with SMTP id f25mr23107vsq.141.1571211731431; Wed, 16 Oct 2019 00:42:11 -0700 (PDT) MIME-Version: 1.0 References: <20190820233330.27474-1-stephen@networkplumber.org> <20190919133107.14147-1-stephen@networkplumber.org> In-Reply-To: <20190919133107.14147-1-stephen@networkplumber.org> From: David Marchand Date: Wed, 16 Oct 2019 09:42:00 +0200 Message-ID: To: Stephen Hemminger Cc: dev , Aaron Conole Content-Type: text/plain; charset="UTF-8" Subject: Re: [dpdk-dev] [PATCH v2] eal: don't call RTE_LOG before init X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On Thu, Sep 19, 2019 at 3:31 PM Stephen Hemminger wrote: > > rte_init_alert is called before rte_log is initialized. rte_eal_init_alert* > Therefore RTE_LOG() should not be used (only stderr). There should be nothing disastrous when calling RTE_LOG() before rte_eal_log_init has been called. RTE_LOG -> rte_vlog with rte_logs.file == default_log_stream == NULL => it should end up writing to stderr in such a case. And I understand this is the issue you wanted to fix because we write the same messages twice on stderr. > > For VFIO, it is initialized after rte_log_init therefore, > use RTE_LOG. What about all the other calls after the vfio setup step? Now with this change, they would only be passed to stderr even if the log subsystem is initialised. Can we have a "log initialised" boolean here and use it in rte_eal_init_alert? > > Signed-off-by: Stephen Hemminger > --- > lib/librte_eal/linux/eal/eal.c | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) > > diff --git a/lib/librte_eal/linux/eal/eal.c b/lib/librte_eal/linux/eal/eal.c > index 946222ccdb7a..6f54a8b2133f 100644 > --- a/lib/librte_eal/linux/eal/eal.c > +++ b/lib/librte_eal/linux/eal/eal.c > @@ -950,7 +950,6 @@ static int rte_eal_vfio_setup(void) > static void rte_eal_init_alert(const char *msg) > { > fprintf(stderr, "EAL: FATAL: %s\n", msg); > - RTE_LOG(ERR, EAL, "%s\n", msg); > } > > /* > @@ -1175,7 +1174,7 @@ rte_eal_init(int argc, char **argv) > > #ifdef VFIO_PRESENT > if (rte_eal_vfio_setup() < 0) { > - rte_eal_init_alert("Cannot init VFIO"); > + RTE_LOG(ERR, EAL, "Cannot init VFIO\n"); > rte_errno = EAGAIN; > rte_atomic32_clear(&run_once); > return -1; > -- > 2.17.1 > -- David Marchand