From patchwork Mon Aug 1 09:22:44 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steffen.Bauch@rohde-schwarz.com X-Patchwork-Id: 15068 Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [IPv6:::1]) by dpdk.org (Postfix) with ESMTP id 5A1172C0F; Mon, 1 Aug 2016 11:22:49 +0200 (CEST) Received: from mail02.rohde-schwarz.com (mail02.rohde-schwarz.com [80.246.32.97]) by dpdk.org (Postfix) with ESMTP id A12D52C0C for ; Mon, 1 Aug 2016 11:22:47 +0200 (CEST) Received: from amu316.rsint.net ([10.0.26.65]) by mail02.rohde-schwarz.com with ESMTP id 2016080111224612-60542 ; Mon, 1 Aug 2016 11:22:46 +0200 Received: from rus19.rsint.net ([10.0.33.19]) by amu316.rsint.net (Totemo SMTP Server) with SMTP ID 378 for ; Mon, 1 Aug 2016 11:22:45 +0200 (CEST) To: dev@dpdk.org MIME-Version: 1.0 X-KeepSent: EE6BE32D:2E238373-C1258002:0033706F; type=4; flags=0; name=$KeepSent X-Mailer: IBM Notes Release 9.0.1FP6 April 21, 2016 From: Steffen.Bauch@rohde-schwarz.com X-RUS_SENSITIVITY: 10 X-TNEFEvaluated: 1 Message-ID: Date: Mon, 1 Aug 2016 11:22:44 +0200 X-MIMETrack: Itemize by SMTP Server on RSSMTP02/RSSMTP at 01.08.2016 11:22:46, Serialize by Router on RSSMTP02/RSSMTP at 01.08.2016 11:22:46, Serialize complete at 01.08.2016 11:22:46 Subject: Re: [dpdk-dev] Application framework vs. library 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" @@ -99,8 +99,6 @@ rte_eal_log_init(const char *id, int facility) if (log_stream == NULL) return -1; - openlog(id, LOG_NDELAY | LOG_PID, facility); - if (rte_eal_common_log_init(log_stream) < 0) return -1; diff --git a/lib/librte_eal/linuxapp/eal/eal.c b/lib/librte_eal/linuxapp/eal/eal.c index bd770cf..f63f2f8 100644 --- a/lib/librte_eal/linuxapp/eal/eal.c +++ b/lib/librte_eal/linuxapp/eal/eal.c @@ -664,12 +664,6 @@ eal_check_mem_on_local_socket(void) "memory on local socket!\n"); } -static int -sync_func(__attribute__((unused)) void *arg) -{ - return 0; -} - inline static void rte_eal_mcfg_complete(void) { @@ -699,26 +693,17 @@ rte_eal_iopl_init(void) int rte_eal_init(int argc, char **argv) { - int i, fctret, ret; - pthread_t thread_id; - static rte_atomic32_t run_once = RTE_ATOMIC32_INIT(0); + int fctret; struct shared_driver *solib = NULL; const char *logid; - char cpuset[RTE_CPU_AFFINITY_STR_LEN]; - - if (!rte_atomic32_test_and_set(&run_once)) - return -1; - logid = strrchr(argv[0], '/'); - logid = strdup(logid ? logid + 1: argv[0]); - - thread_id = pthread_self(); + logid = NULL; if (rte_eal_log_early_init() < 0) - rte_panic("Cannot init early logs\n"); + return -1; if (rte_eal_cpu_init() < 0) - rte_panic("Cannot detect lcores\n"); + return -1; fctret = eal_parse_args(argc, argv); if (fctret < 0) @@ -731,7 +716,7 @@ rte_eal_init(int argc, char **argv) internal_config.process_type != RTE_PROC_SECONDARY && internal_config.xen_dom0_support == 0 && eal_hugepage_info_init() < 0) - rte_panic("Cannot get hugepage information\n"); + return -1; if (internal_config.memory == 0 && internal_config.force_sockets == 0) { if (internal_config.no_hugetlbfs) @@ -756,41 +741,43 @@ rte_eal_init(int argc, char **argv) rte_config_init(); if (rte_eal_pci_init() < 0) - rte_panic("Cannot init PCI\n"); + return -1; #ifdef RTE_LIBRTE_IVSHMEM if (rte_eal_ivshmem_init() < 0) - rte_panic("Cannot init IVSHMEM\n"); + return -1; #endif if (rte_eal_memory_init() < 0) - rte_panic("Cannot init memory\n"); + return -1; /* the directories are locked during eal_hugepage_info_init */ eal_hugedirs_unlock(); if (rte_eal_memzone_init() < 0) - rte_panic("Cannot init memzone\n"); + return -1; if (rte_eal_tailqs_init() < 0) - rte_panic("Cannot init tail queues for objects\n"); + return -1; #ifdef RTE_LIBRTE_IVSHMEM if (rte_eal_ivshmem_obj_init() < 0) - rte_panic("Cannot init IVSHMEM objects\n"); + return -1; #endif if (rte_eal_log_init(logid, internal_config.syslog_facility) < 0) - rte_panic("Cannot init logs\n"); + return -1; if (rte_eal_alarm_init() < 0) - rte_panic("Cannot init interrupt-handling thread\n"); + return -1; + /* interrupt handling will be initialized but the thread is patched to immediately exit */ if (rte_eal_intr_init() < 0) - rte_panic("Cannot init interrupt-handling thread\n"); + return -1; + /* timer stuff is initialized but hpet should be disabled in configuration */ if (rte_eal_timer_init() < 0) - rte_panic("Cannot init HPET or TSC timers\n"); + return -1; eal_check_mem_on_local_socket(); @@ -803,47 +790,12 @@ rte_eal_init(int argc, char **argv) RTE_LOG(WARNING, EAL, "%s\n", dlerror()); } - eal_thread_init_master(rte_config.master_lcore); - - ret = eal_thread_dump_affinity(cpuset, RTE_CPU_AFFINITY_STR_LEN); - - RTE_LOG(DEBUG, EAL, "Master lcore %u is ready (tid=%x;cpuset=[%s%s])\n", - rte_config.master_lcore, (int)thread_id, cpuset, - ret == 0 ? "" : "..."); - if (rte_eal_dev_init() < 0) - rte_panic("Cannot init pmd devices\n"); - - RTE_LCORE_FOREACH_SLAVE(i) { - - /* - * create communication pipes between master thread - * and children - */ - if (pipe(lcore_config[i].pipe_master2slave) < 0) - rte_panic("Cannot create pipe\n"); - if (pipe(lcore_config[i].pipe_slave2master) < 0) - rte_panic("Cannot create pipe\n"); - - lcore_config[i].state = WAIT; - - /* create a thread for each lcore */ - ret = pthread_create(&lcore_config[i].thread_id, NULL, - eal_thread_loop, NULL); - if (ret != 0) - rte_panic("Cannot create thread\n"); - } - - /* - * Launch a dummy function on all slave lcores, so that master lcore - * knows they are all ready when this function returns. - */ - rte_eal_mp_remote_launch(sync_func, NULL, SKIP_MASTER); - rte_eal_mp_wait_lcore(); + return -1; /* Probe & Initialize PCI devices */ if (rte_eal_pci_probe()) - rte_panic("Cannot probe PCI\n"); + return -1; return fctret; } diff --git a/lib/librte_eal/linuxapp/eal/eal_interrupts.c b/lib/librte_eal/linuxapp/eal/eal_interrupts.c index 66deda2..886e5e0 100644 --- a/lib/librte_eal/linuxapp/eal/eal_interrupts.c +++ b/lib/librte_eal/linuxapp/eal/eal_interrupts.c @@ -774,6 +774,9 @@ eal_intr_thread_main(__rte_unused void *arg) { struct epoll_event ev; + /* we do not need the interrupt handling and do not want the extra thread */ + pthread_exit((void*)0); + /* host thread, never break out */ for (;;) { /* build up the epoll fd with all descriptors we are to diff --git a/lib/librte_eal/linuxapp/eal/eal_log.c b/lib/librte_eal/linuxapp/eal/eal_log.c index 0b133c3..7c4d569 100644 --- a/lib/librte_eal/linuxapp/eal/eal_log.c +++ b/lib/librte_eal/linuxapp/eal/eal_log.c @@ -91,7 +91,7 @@ static cookie_io_functions_t console_log_func = { * once memzones are available. */ int -rte_eal_log_init(const char *id, int facility) +rte_eal_log_init(__attribute__((unused)) const char *id, __attribute__((unused)) int facility) { FILE *log_stream;