From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <helin.zhang@intel.com>
Received: from mga14.intel.com (mga14.intel.com [192.55.52.115])
 by dpdk.org (Postfix) with ESMTP id 3F0877EEF
 for <dev@dpdk.org>; Fri,  6 Nov 2015 07:00:29 +0100 (CET)
Received: from fmsmga002.fm.intel.com ([10.253.24.26])
 by fmsmga103.fm.intel.com with ESMTP; 05 Nov 2015 22:00:28 -0800
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="5.20,250,1444719600"; d="scan'208";a="844394928"
Received: from fmsmsx107.amr.corp.intel.com ([10.18.124.205])
 by fmsmga002.fm.intel.com with ESMTP; 05 Nov 2015 22:00:27 -0800
Received: from shsmsx102.ccr.corp.intel.com (10.239.4.154) by
 fmsmsx107.amr.corp.intel.com (10.18.124.205) with Microsoft SMTP Server (TLS)
 id 14.3.248.2; Thu, 5 Nov 2015 22:00:27 -0800
Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.100]) by
 shsmsx102.ccr.corp.intel.com ([169.254.2.199]) with mapi id 14.03.0248.002;
 Fri, 6 Nov 2015 14:00:25 +0800
From: "Zhang, Helin" <helin.zhang@intel.com>
To: "Wu, Jingjing" <jingjing.wu@intel.com>, "dev@dpdk.org" <dev@dpdk.org>
Thread-Topic: [PATCH] i40e: fix the issue of not freeing memzone
Thread-Index: AQHRGEL4Obdr8WOoKkSyo25s/PgzxZ6OeKJwgAAGj6A=
Date: Fri, 6 Nov 2015 06:00:25 +0000
Message-ID: <F35DEAC7BCE34641BA9FAC6BCA4A12E70A936B4D@SHSMSX104.ccr.corp.intel.com>
References: <1446780365-1271-1-git-send-email-helin.zhang@intel.com>
 <9BB6961774997848B5B42BEC655768F8D239E5@SHSMSX104.ccr.corp.intel.com>
In-Reply-To: <9BB6961774997848B5B42BEC655768F8D239E5@SHSMSX104.ccr.corp.intel.com>
Accept-Language: en-US
Content-Language: en-US
X-MS-Has-Attach: 
X-MS-TNEF-Correlator: 
x-originating-ip: [10.239.127.40]
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
Subject: Re: [dpdk-dev] [PATCH] i40e: fix the issue of not freeing memzone
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: patches and discussions about DPDK <dev.dpdk.org>
List-Unsubscribe: <http://dpdk.org/ml/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://dpdk.org/ml/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <http://dpdk.org/ml/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Fri, 06 Nov 2015 06:00:29 -0000



> -----Original Message-----
> From: Wu, Jingjing
> Sent: Friday, November 6, 2015 1:40 PM
> To: Zhang, Helin; dev@dpdk.org
> Subject: RE: [PATCH] i40e: fix the issue of not freeing memzone
>=20
> > -	static uint64_t id =3D 0;
> >  	const struct rte_memzone *mz =3D 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());
>=20
> 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 t=
he similar purpose.

>=20
> >  #ifdef RTE_LIBRTE_XEN_DOM0
> >  	mz =3D 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 =3D id;
> >  	mem->size =3D size;
> >  	mem->va =3D 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 =3D mz->phys_addr;
> >  #endif
> > +	mem->zone =3D (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

>=20
>=20
> Thanks
> Jingjing