From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id C0B5443D17; Thu, 21 Mar 2024 17:18:51 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id AD3A942E25; Thu, 21 Mar 2024 17:18:51 +0100 (CET) Received: from mail-oa1-f47.google.com (mail-oa1-f47.google.com [209.85.160.47]) by mails.dpdk.org (Postfix) with ESMTP id 46DE942DF5 for ; Thu, 21 Mar 2024 17:18:46 +0100 (CET) Received: by mail-oa1-f47.google.com with SMTP id 586e51a60fabf-22963f0e12cso558618fac.1 for ; Thu, 21 Mar 2024 09:18:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1711037925; x=1711642725; darn=dpdk.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=yzObJr6ChIwzux7DbvCuaGZqdyle5ax9Ncxqa7ENDn0=; b=rVCNHq5KvGJCsrw02nbZXTYDmvCbj3qpwRZsq2pxruxgahbce3RSzOTg4XUto1JL2I XB+R//lSI5kU9nC2opmA7bAauFPK0Q9iM4U3Q4HUX7/EN+Bf4TpktCEnqF5PQqHAWS5f cZRwa8OkjLjOKQY0d2lKiLTMXlypsj2d89my1RvfHWZpCLhW1THH/ZQvXjiircUr8W9R P6VgBI9kE92gzCwrgTq/kakJiQuNbkzCVyizuihAb1LEATZJAgdf5l5W9oQZrlUO+Oug i942FlCVaH9XW/JBcb/Knjp9oCJcOww5tBARa5UC46C9z4qaGzQHDE4uRX6vcapeJj77 ZYyA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711037925; x=1711642725; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=yzObJr6ChIwzux7DbvCuaGZqdyle5ax9Ncxqa7ENDn0=; b=eR+iwgEeU5kG1l2OAg0+AyZkYFaUcdg3P6jVn8RWj+N6mWbuTmZlKO7C+R+IkzTaVZ S7nW9Bib2DdBjJlcXRQbhtXvXejUVmFnO2j0DLNHJeRRSXI14xA9V9yxmU5HJoxSt7eg +L04NB321aX+4ym1eFNOnCaP6VM98o3Mi460j/7ioW/DHRjRq4tyQEcEl7SSyg0/VAZw Z53EC3OOP80xneK/lCu1DEU29pLMCkMClJCddC4GHjK0VMZtCQGVcLzMMg9D73KGDCH+ T9eU4m8NkJ+AWIS1eZO7rpBHIAbIw1xWL418pje0jvMyia8bCx+gD+/jgK6xUaBgWkRB nDrg== X-Gm-Message-State: AOJu0YzZ99ZN/vWexZ8vmbfIIsIk+Xv691H4NvTZzKtBWfPz9pUSSoZy U198ZVVlcHU1/4BMliKNZY9Yop9V/BR8DeRebTNwns5+3zSR2MIaWFH77qdcynoAtPjZzwhCtBe H X-Google-Smtp-Source: AGHT+IEsdB49fSUDvWcD7XDRMO2W8sUZKNSfdM+d86FSfRO1VqD/VKOrX34mG9lK+EotWozVC79Aew== X-Received: by 2002:a05:6a20:ba9c:b0:1a3:4e19:183c with SMTP id fb28-20020a056a20ba9c00b001a34e19183cmr6647454pzb.52.1711037519369; Thu, 21 Mar 2024 09:11:59 -0700 (PDT) Received: from hermes.local (204-195-123-203.wavecable.com. [204.195.123.203]) by smtp.gmail.com with ESMTPSA id w62-20020a638241000000b005e485fbd455sm41815pgd.45.2024.03.21.09.11.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Mar 2024 09:11:59 -0700 (PDT) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger Subject: [PATCH v10 04/10] eal: initialize log earlier in startup Date: Thu, 21 Mar 2024 09:00:20 -0700 Message-ID: <20240321161146.340421-5-stephen@networkplumber.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240321161146.340421-1-stephen@networkplumber.org> References: <20200814173441.23086-1-stephen@networkplumber.org> <20240321161146.340421-1-stephen@networkplumber.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Want to make sure that as many log messages as possible get added with the real log stream. Despite the comment, there is no dependency on memzones in current code. Signed-off-by: Stephen Hemminger --- lib/eal/freebsd/eal.c | 14 +++++++------- lib/eal/linux/eal.c | 16 ++++++++-------- lib/eal/unix/eal_unix_log.c | 0 lib/log/log_unix.c | 4 ++-- 4 files changed, 17 insertions(+), 17 deletions(-) create mode 100644 lib/eal/unix/eal_unix_log.c diff --git a/lib/eal/freebsd/eal.c b/lib/eal/freebsd/eal.c index 94927472edfe..777770176339 100644 --- a/lib/eal/freebsd/eal.c +++ b/lib/eal/freebsd/eal.c @@ -571,6 +571,13 @@ rte_eal_init(int argc, char **argv) /* set log level as early as possible */ eal_log_level_parse(argc, argv); + if (eal_log_init(getprogname(), internal_conf->syslog_facility) < 0) { + rte_eal_init_alert("Cannot init logging."); + rte_errno = ENOMEM; + rte_atomic_store_explicit(&run_once, 0, rte_memory_order_relaxed); + return -1; + } + if (rte_eal_cpu_init() < 0) { rte_eal_init_alert("Cannot detect lcores."); rte_errno = ENOTSUP; @@ -719,13 +726,6 @@ rte_eal_init(int argc, char **argv) #endif } - if (eal_log_init(getprogname(), internal_conf->syslog_facility) < 0) { - rte_eal_init_alert("Cannot init logging."); - rte_errno = ENOMEM; - rte_atomic_store_explicit(&run_once, 0, rte_memory_order_relaxed); - return -1; - } - /* in secondary processes, memory init may allocate additional fbarrays * not present in primary processes, so to avoid any potential issues, * initialize memzones first. diff --git a/lib/eal/linux/eal.c b/lib/eal/linux/eal.c index bffeb1f34eb9..e515f3cbc8a8 100644 --- a/lib/eal/linux/eal.c +++ b/lib/eal/linux/eal.c @@ -959,6 +959,14 @@ rte_eal_init(int argc, char **argv) /* clone argv to report out later in telemetry */ eal_save_args(argc, argv); + if (eal_log_init(program_invocation_short_name, + internal_conf->syslog_facility) < 0) { + rte_eal_init_alert("Cannot init logging."); + rte_errno = ENOMEM; + rte_atomic_store_explicit(&run_once, 0, rte_memory_order_relaxed); + return -1; + } + if (rte_eal_cpu_init() < 0) { rte_eal_init_alert("Cannot detect lcores."); rte_errno = ENOTSUP; @@ -1107,14 +1115,6 @@ rte_eal_init(int argc, char **argv) #endif } - if (eal_log_init(program_invocation_short_name, - internal_conf->syslog_facility) < 0) { - rte_eal_init_alert("Cannot init logging."); - rte_errno = ENOMEM; - rte_atomic_store_explicit(&run_once, 0, rte_memory_order_relaxed); - return -1; - } - #ifdef VFIO_PRESENT if (rte_eal_vfio_setup() < 0) { rte_eal_init_alert("Cannot init VFIO"); diff --git a/lib/eal/unix/eal_unix_log.c b/lib/eal/unix/eal_unix_log.c new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/lib/log/log_unix.c b/lib/log/log_unix.c index 2dfb0c974b1d..ae38b4bf3a59 100644 --- a/lib/log/log_unix.c +++ b/lib/log/log_unix.c @@ -41,8 +41,8 @@ static cookie_io_functions_t console_log_func = { }; /* - * set the log to default function, called during eal init process, - * once memzones are available. + * set the log to default function, called early in eal init process; + * before lcore's and memzones are setup. */ int eal_log_init(const char *id, int facility) -- 2.43.0