From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lf0-f43.google.com (mail-lf0-f43.google.com [209.85.215.43]) by dpdk.org (Postfix) with ESMTP id 7237E2A07 for ; Tue, 11 Oct 2016 10:08:07 +0200 (CEST) Received: by mail-lf0-f43.google.com with SMTP id b81so28466247lfe.1 for ; Tue, 11 Oct 2016 01:08:07 -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=NYo6k4zr2S83L88GJ6uS9sO37V3JWzEarvRPktS2qxg=; b=DsqT1HDgZuuOgniJL/kIcbfg4e2/e52u/HcStIVu9l7TuKB8ruahV4otqSvmHjnHGa DuvtC3qMHp1yt1vtxpDQ8PtUHZ4FV+HGidWx7skq7V87hvHm4zHYlZRQ/FtSpQbZbxcP 1MQZ7r7AgU2gpxRruQCfu+2r0/YhnMRbVAr/aiKIlDLKFa7v2mHwuZSc7g9GIJjCaFCO VnRNnYLuYJS3xGXTUHkS2sgzdyPl1vHkvd5ocWdgtgpsVimZQ5u3EYt5J+bd8ouxY/4h 4utS0A0gUznrRHUh9oKd99OlGwJzieMIuXkQWrF32bxzDls35muj9b74O35GT/s5yUfC wskw== 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=NYo6k4zr2S83L88GJ6uS9sO37V3JWzEarvRPktS2qxg=; b=haXwgKQGw14oRfCsJWEdw/nev8KEJAzcuRKm8QyUaZ32Pmvx7mvzzyIqYMuxb5tU+4 Y2AWccam77cHcKaquN7lQU31Hk2/WCzjWyAg9aXSWaf6N6q1vATBdTstx86dqy+cFNbu LMotX04DowDSPJCxxNLnZC8uwRt7rXT7ukK7jZlyLkwKfZ0QxsohuccZmj3TYsa2D+rc tDI87KqJEu/9/Bi8QsFE9caN+uU/lEdHNq0alMOhFWxKiMNTXgDW3FCtXCZcgQjntTTP xv6wwQOYtuwcoKIGAF+JLbjcPUi7E2+E7cA8AaPQRC/pV/5yMtpF/hqhzFfdBsi6EQDP FdWg== X-Gm-Message-State: AA6/9RkxJN2EtTlLzUny3PzxioeQi57+qvYPKAuKGm+Ahg4EhM5P0y7iojyzRMxFi6sCK6Pu X-Received: by 10.25.21.12 with SMTP id l12mr1519541lfi.152.1476173285847; Tue, 11 Oct 2016 01:08:05 -0700 (PDT) Received: from xps13.localnet (184.203.134.77.rev.sfr.net. [77.134.203.184]) by smtp.gmail.com with ESMTPSA id h11sm432764ljh.15.2016.10.11.01.08.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 11 Oct 2016 01:08:05 -0700 (PDT) From: Thomas Monjalon To: John Ousterhout Cc: dev@dpdk.org Date: Tue, 11 Oct 2016 10:08:03 +0200 Message-ID: <2532748.dRiGlJefCg@xps13> User-Agent: KMail/4.14.10 (Linux/4.5.4-1-ARCH; KDE/4.14.11; x86_64; ; ) In-Reply-To: <20161010223933.5924-1-ouster@cs.stanford.edu> References: <20160928204244.8288-1-ouster@cs.stanford.edu> <20161010223933.5924-1-ouster@cs.stanford.edu> 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 08:08:07 -0000 2016-10-10 15:39, John Ousterhout: > Before this patch, application-specific loggers could not be > installed before rte_eal_init completed (the initialization process > called rte_openlog_stream, overwriting any previously installed > logger). This made it impossible for an application to capture the > initial log messages generated during rte_eal_init. This patch changes > initialization so that information from a previous call to > rte_openlog_stream is not lost. Specifically: > * The default log stream is now maintained separately from an > application-specific log stream installed with rte_openlog_stream. > * rte_eal_common_log_init has been renamed to rte_eal_log_set_default, > since this is all it does. It no longer invokes rte_openlog_stream; it > just updates the default stream. Also, this method now returns void, > rather than int, since there are no errors. > * The "early log" mechanism (e.g. rte_eal_log_early_init) has been > removed; all of the desired functionality can be achieved by calling > rte_eal_log_set_default. > > Signed-off-by: John Ousterhout > ---- > v2: > * Removed the early log mechanism, renamed rte_eal_common_log_init. > > 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? [...] > -int > -rte_eal_log_early_init(void) > -{ > - rte_openlog_stream(stderr); > - return 0; > + rte_eal_set_default(stderr); It should be rte_eal_log_set_default. [...] > /* > - * called by environment-specific log init function > + * Called by environment-specific initialization functions. > */ > -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? [...] > /** > - * Common log initialization function (private to eal). > + * Common log initialization function (private to eal). Determines > + * where log data is written when no call to eal_openlog_stream is > + * in effect. It should be rte_openlog_stream.