From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.arccn.ru (vpn.arccn.ru [95.182.74.2]) by dpdk.org (Postfix) with SMTP id 6C6067E75 for ; Thu, 13 Nov 2014 20:57:36 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by mail.arccn.ru (Postfix) with ESMTP id F242BA0092 for ; Fri, 14 Nov 2014 00:07:36 +0400 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=arccn.ru; h= x-mailer:to:references:message-id:content-transfer-encoding:date :date:in-reply-to:from:from:subject:subject:mime-version :content-type:content-type; s=dkim; t=1415909252; x=1416773252; bh=EHkRM8AW00j0M3bsmdQhaEFwKo+CO1S3TkCCdQNOUHo=; b=sTPPq/4yUjaM O582XOzwQoOdZwK8Hlw16bT5s0mcZv/qRdhx2OEbYmn8oqb/caqXKJOAx3E0dNkR CuQtqDFeRaW2o4LO8Kpz5jz7EF9H7wXX4Yo9CLWfINIS/64B2kdGAvUEQc7Ixdn7 CpmYf6X2IP9FWk9zal1KxCyKHtpdYi8= X-Virus-Scanned: Debian amavisd-new at mail.arccn.ru Received: from mail.arccn.ru ([127.0.0.1]) by localhost (mail.arccn.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 0ES2t+4KrOh4 for ; Thu, 13 Nov 2014 23:07:32 +0300 (MSK) Received: from [192.168.1.114] (ppp91-78-136-115.pppoe.mtu-net.ru [91.78.136.115]) by mail.arccn.ru (Postfix) with ESMTPSA id 2499AA0091; Thu, 13 Nov 2014 23:07:32 +0300 (MSK) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 8.0 \(1990.1\)) From: Igor Ryzhov In-Reply-To: Date: Thu, 13 Nov 2014 23:07:30 +0300 Content-Transfer-Encoding: quoted-printable Message-Id: References: To: "Chi, Xiaobo (NSN - CN/Hangzhou)" X-Mailer: Apple Mail (2.1990.1) 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: Thu, 13 Nov 2014 19:57:36 -0000 This is really useful, thank you! Best regards, Igor Ryzhov > 12 =D0=BD=D0=BE=D1=8F=D0=B1. 2014 =D0=B3., =D0=B2 6:22, Chi, Xiaobo = (NSN - CN/Hangzhou) =D0=BD=D0=B0=D0=BF=D0=B8=D1=81=D0= =B0=D0=BB(=D0=B0): >=20 > 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/dataplane processing, but also for Distributed Message eXchange = (DMX) between different processes/applications which may located in = different VM even different 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 use DPDK based = rte_tx_ring/rte_rx_ring/mempool/memzone to send receive messages to = dmxdemo. >=20 > Problem: > Here, these DPDK based SECONDARY processes need only the DPDK's = 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. > I have seen some others also met similar troubles. >=20 > 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 branch. >=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_index)) !=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.hugefile_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