From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from compass.polito.it (compass.polito.it [130.192.55.110]) by dpdk.org (Postfix) with ESMTP id 16810C32A for ; Tue, 19 May 2015 16:21:37 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by compass.polito.it (Postfix) with ESMTP id D923B1000FC for ; Tue, 19 May 2015 16:21:36 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d= studenti.polito.it; h=content-type:content-type:cc:to:from:from :subject:subject:message-id:date:date:references:in-reply-to :received:mime-version:received:received:received; s=y2k10; t= 1432045293; bh=Bhg4aGcjunKHDSGtTPMF8NEZfb+SFwuzvoEuZHNRdgg=; b=V SyPI91ci2zAEKCWvoXIfOe63Ck+OS56fJk44TRc3tAe6SBdYqDC0Qm0uuiFrCpi5 TN+IsZ1zwGCw5Iv21YtI+4r+Cnw7aa5VnDcTwGOzikJL0JsiRZLN0XHUGvw+VSpK Vuv2Xkqhfw59aGthqnWFRiYoUbgeZwVGwEtd4BSSzQ= X-Virus-Scanned: amavisd-new at studenti.polito.it Received: from compass.polito.it ([127.0.0.1]) by localhost (compass.polito.it [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id 229ESJC4Xcyu for ; Tue, 19 May 2015 16:21:33 +0200 (CEST) Received: from mail-la0-f49.google.com (mail-la0-f49.google.com [209.85.215.49]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: s203403@studenti.polito.it) by compass.polito.it (Postfix) with ESMTPSA id 0CFFE1000BD for ; Tue, 19 May 2015 16:21:33 +0200 (CEST) Received: by labbd9 with SMTP id bd9so26912105lab.2 for ; Tue, 19 May 2015 07:21:32 -0700 (PDT) MIME-Version: 1.0 X-Received: by 10.152.37.228 with SMTP id b4mr21484647lak.117.1432045292489; Tue, 19 May 2015 07:21:32 -0700 (PDT) Received: by 10.25.149.144 with HTTP; Tue, 19 May 2015 07:21:32 -0700 (PDT) In-Reply-To: <20150519122706.GA7216@bricha3-MOBL3> References: <20150519122706.GA7216@bricha3-MOBL3> Date: Tue, 19 May 2015 16:21:32 +0200 Message-ID: From: =?UTF-8?Q?Mauricio_V=C3=A1squez?= To: Bruce Richardson Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.15 Cc: dev@dpdk.org Subject: Re: [dpdk-dev] dpdk 2.0.0: Issue mapping mempool into guest using IVSHMEM 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: Tue, 19 May 2015 14:21:37 -0000 Thank you for your answer Bruce, I think you refer to the example "l2fwd-ivshmem", Don't you? I compiled and run it, it works. I was reviewing the code and I found that the function rte_mempool_lookup is not used in the guest. In the host a structure containing pointers to the rings is allocated using rte_memzone_reserve and then mapped to the guest with rte_ivshmem_metadata_add_memzone. In the guest rte_memzone_lookup is used to lookup for this structure. It's clear to me that I could use this approach to do what I want to do, but I don't understand why rte_mempool_lookup does not work in my case. Thanks in advance. On Tue, May 19, 2015 at 2:27 PM, Bruce Richardson < bruce.richardson@intel.com> wrote: > On Mon, May 18, 2015 at 10:32:37AM +0200, Mauricio V=C3=A1squez wrote: > > Hi all, > > > > I'm trying to map a mempool into a guest using the IVSHMEM library but > the > > mempool is not visible from the guest. > > > > 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 > start with > and see if you can reproduce your issue with that? > > Regards, > /Bruce > > > > > The code is: > > ... > > int main(int argc, char * argv[]) > > { > > int retval =3D 0; > > > > /* Init EAL, parsing EAL args */ > > retval =3D rte_eal_init(argc, argv); > > if (retval < 0) > > return -1; > > > > char cmdline[PATH_MAX] =3D {0}; > > > > 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*/); > > > > if (packets_pool =3D=3D NULL) > > rte_exit(EXIT_FAILURE,"Cannot init the packets pool\n"); > > > > //Create metadata file > > if (rte_ivshmem_metadata_create(metadata_name) < 0) > > rte_exit(EXIT_FAILURE, "Cannot create metadata file\n"); > > > > //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"); > > > > //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"); > > > > RTE_LOG(INFO, APP, "Command line for qemu: %s\n", cmdline); > > save_ivshmem_cmdline_to_file(cmdline); > > > > //Avoids the application closes > > char x =3D getchar(); > > (void) x; > > return 0; > > } > > > > When I run it I can see clearly that the memzone is added: > > > > 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:/dev= /zero:0x0:0x3fffc000:/var/run/.dpdk_ivshmem_metadata_vm_1:0x0:0x4000 > > > > 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: > > > > ... > > void mempool_walk_f(const struct rte_mempool *r, void * arg) > > { > > RTE_LOG(INFO, APP, "Mempool: %s\n", r->name); > > (void) arg; > > } > > > > int main(int argc, char *argv[]) > > { > > int retval =3D 0; > > > > if ((retval =3D rte_eal_init(argc, argv)) < 0) > > return -1; > > > > argc -=3D retval; > > argv +=3D retval; > > > > struct rte_mempool * packets; > > > > packets =3D rte_mempool_lookup("packets"); > > > > if(packets =3D=3D NULL) > > { > > RTE_LOG(ERR, APP, "Failed to find mempool\n"); > > } > > > > RTE_LOG(INFO, APP, "List of mempool: \n"); > > rte_mempool_walk(mempool_walk_f, NULL); > > > > return 0; > > } > > ... > > > > I can see in the application output that the mem zones that were added > are > > found: > > > > EAL: Found memzone: 'RG_MP_packets' at 0x7ffec0d8c140 (len 0x100080) > > EAL: Found memzone: 'MP_packets' at 0x7ffec0e8c1c0 (len 0x3832100) > > > > But, the rte_mempool_lookup function returns NULL. > > Using the rte_mempool_walker the program only prints a memzone called > > log_history. > > > > Do you have any suggestion? > > > > Thank you very much for your help. >