From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id 2B152C44C for ; Mon, 29 Jun 2015 12:20:24 +0200 (CEST) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga102.jf.intel.com with ESMTP; 29 Jun 2015 03:20:25 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.13,698,1427785200"; d="scan'208";a="719496402" Received: from irsmsx152.ger.corp.intel.com ([163.33.192.66]) by orsmga001.jf.intel.com with ESMTP; 29 Jun 2015 03:20:23 -0700 Received: from irsmsx108.ger.corp.intel.com ([169.254.11.201]) by IRSMSX152.ger.corp.intel.com ([169.254.6.90]) with mapi id 14.03.0224.002; Mon, 29 Jun 2015 11:20:21 +0100 From: "Iremonger, Bernard" To: "Qiu, Michael" , "dev@dpdk.org" Thread-Topic: [PATCH v2] librte_ether: release memory in uninit function. Thread-Index: AQHQr/MWrMnfGSFKL02MpXHseHw6cp3DSVfQ Date: Mon, 29 Jun 2015 10:20:20 +0000 Message-ID: <8CEF83825BEC744B83065625E567D7C204A42C88@IRSMSX108.ger.corp.intel.com> References: <1435311160-8679-1-git-send-email-bernard.iremonger@intel.com> <533710CFB86FA344BFBF2D6802E60286046A625A@SHSMSX101.ccr.corp.intel.com> In-Reply-To: <533710CFB86FA344BFBF2D6802E60286046A625A@SHSMSX101.ccr.corp.intel.com> Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [163.33.239.181] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH v2] librte_ether: release memory in uninit function. 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: Mon, 29 Jun 2015 10:20:24 -0000 > -----Original Message----- > From: Qiu, Michael > Sent: Monday, June 29, 2015 9:55 AM > To: Iremonger, Bernard; dev@dpdk.org > Cc: Zhang, Helin; Ananyev, Konstantin; mukawa@igel.co.jp; Stephen > Hemminger > Subject: Re: [PATCH v2] librte_ether: release memory in uninit function. >=20 > On 6/26/2015 5:32 PM, Iremonger, Bernard wrote: > > Changes in v2: > > do not free mac_addrs and hash_mac_addrs here. > > > > Signed-off-by: Bernard Iremonger > > --- > > lib/librte_ether/rte_ethdev.c | 6 +++++- > > 1 files changed, 5 insertions(+), 1 deletions(-) > > > > diff --git a/lib/librte_ether/rte_ethdev.c > > b/lib/librte_ether/rte_ethdev.c index e13fde5..7ae101a 100644 > > --- a/lib/librte_ether/rte_ethdev.c > > +++ b/lib/librte_ether/rte_ethdev.c > > @@ -369,8 +369,12 @@ rte_eth_dev_uninit(struct rte_pci_device > *pci_dev) > > /* free ether device */ > > rte_eth_dev_release_port(eth_dev); > > > > - if (rte_eal_process_type() =3D=3D RTE_PROC_PRIMARY) > > + if (rte_eal_process_type() =3D=3D RTE_PROC_PRIMARY) { > > + rte_free(eth_dev->data->rx_queues); > > + rte_free(eth_dev->data->tx_queues); > > rte_free(eth_dev->data->dev_private); > > + memset(eth_dev->data, 0, sizeof(struct > rte_eth_dev_data)); > > + } > > > > eth_dev->pci_dev =3D NULL; > > eth_dev->driver =3D NULL; >=20 >=20 > Actually, This could be put in rte_eth_dev_close() becasue queues should = be > released when closed. >=20 > Also before free dev->data->rx_queues you should make sure > dev->data->rx_queues[i] has been freed in PMD close() function, So this > two should be better done at the same time, ether in > rte_eth_dev_close() or in PMD close() function. For hotplug in fm10k, I p= ut it > in PMD close() function. >=20 > Thanks, > Michael Hi Michael, =20 The consensus is that the rx_queue and tx_queue memory should not be releas= ed in the PMD as it is not allocated by the PMD. The memory is allocated in= rte_eth_dev_rx_queue_config() and rte_eth_dev_tx_queue_config(), which are= both called from rte_eth_dev_configure() which is called by the applicatio= n (for example test_pmd). So it seems to make sense to free this memory in= rte_eth_dev_uninit(). Regards, Bernard.