From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f45.google.com (mail-wm0-f45.google.com [74.125.82.45]) by dpdk.org (Postfix) with ESMTP id AD4F65699 for ; Tue, 11 Oct 2016 22:30:54 +0200 (CEST) Received: by mail-wm0-f45.google.com with SMTP id b201so8045728wmb.0 for ; Tue, 11 Oct 2016 13:30:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:user-agent:in-reply-to :references:mime-version:content-transfer-encoding; bh=20R3BBPd8VIOK2LpahmZpqPHO4xSZVRLo/EAYYHW2E8=; b=jlcXkOSk1ea4lfvYjMf8bHestIRgx3cICm8m2HoTcpINdIAnAGgqmayjoJqGkHo2Va wlQqQOBqbrhMXOxHsFjwCQwm9XHvWHXB1hcPYg8niW++VgEYZ64gOVDgLTixQas7t4u1 NfazrVgzVvQHlSWKaO14RuY9o+ag5SyMD4eqWCZ+IKwUSpt7B2umUX1cSE3rGHd544Vi 7uwZatp5IXnd8YGEW90OON4Mpy6JTfZ9TvJ3GlSYMmgsJtwSq6qaWX43DDcfWZdDwaNz jdTr5mZBrNuRi+HIn+0CERWUCfm6DerY/PZvawCqWyfYVzvGLX7UP3OtKtPQ4b1IiaBc hw0g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:user-agent :in-reply-to:references:mime-version:content-transfer-encoding; bh=20R3BBPd8VIOK2LpahmZpqPHO4xSZVRLo/EAYYHW2E8=; b=ZiYJbyPH9S1/7DOdKSdcbtsslI/6wd2rSNiTe1v5PGI3yl7d+MySWatnOlBMP4Ygyq 2CHKqFqJIXaV/BwHL8M7Zrsbhcb4GMvj12KUgqkVofTK7GYNi3rEf215aSRF4fJ+nlCB phz5a7DyyMJ1GjKOOfmApMjb8SnIqyfNu+X79NNbOSTOKCI/YUg8OuJ8p/2BC2LkYEww AHjHJoP2K/1YtesI/quk8nxfundwFxJkHALbHXtI5qd3P2ADRhqSQ3JKKzYQ24s4ouYv Q8oB6FIZ+mMugDvuhzWChTV686zEc8yB/BRZWpUOQWgGe6T6ErekwKgBGJ4gMIxjKMBk B+/Q== X-Gm-Message-State: AA6/9RnBlmM5H8woQKGdwMUOMBG3K/PRr69GksWsNZEi650D2of9Vuea3M1Tg2J6FR9MoimN X-Received: by 10.194.24.163 with SMTP id v3mr7046573wjf.180.1476217854361; Tue, 11 Oct 2016 13:30:54 -0700 (PDT) Received: from xps13.localnet (184.203.134.77.rev.sfr.net. [77.134.203.184]) by smtp.gmail.com with ESMTPSA id n65sm530242wmf.0.2016.10.11.13.30.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 11 Oct 2016 13:30:53 -0700 (PDT) From: Thomas Monjalon To: John Ousterhout Cc: dev@dpdk.org Date: Tue, 11 Oct 2016 22:30:52 +0200 Message-ID: <39898498.0kdAxWznnB@xps13> User-Agent: KMail/4.14.10 (Linux/4.5.4-1-ARCH; KDE/4.14.11; x86_64; ; ) In-Reply-To: References: <20160928204244.8288-1-ouster@cs.stanford.edu> <2532748.dRiGlJefCg@xps13> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Subject: Re: [dpdk-dev] [PATCH v2] log: respect rte_openlog_stream calls before rte_eal_init X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 11 Oct 2016 20:30:54 -0000 2016-10-11 09:30, John Ousterhout: > On Tue, Oct 11, 2016 at 1:08 AM, Thomas Monjalon > wrote: > > > > 2016-10-10 15:39, John Ousterhout: > > > ... > > > > > > Note: I see from the code that Linux and BSD set different default > streams: > > > Linux uses stdout, while BSD uses stderr. This patch retains the > distinction, > > > though I'm not sure why it is there. > > > > I don't know either. > > What is best between stdout and stderr for logs? > > I would guess that stdout makes more sense, since most log entries describe > normal operation, not errors. I'm happy to make these consistent, but this > would introduce a behavior change for BSD (which currently uses stderr); > would that be considered antisocial? No, that's OK to use stdout on BSD. > > > -int > > > -rte_eal_common_log_init(FILE *default_log) > > > +void > > > +rte_eal_log_set_default(FILE *default_log) > > > { > > > default_log_stream = default_log; > > > - rte_openlog_stream(default_log); > > > > > > #if RTE_LOG_LEVEL >= RTE_LOG_DEBUG > > > RTE_LOG(NOTICE, EAL, "Debug logs available - lower > performance\n"); > > > #endif > > > - > > > - return 0; > > > } > > > > Do we really need a function for that? > > Why not just initialize default_log_stream statically? > > Right now, different platforms have different defaults. BSD uses stderr > always. Linux starts out with stdout as the default, but later during > initialization it switches to a different default that logs messages both > to standard output and also to syslog. I don't have enough experience with > DPDK to know whether a single approach is really right for all systems (or > which approach it should be), and since I'm a DPDK newbie I thought it best > to take a more conservative approach and avoid behavioral changes. My > personal preference would be to minimize mission creep with this patch and > leave that behavior in place for someone with more expertise to deal with > later (and this issue is orthogonal to the main goal of the patch). But, if > unifying the log defaults is considered essential to the patch (and is > noncontroversial), I'm willing to implement it. OK sorry, I'm mixing things. 1/ When removing early log functions, you are replacing early init with a default set to stderr/stdout via rte_eal_log_set_default. I think you can just set statically to stdout: static FILE *default_log_stream = stdout; 2/ Yes, on Linux, a more complex stream with stdout + syslog is set. It is OK to use rte_eal_log_set_default for that usage. Note that there is a stream which is not used and can be removed in eal_private.h: extern FILE *eal_default_log_stream; Other note: rte_eal_log_set_default is not a public function so should be named eal_log_set_default. 3/ When calling rte_eal_log_set_default on BSD from rte_eal_log_init, you can keep stderr but an empty function would be better because it is not called and already set (to stderr or stdout if 1/). 4/ rte_eal_log_init can be called earlier to replace early init. 5/ It would be simpler to understand by splitting in two patches (remove early log + use non default log) I understand that you prefer to focus on your fix and I'm more or less suggesting a cleanup of logging. That's why I can do the first cleanup patch if you are really not confortable with it. (I feel you could do it) Just let me know.