From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from demumfd001.nsn-inter.net (demumfd001.nsn-inter.net [93.183.12.32]) by dpdk.org (Postfix) with ESMTP id DCA1D559C for ; Wed, 3 Dec 2014 11:12:00 +0100 (CET) Received: from demuprx017.emea.nsn-intra.net ([10.150.129.56]) by demumfd001.nsn-inter.net (8.14.3/8.14.3) with ESMTP id sB3AC0Z0015489 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 3 Dec 2014 10:12:00 GMT Received: from localhost ([10.140.132.233]) by demuprx017.emea.nsn-intra.net (8.12.11.20060308/8.12.11) with ESMTP id sB3ABwxC017110; Wed, 3 Dec 2014 11:11:59 +0100 From: chixiaobo To: dev@dpdk.org Date: Wed, 3 Dec 2014 18:11:58 +0800 Message-Id: <1417601518-16852-1-git-send-email-xiaobo.chi@nsn.com> X-Mailer: git-send-email 1.9.4.msysgit.2 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-purgate-type: clean X-purgate-Ad: Categorized by eleven eXpurgate (R) http://www.eleven.de X-purgate: clean X-purgate: This mail is considered clean (visit http://www.eleven.de for further information) X-purgate-size: 7064 X-purgate-ID: 151667::1417601520-0000658F-71B6D3AF/0/0 Subject: [dpdk-dev] [PATCH v2] add one option memory-only for secondary processes 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: Wed, 03 Dec 2014 10:12:01 -0000 From: Chi Xiaobo Problem: There is one normal DPDK processes deployment scenarios: one primary process and several (even hundreds) secondary processes; all outside packets/messages are sent/received by primary process and then distribute them to those secondary processes by DPDK's ring/sharedmemory mechanism. In such scenarios, those SECONDARY processes need only hugepage based sharememory mechanism and it?¡¥s upper libs (such as ring, mempool, etc.), they need not cpu core pinning, iopl privilege changing , pci device, timer, alarm, interrupt, shared_driver_list, core_info, threads for each core, etc. Then, for such kind of SECONDARY processes, the current rte_eal_init() is too heavy. Solution:One new EAL initializing argument, --memory-only, is added. It is only for those SECONDARY processes which only want to share memory with other processes. if this argument is defined, users need not define those mandatory arguments, such as -c and -n, due to we don't want to pin such kind of processes to any CPUs. Signed-off-by: Chi Xiaobo --- lib/librte_eal/common/eal_common_options.c | 17 ++++++++++++--- lib/librte_eal/common/eal_internal_cfg.h | 1 + lib/librte_eal/common/eal_options.h | 2 ++ lib/librte_eal/linuxapp/eal/eal.c | 34 +++++++++++++++++------------- 4 files changed, 36 insertions(+), 18 deletions(-) diff --git a/lib/librte_eal/common/eal_common_options.c b/lib/librte_eal/common/eal_common_options.c index e2810ab..7b18498 100644 --- a/lib/librte_eal/common/eal_common_options.c +++ b/lib/librte_eal/common/eal_common_options.c @@ -85,6 +85,7 @@ eal_long_options[] = { {OPT_XEN_DOM0, 0, 0, OPT_XEN_DOM0_NUM}, {OPT_CREATE_UIO_DEV, 1, NULL, OPT_CREATE_UIO_DEV_NUM}, {OPT_VFIO_INTR, 1, NULL, OPT_VFIO_INTR_NUM}, + {OPT_MEMORY_ONLY, 0, NULL, OPT_MEMORY_ONLY_NUM}, {0, 0, 0, 0} }; @@ -126,6 +127,7 @@ eal_reset_internal_config(struct internal_config *internal_cfg) internal_cfg->no_hpet = 1; #endif internal_cfg->vmware_tsc_map = 0; + internal_cfg->memory_only= 0; } /* @@ -454,6 +456,10 @@ eal_parse_common_option(int opt, const char *optarg, conf->process_type = eal_parse_proc_type(optarg); break; + case OPT_MEMORY_ONLY_NUM: + conf->memory_only= 1; + break; + case OPT_MASTER_LCORE_NUM: if (eal_parse_master_lcore(optarg) < 0) { RTE_LOG(ERR, EAL, "invalid parameter for --" @@ -525,9 +531,9 @@ eal_check_common_options(struct internal_config *internal_cfg) { struct rte_config *cfg = rte_eal_get_configuration(); - if (!lcores_parsed) { - RTE_LOG(ERR, EAL, "CPU cores must be enabled with options " - "-c or -l\n"); + if (!lcores_parsed && !(internal_cfg->process_type == RTE_PROC_SECONDARY&& internal_cfg->memory_only) ) { + RTE_LOG(ERR, EAL, "For those processes without memory-only option, CPU cores " + "must be enabled with options -c or -l\n"); return -1; } if (cfg->lcore_role[cfg->master_lcore] != ROLE_RTE) { @@ -545,6 +551,10 @@ eal_check_common_options(struct internal_config *internal_cfg) "specified\n"); return -1; } + if ( internal_cfg->process_type != RTE_PROC_SECONDARY && internal_cfg->memory_only ) { + RTE_LOG(ERR, EAL, "only secondary processes can specify memory-only option.\n"); + return -1; + } if (index(internal_cfg->hugefile_prefix, '%') != NULL) { RTE_LOG(ERR, EAL, "Invalid char, '%%', in --"OPT_FILE_PREFIX" " "option\n"); @@ -590,6 +600,7 @@ eal_common_usage(void) " --"OPT_SYSLOG" : set syslog facility\n" " --"OPT_LOG_LEVEL" : set default log level\n" " --"OPT_PROC_TYPE" : type of this process\n" + " --"OPT_MEMORY_ONLY": only use shared memory, valid only for secondary process.\n" " --"OPT_PCI_BLACKLIST", -b: add a PCI device in black list.\n" " Prevent EAL from using this PCI device. The argument\n" " format is .\n" diff --git a/lib/librte_eal/common/eal_internal_cfg.h b/lib/librte_eal/common/eal_internal_cfg.h index aac6abf..f51f0a2 100644 --- a/lib/librte_eal/common/eal_internal_cfg.h +++ b/lib/librte_eal/common/eal_internal_cfg.h @@ -85,6 +85,7 @@ struct internal_config { unsigned num_hugepage_sizes; /**< how many sizes on this system */ struct hugepage_info hugepage_info[MAX_HUGEPAGE_SIZES]; + volatile unsigned memory_only; /**name); solib->lib_handle = dlopen(solib->name, RTLD_NOW); -- 1.9.4.msysgit.2