From mboxrd@z Thu Jan 1 00:00:00 1970 From: Bruce Richardson Subject: Re: dpdk 2.0.0: Issue mapping mempool into guest using IVSHMEM Date: Tue, 19 May 2015 13:27:07 +0100 Message-ID: <20150519122706.GA7216@bricha3-MOBL3> References: Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Cc: dev@dpdk.org To: Mauricio =?iso-8859-1?Q?V=E1squez?= Return-path: Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id 6DF3F5A35 for ; Tue, 19 May 2015 14:27:12 +0200 (CEST) Content-Disposition: inline In-Reply-To: List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On Mon, May 18, 2015 at 10:32:37AM +0200, Mauricio V=E1squez wrote: > Hi all, >=20 > I'm trying to map a mempool into a guest using the IVSHMEM library but = the > mempool is not visible from the guest. >=20 > The code I'm running is quite simple, on the host I run a primary DPDK > process that creates the mempool, creates a metadata file and then adds= the > mempool to it. Can you perhaps try using the ivshmem example application with DPDK to st= art with and see if you can reproduce your issue with that? Regards, /Bruce >=20 > The code is: > ... > int main(int argc, char * argv[]) > { > int retval =3D 0; >=20 > /* Init EAL, parsing EAL args */ > retval =3D rte_eal_init(argc, argv); > if (retval < 0) > return -1; >=20 > char cmdline[PATH_MAX] =3D {0}; >=20 > struct rte_mempool *packets_pool; > //Create mempool > packets_pool =3D rte_mempool_create( > "packets", > NUM_PKTS, > MBUF_SIZE, > CACHE_SIZE, //This is the size of the mempoo= l > cache > sizeof(struct rte_pktmbuf_pool_private), > rte_pktmbuf_pool_init, > NULL, > rte_pktmbuf_init, > NULL, > rte_socket_id(), > 0 /*NO_FLAGS*/); >=20 > if (packets_pool =3D=3D NULL) > rte_exit(EXIT_FAILURE,"Cannot init the packets pool\n"); >=20 > //Create metadata file > if (rte_ivshmem_metadata_create(metadata_name) < 0) > rte_exit(EXIT_FAILURE, "Cannot create metadata file\n"); >=20 > //Add mempool to metadata file > if(rte_ivshmem_metadata_add_mempool(packets_pool, metadata_name) < = 0) > rte_exit(EXIT_FAILURE, "Cannot add mempool metadata file\n"); >=20 > //Get qemu command line > if (rte_ivshmem_metadata_cmdline_generate(cmdline, sizeof(cmdline), > metadata_name) < 0) > rte_exit(EXIT_FAILURE, "Failed generating command line for qemu= \n"); >=20 > RTE_LOG(INFO, APP, "Command line for qemu: %s\n", cmdline); > save_ivshmem_cmdline_to_file(cmdline); >=20 > //Avoids the application closes > char x =3D getchar(); > (void) x; > return 0; > } >=20 > When I run it I can see clearly that the memzone is added: >=20 > EAL: Adding memzone 'MP_packets' at 0x7ffec0e8c1c0 to metadata vm_1 > EAL: Adding memzone 'RG_MP_packets' at 0x7ffec0d8c140 to metadata vm_1 > APP: Command line for qemu: -device > ivshmem,size=3D2048M,shm=3Dfd:/dev/hugepages/rtemap_0:0x0:0x40000000:/d= ev/zero:0x0:0x3fffc000:/var/run/.dpdk_ivshmem_metadata_vm_1:0x0:0x4000 >=20 > I run the modified version of QEMU provided by dpdk-ovs using the comma= nd > line generated by the host application, then in the guest I run an even > simpler application: >=20 > ... > void mempool_walk_f(const struct rte_mempool *r, void * arg) > { > RTE_LOG(INFO, APP, "Mempool: %s\n", r->name); > (void) arg; > } >=20 > int main(int argc, char *argv[]) > { > int retval =3D 0; >=20 > if ((retval =3D rte_eal_init(argc, argv)) < 0) > return -1; >=20 > argc -=3D retval; > argv +=3D retval; >=20 > struct rte_mempool * packets; >=20 > packets =3D rte_mempool_lookup("packets"); >=20 > if(packets =3D=3D NULL) > { > RTE_LOG(ERR, APP, "Failed to find mempool\n"); > } >=20 > RTE_LOG(INFO, APP, "List of mempool: \n"); > rte_mempool_walk(mempool_walk_f, NULL); >=20 > return 0; > } > ... >=20 > I can see in the application output that the mem zones that were added = are > found: >=20 > EAL: Found memzone: 'RG_MP_packets' at 0x7ffec0d8c140 (len 0x100080) > EAL: Found memzone: 'MP_packets' at 0x7ffec0e8c1c0 (len 0x3832100) >=20 > But, the rte_mempool_lookup function returns NULL. > Using the rte_mempool_walker the program only prints a memzone called > log_history. >=20 > Do you have any suggestion? >=20 > Thank you very much for your help.