From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from demumfd002.nsn-inter.net (demumfd002.nsn-inter.net [93.183.12.31]) by dpdk.org (Postfix) with ESMTP id 5F65E7E9D for ; Wed, 12 Nov 2014 04:13:14 +0100 (CET) Received: from demuprx017.emea.nsn-intra.net ([10.150.129.56]) by demumfd002.nsn-inter.net (8.14.3/8.14.3) with ESMTP id sAC3N6q0005150 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 12 Nov 2014 03:23:06 GMT Received: from SGSIHTC001.nsn-intra.net ([10.159.225.18]) by demuprx017.emea.nsn-intra.net (8.12.11.20060308/8.12.11) with ESMTP id sAC3KgSH007458 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=FAIL) for ; Wed, 12 Nov 2014 04:23:06 +0100 Received: from SGSIHTC006.nsn-intra.net (10.159.225.23) by SGSIHTC001.nsn-intra.net (10.159.225.18) with Microsoft SMTP Server (TLS) id 14.3.195.1; Wed, 12 Nov 2014 11:22:37 +0800 Received: from SGSIMBX004.nsn-intra.net ([169.254.4.161]) by SGSIHTC006.nsn-intra.net ([10.159.225.23]) with mapi id 14.03.0195.001; Wed, 12 Nov 2014 11:22:37 +0800 From: "Chi, Xiaobo (NSN - CN/Hangzhou)" To: "dev@dpdk.org" Thread-Topic: one lightwight rte_eal_init() for SECONDARY processes which only use sharedmemory Thread-Index: Ac/+J+eKxpxzf8+gTEa2VOiWSM+2ew== Date: Wed, 12 Nov 2014 03:22:37 +0000 Message-ID: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.159.225.121] MIME-Version: 1.0 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: 10929 X-purgate-ID: 151667::1415762586-00001FC1-A4D5EF9F/0/0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.15 Subject: [dpdk-dev] one lightwight rte_eal_init() for SECONDARY processes which only use sharedmemory 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, 12 Nov 2014 03:13:14 -0000 Hi, Background: What we are doing now is port make telecom network element to be cloud base= d. For one of our product, DPDK is applied not only for fastpath/dataplan= e processing, but also for Distributed Message eXchange (DMX) between diffe= rent processes/applications which may located in different VM even differen= t host. for such a DMX system, in one VM, we have one DPDK based dmxdemo (= which acts as the PRIMARY) which is in charge of distribute message between= different applications, and dozens of applications (act as SECONDARY) to u= se DPDK based rte_tx_ring/rte_rx_ring/mempool/memzone to send receive messa= ges to dmxdemo. Problem: Here, these DPDK based SECONDARY processes need only the DPDK's hugepage ba= sed sharememory mechanism and it's upper libs (such as ring, mempool, etc.)= , they need not cpu core pinning, iopl privilege changing , pci device, tim= er, 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. I have seen some others also met similar troubles. Solution: I write one light weight rte_eal_init(), called rte_eal_secondary_mem_init(= ) as following. It only initializes shared memory and mandatory resources.= I expect your review and hope these code can be merged into DPDK main bran= ch. static void eal_secondary_mem_parse_args(int argc, char **argv) { static struct option lgopts[] =3D { {OPT_HUGE_DIR, 1, 0, 0}, {OPT_FILE_PREFIX, 1, 0, 0}, {0, 0, 0, 0} }; int opt; int option_index; while ((opt =3D getopt_long(argc, argv, "", lgopts, &option_index))= !=3D EOF) { if (!opt ) { if (!strcmp(lgopts[option_index].name, OPT_HUGE_DIR)) { internal_config.hugepage_dir =3D optarg; } else if (!strcmp(lgopts[option_index].name, OPT_FILE_PREFIX)) { internal_config.hugefile_prefix =3D optarg; } } } } int rte_eal_secondary_mem_init( int argc, char **argv ) { static rte_atomic32_t run_once =3D RTE_ATOMIC32_INIT(0); const char *logid; if (!rte_atomic32_test_and_set(&run_once)) return -1; logid =3D strrchr(argv[0], '/'); logid =3D strdup(logid ? logid + 1: argv[0]); if (rte_eal_log_early_init() < 0) rte_panic("Cannot init early logs\n"); memset( &internal_config, 0, sizeof( struct internal_config ) ); /*this is only for secondary PRBs */ internal_config.process_type =3D RTE_PROC_SECONDARY; internal_config.hugefile_prefix =3D HUGEFILE_PREFIX_DEFAULT; internal_config.hugepage_dir =3D NULL; /* user can freely define the hugefile_prefix and hugepage_dir */ eal_secondary_mem_parse_args( argc, argv ); RTE_LOG(INFO, EAL, "prefix=3D%s, dir=3D%s.\n",internal_config.hugefile_p= refix, internal_config.hugepage_dir ); /* To share memory config with PRIMARY process */ internal_config.no_shconf =3D 0; rte_config_init(); if (rte_eal_memory_init() < 0) rte_panic("Cannot init memory\n"); if (rte_eal_memzone_init() < 0) rte_panic("Cannot init memzone\n"); if (rte_eal_log_init(logid, LOG_DAEMON ) < 0) rte_panic("Cannot init logs\n"); return 0; } brgs, chi xiaobo