From mboxrd@z Thu Jan 1 00:00:00 1970 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) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga102.fm.intel.com with ESMTP; 19 May 2015 05:27:10 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.13,458,1427785200"; d="scan'208";a="495503967" Received: from bricha3-mobl3.ger.corp.intel.com ([10.237.221.63]) by FMSMGA003.fm.intel.com with SMTP; 19 May 2015 05:27:07 -0700 Received: by (sSMTP sendmail emulation); Tue, 19 May 2015 13:27:07 +0025 Date: Tue, 19 May 2015 13:27:07 +0100 From: Bruce Richardson To: Mauricio =?iso-8859-1?Q?V=E1squez?= Message-ID: <20150519122706.GA7216@bricha3-MOBL3> References: MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: Organization: Intel Shannon Ltd. User-Agent: Mutt/1.5.23 (2014-03-12) 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 12:27:13 -0000 On Mon, May 18, 2015 at 10:32:37AM +0200, Mauricio Vásquez 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 = 0; > > /* Init EAL, parsing EAL args */ > retval = rte_eal_init(argc, argv); > if (retval < 0) > return -1; > > char cmdline[PATH_MAX] = {0}; > > struct rte_mempool *packets_pool; > //Create mempool > packets_pool = rte_mempool_create( > "packets", > NUM_PKTS, > MBUF_SIZE, > CACHE_SIZE, //This is the size of the mempool > 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 == 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 = 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=2048M,shm=fd:/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 command > 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 = 0; > > if ((retval = rte_eal_init(argc, argv)) < 0) > return -1; > > argc -= retval; > argv += retval; > > struct rte_mempool * packets; > > packets = rte_mempool_lookup("packets"); > > if(packets == 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.