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 2D9F17E70 for ; Sun, 16 Nov 2014 03:56:15 +0100 (CET) Received: from demuprx016.emea.nsn-intra.net ([10.150.129.55]) by demumfd002.nsn-inter.net (8.14.3/8.14.3) with ESMTP id sAG36MZC010204 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Sun, 16 Nov 2014 03:06:22 GMT Received: from SGSIHTC004.nsn-intra.net ([10.159.225.21]) by demuprx016.emea.nsn-intra.net (8.12.11.20060308/8.12.11) with ESMTP id sAG36Ghf012863 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=FAIL); Sun, 16 Nov 2014 04:06:19 +0100 Received: from SGSIMBX004.nsn-intra.net ([169.254.4.161]) by SGSIHTC004.nsn-intra.net ([10.159.225.21]) with mapi id 14.03.0195.001; Sun, 16 Nov 2014 11:06:16 +0800 From: "Chi, Xiaobo (NSN - CN/Hangzhou)" To: ext Neil Horman , Bruce Richardson Thread-Topic: [dpdk-dev] one lightwight rte_eal_init() for SECONDARY processes which only use sharedmemory Thread-Index: Ac/+J+eKxpxzf8+gTEa2VOiWSM+2ewBjYwGAAAZ+YIAAXlBcgA== Date: Sun, 16 Nov 2014 03:06:15 +0000 Message-ID: References: <20141114104820.GA13232@bricha3-MOBL3> <20141114135417.GE19147@hmsreliant.think-freely.org> In-Reply-To: <20141114135417.GE19147@hmsreliant.think-freely.org> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.159.225.111] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable 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: 4990 X-purgate-ID: 151667::1416107184-00001FC1-00D272FF/0/0 Cc: "dev@dpdk.org" Subject: Re: [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: Sun, 16 Nov 2014 02:56:15 -0000 Hi, Bruce and Neil, Do you indicate that to add one program arg, such as "--mem-only", to let t= he rte_eal_init()only to do those memory initializing things? I am worrying= that this would make rte_eal_init() more complex due to the "--mem-only" s= hould be judged here and there, even in some sub-functions.=20 brgs, chi xiaobo -----Original Message----- From: ext Neil Horman [mailto:nhorman@tuxdriver.com]=20 Sent: Friday, November 14, 2014 9:54 PM To: Bruce Richardson Cc: Chi, Xiaobo (NSN - CN/Hangzhou); dev@dpdk.org Subject: Re: [dpdk-dev] one lightwight rte_eal_init() for SECONDARY process= es which only use sharedmemory On Fri, Nov 14, 2014 at 10:48:21AM +0000, Bruce Richardson wrote: > On Wed, Nov 12, 2014 at 03:22:37AM +0000, Chi, Xiaobo (NSN - CN/Hangzhou)= wrote: > > Hi, > > Background: > > What we are doing now is port make telecom network element to be cloud = based. For one of our product, DPDK is applied not only for fastpath/data= plane processing, but also for Distributed Message eXchange (DMX) between d= ifferent processes/applications which may located in different VM even diff= erent host. for such a DMX system, in one VM, we have one DPDK based dmxde= mo (which acts as the PRIMARY) which is in charge of distribute message bet= ween different applications, and dozens of applications (act as SECONDARY) = to use DPDK based rte_tx_ring/rte_rx_ring/mempool/memzone to send receive m= essages to dmxdemo. > >=20 > > Problem: > > Here, these DPDK based SECONDARY processes need only the DPDK's hugepag= e based sharememory mechanism and it's upper libs (such as ring, mempool, e= tc.), 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. > > I have seen some others also met similar troubles. > >=20 > > Solution: > > I write one light weight rte_eal_init(), called rte_eal_secondary_mem_i= nit() as following. It only initializes shared memory and mandatory resour= ces. I expect your review and hope these code can be merged into DPDK main = branch. > > >=20 > Rather than writing a whole new API and arg parsing function, might it be= better > to implement this just as an additional EAL flag that prevents the existi= ng > eal_init function from doing all tasks? >=20 > /Bruce >=20 +1, that seems like a more compatible approach. Neil >=20 > > 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} > > }; > >=20 > > int opt; > > int option_index; > >=20 > > while ((opt =3D getopt_long(argc, argv, "", lgopts, &option_ind= ex)) !=3D EOF) { > >=20 > > 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; > > } > > } > > } > > } > >=20 > > int rte_eal_secondary_mem_init( int argc, char **argv ) > > { > > static rte_atomic32_t run_once =3D RTE_ATOMIC32_INIT(0); > > const char *logid; > >=20 > > if (!rte_atomic32_test_and_set(&run_once)) > > return -1; > >=20 > > logid =3D strrchr(argv[0], '/'); > > logid =3D strdup(logid ? logid + 1: argv[0]); > >=20 > > if (rte_eal_log_early_init() < 0) > > rte_panic("Cannot init early logs\n"); > >=20 > > 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 ); > >=20 > > RTE_LOG(INFO, EAL, "prefix=3D%s, dir=3D%s.\n",internal_config.hugefi= le_prefix, internal_config.hugepage_dir ); > >=20 > > /* To share memory config with PRIMARY process */ > > internal_config.no_shconf =3D 0; > > rte_config_init(); > >=20 > > if (rte_eal_memory_init() < 0) > > rte_panic("Cannot init memory\n"); > >=20 > > if (rte_eal_memzone_init() < 0) > > rte_panic("Cannot init memzone\n"); > >=20 > > if (rte_eal_log_init(logid, LOG_DAEMON ) < 0) > > rte_panic("Cannot init logs\n"); > >=20 > > return 0; > > } > >=20 > > brgs, > > chi xiaobo > >=20 > >=20 > >=20 >=20