From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id 4A9AE2A9 for ; Tue, 2 Dec 2014 11:30:19 +0100 (CET) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga102.fm.intel.com with ESMTP; 02 Dec 2014 02:30:16 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.07,500,1413270000"; d="scan'208";a="631287442" Received: from bricha3-mobl3.ger.corp.intel.com ([10.243.20.11]) by fmsmga001.fm.intel.com with SMTP; 02 Dec 2014 02:21:00 -0800 Received: by (sSMTP sendmail emulation); Tue, 02 Dec 2014 10:20:58 +0025 Date: Tue, 2 Dec 2014 10:20:57 +0000 From: Bruce Richardson To: chixiaobo Message-ID: <20141202102057.GA9888@bricha3-MOBL3> References: <1417513268-6040-1-git-send-email-xiaobo.chi@nsn.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1417513268-6040-1-git-send-email-xiaobo.chi@nsn.com> Organization: Intel Shannon Ltd. User-Agent: Mutt/1.5.23 (2014-03-12) Cc: dev@dpdk.org Subject: Re: [dpdk-dev] [PATCH] add one option memory-only for those secondary PRBs 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, 02 Dec 2014 10:30:20 -0000 On Tue, Dec 02, 2014 at 05:41:08PM +0800, chixiaobo wrote: > --- > lib/librte_eal/common/eal_common_options.c | 18 +++- > lib/librte_eal/common/eal_internal_cfg.h | 1 + > lib/librte_eal/common/eal_options.h | 4 +- > lib/librte_eal/linuxapp/eal/eal.c | 137 +++++++++++++++-------------- > 4 files changed, 89 insertions(+), 71 deletions(-) > mode change 100644 => 100755 lib/librte_eal/common/eal_common_options.c > mode change 100644 => 100755 lib/librte_eal/common/eal_internal_cfg.h > mode change 100644 => 100755 lib/librte_eal/common/eal_options.h > mode change 100644 => 100755 lib/librte_eal/linuxapp/eal/eal.c > > diff --git a/lib/librte_eal/common/eal_common_options.c b/lib/librte_eal/common/eal_common_options.c > old mode 100644 > new mode 100755 > index e2810ab..5ab4b87 > diff --git a/lib/librte_eal/linuxapp/eal/eal.c b/lib/librte_eal/linuxapp/eal/eal.c > old mode 100644 > new mode 100755 > index 89f3b5e..a03e511 > --- a/lib/librte_eal/linuxapp/eal/eal.c > +++ b/lib/librte_eal/linuxapp/eal/eal.c > @@ -752,14 +752,16 @@ rte_eal_init(int argc, char **argv) > > rte_config_init(); > > - if (rte_eal_pci_init() < 0) > - rte_panic("Cannot init PCI\n"); > + /*with memory-only option, we need not cpu affinity, pci device, alarm, external devices, interrupt, etc. */ > + if( !internal_config.memory_only ){ > + if (rte_eal_pci_init() < 0) > + rte_panic("Cannot init PCI\n"); > > #ifdef RTE_LIBRTE_IVSHMEM > if (rte_eal_ivshmem_init() < 0) > rte_panic("Cannot init IVSHMEM\n"); > #endif > - > + } > if (rte_eal_memory_init() < 0) > rte_panic("Cannot init memory\n"); > > @@ -772,73 +774,73 @@ rte_eal_init(int argc, char **argv) > if (rte_eal_tailqs_init() < 0) > rte_panic("Cannot init tail queues for objects\n"); > At this point, I believe you are finished the initialization for the memory only case, so instead of adding all the rest of the content below to an "if" statement and indenting it further, I think it would be better to have a single short "if" statement here for "if (internal_config.memory_only) return" leaving the rest of the existing function unmodified. > -#ifdef RTE_LIBRTE_IVSHMEM > - if (rte_eal_ivshmem_obj_init() < 0) > - rte_panic("Cannot init IVSHMEM objects\n"); > -#endif > - > if (rte_eal_log_init(logid, internal_config.syslog_facility) < 0) > rte_panic("Cannot init logs\n"); > > - if (rte_eal_alarm_init() < 0) > - rte_panic("Cannot init interrupt-handling thread\n"); > - > - if (rte_eal_intr_init() < 0) > - rte_panic("Cannot init interrupt-handling thread\n"); > - > - if (rte_eal_timer_init() < 0) > - rte_panic("Cannot init HPET or TSC timers\n"); > - > - eal_check_mem_on_local_socket(); > - > - rte_eal_mcfg_complete(); > - > - TAILQ_FOREACH(solib, &solib_list, next) { > - RTE_LOG(INFO, EAL, "open shared lib %s\n", solib->name); > - solib->lib_handle = dlopen(solib->name, RTLD_NOW); > - if (solib->lib_handle == NULL) > - RTE_LOG(WARNING, EAL, "%s\n", dlerror()); > - } > - > - eal_thread_init_master(rte_config.master_lcore); > - > - RTE_LOG(DEBUG, EAL, "Master core %u is ready (tid=%x)\n", > - rte_config.master_lcore, (int)thread_id); > - > - 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(); > - > - /* Probe & Initialize PCI devices */ > - if (rte_eal_pci_probe()) > - rte_panic("Cannot probe PCI\n"); > - > + if( !internal_config.memory_only ){ > +#ifdef RTE_LIBRTE_IVSHMEM > + if (rte_eal_ivshmem_obj_init() < 0) > + rte_panic("Cannot init IVSHMEM objects\n"); > +#endif > + if (rte_eal_alarm_init() < 0) > + rte_panic("Cannot init interrupt-handling thread\n"); > + > + if (rte_eal_intr_init() < 0) > + rte_panic("Cannot init interrupt-handling thread\n"); > + > + if (rte_eal_timer_init() < 0) > + rte_panic("Cannot init HPET or TSC timers\n"); > + > + eal_check_mem_on_local_socket(); > + > + rte_eal_mcfg_complete(); > + > + TAILQ_FOREACH(solib, &solib_list, next) { > + RTE_LOG(INFO, EAL, "open shared lib %s\n", solib->name); > + solib->lib_handle = dlopen(solib->name, RTLD_NOW); > + if (solib->lib_handle == NULL) > + RTE_LOG(WARNING, EAL, "%s\n", dlerror()); > + } > + > + eal_thread_init_master(rte_config.master_lcore); > + > + RTE_LOG(DEBUG, EAL, "Master core %u is ready (tid=%x)\n", > + rte_config.master_lcore, (int)thread_id); > + > + 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(); > + > + /* Probe & Initialize PCI devices */ > + if (rte_eal_pci_probe()) > + rte_panic("Cannot probe PCI\n"); > + } > return fctret; > } > > @@ -859,3 +861,4 @@ int rte_eal_has_hugepages(void) > { > return ! internal_config.no_hugetlbfs; > } > + Extra blank line added - probably not intended. > -- > 1.9.4.msysgit.2 >