From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by dpdk.org (Postfix) with ESMTP id AB0285323 for ; Thu, 29 Jun 2017 13:23:47 +0200 (CEST) Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga104.jf.intel.com with ESMTP; 29 Jun 2017 04:23:47 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.40,280,1496127600"; d="scan'208";a="120290597" Received: from silpixa00398672.ir.intel.com ([10.237.223.128]) by fmsmga005.fm.intel.com with ESMTP; 29 Jun 2017 04:23:45 -0700 From: Harry van Haaren To: dev@dpdk.org Cc: jerin.jacob@caviumnetworks.com, thomas@monjalon.net, keith.wiles@intel.com, bruce.richardson@intel.com, Harry van Haaren Date: Thu, 29 Jun 2017 12:23:38 +0100 Message-Id: <1498735421-100164-3-git-send-email-harry.van.haaren@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1498735421-100164-1-git-send-email-harry.van.haaren@intel.com> References: <1498208779-166205-1-git-send-email-harry.van.haaren@intel.com> <1498735421-100164-1-git-send-email-harry.van.haaren@intel.com> Subject: [dpdk-dev] [PATCH v2 2/5] service cores: EAL init changes 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: , X-List-Received-Date: Thu, 29 Jun 2017 11:23:48 -0000 This commit shows the changes required in rte_eal_init() to transparently launch the service threads. The threads are launched into the service worker functions here because after rte_eal_init() the application is not gauranteed to call any other DPDK API. As the registration of services happens at initialization time, the services that require CPU time are already available when we reach the end of rte_eal_init(). Signed-off-by: Harry van Haaren --- v2 comments: - Include BSD implementation (Jerin) - Move details of core-tracking into rte_service_lcore_add(Jerin) - Given there are changes other to suggested, not using Ack --- lib/librte_eal/bsdapp/eal/eal.c | 22 ++++++++++++++++++++++ lib/librte_eal/linuxapp/eal/eal.c | 23 +++++++++++++++++++++++ 2 files changed, 45 insertions(+) diff --git a/lib/librte_eal/bsdapp/eal/eal.c b/lib/librte_eal/bsdapp/eal/eal.c index 05f0c1f..4f7dcb3 100644 --- a/lib/librte_eal/bsdapp/eal/eal.c +++ b/lib/librte_eal/bsdapp/eal/eal.c @@ -653,6 +653,17 @@ rte_eal_init(int argc, char **argv) rte_eal_mp_remote_launch(sync_func, NULL, SKIP_MASTER); rte_eal_mp_wait_lcore(); + /* initialize services first so vdevs can register during bus_probe. + * Ignore return value of already initialized, this means EAL parameter + * -s was used to set a service-core mask. + */ + ret = rte_service_init(); + if (ret) { + rte_eal_init_alert("rte_service_init() failed\n"); + rte_errno = ENOEXEC; + return -1; + } + /* Probe all the buses and devices/drivers on them */ if (rte_bus_probe()) { rte_eal_init_alert("Cannot probe devices\n"); @@ -660,6 +671,17 @@ rte_eal_init(int argc, char **argv) return -1; } + /* initialize default services configuration */ + uint32_t service_cores[RTE_MAX_LCORE]; + int count = rte_service_lcore_list(service_cores, RTE_MAX_LCORE); + for (i = 0; i < count; i++) + rte_service_lcore_start(service_cores[i]); + ret = rte_service_set_default_mapping(); + if (ret) { + rte_errno = ENOEXEC; + return -1; + } + rte_eal_mcfg_complete(); return fctret; diff --git a/lib/librte_eal/linuxapp/eal/eal.c b/lib/librte_eal/linuxapp/eal/eal.c index 7c78f2d..d63dd87 100644 --- a/lib/librte_eal/linuxapp/eal/eal.c +++ b/lib/librte_eal/linuxapp/eal/eal.c @@ -78,6 +78,7 @@ #include #include #include +#include #include "eal_private.h" #include "eal_thread.h" @@ -932,6 +933,17 @@ rte_eal_init(int argc, char **argv) rte_eal_mp_remote_launch(sync_func, NULL, SKIP_MASTER); rte_eal_mp_wait_lcore(); + /* initialize services first so vdevs can register during bus_probe. + * Ignore return value of already initialized, this means EAL parameter + * -s was used to set a service-core mask. + */ + ret = rte_service_init(); + if (ret) { + rte_eal_init_alert("rte_service_init() failed\n"); + rte_errno = ENOEXEC; + return -1; + } + /* Probe all the buses and devices/drivers on them */ if (rte_bus_probe()) { rte_eal_init_alert("Cannot probe devices\n"); @@ -939,6 +951,17 @@ rte_eal_init(int argc, char **argv) return -1; } + /* initialize default services configuration */ + uint32_t service_cores[RTE_MAX_LCORE]; + int count = rte_service_lcore_list(service_cores, RTE_MAX_LCORE); + for (i = 0; i < count; i++) + rte_service_lcore_start(service_cores[i]); + ret = rte_service_set_default_mapping(); + if (ret) { + rte_errno = ENOEXEC; + return -1; + } + rte_eal_mcfg_complete(); return fctret; -- 2.7.4