[dpdk-dev] [PATCH] i40e: fix the issue of not freeing memzone

Zhang, Helin helin.zhang at intel.com
Fri Nov 6 07:00:25 CET 2015



> -----Original Message-----
> From: Wu, Jingjing
> Sent: Friday, November 6, 2015 1:40 PM
> To: Zhang, Helin; dev at dpdk.org
> Subject: RE: [PATCH] i40e: fix the issue of not freeing memzone
> 
> > -	static uint64_t id = 0;
> >  	const struct rte_memzone *mz = NULL;
> >  	char z_name[RTE_MEMZONE_NAMESIZE];
> >
> >  	if (!mem)
> >  		return I40E_ERR_PARAM;
> >
> > -	id++;
> > -	snprintf(z_name, sizeof(z_name), "i40e_dma_%"PRIu64, id);
> > +	snprintf(z_name, sizeof(z_name), "i40e_dma_%"PRIu64, rte_rand());
> 
> Why change id++ to rte_rand() ?
Don't need to maintain the ID, which may have race condition issue.
Get a random data is good enough. Some other PMDs are using tsc count for the similar purpose.

> 
> >  #ifdef RTE_LIBRTE_XEN_DOM0
> >  	mz = rte_memzone_reserve_bounded(z_name, size, SOCKET_ID_ANY, 0,
> >  					 alignment, RTE_PGSIZE_2M);
> > @@ -2929,7 +2927,6 @@
> > i40e_allocate_dma_mem_d(__attribute__((unused)) struct i40e_hw *hw,
> >  	if (!mz)
> >  		return I40E_ERR_NO_MEMORY;
> >
> > -	mem->id = id;
> >  	mem->size = size;
> >  	mem->va = mz->addr;
> >  #ifdef RTE_LIBRTE_XEN_DOM0
> > @@ -2937,6 +2934,8 @@
> > i40e_allocate_dma_mem_d(__attribute__((unused)) struct i40e_hw *hw,
> > #else
> >  	mem->pa = mz->phys_addr;
> >  #endif
> > +	mem->zone = (const void *)mz;
> > +	PMD_DRV_LOG(DEBUG, "memzone allocated: %p", mem->zone);
> >
> Why not print the name of mem_zone instead of pointer?
Good idea to print the name instead, and possible physical address, virtual address, etc.

Regards,
Helin

> 
> 
> Thanks
> Jingjing


More information about the dev mailing list