From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dispatch1-us1.ppe-hosted.com (dispatch1-us1.ppe-hosted.com [148.163.129.52]) by dpdk.org (Postfix) with ESMTP id 5B77F5F22 for ; Tue, 16 Oct 2018 14:48:41 +0200 (CEST) X-Virus-Scanned: Proofpoint Essentials engine Received: from webmail.solarflare.com (uk.solarflare.com [193.34.186.16]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mx1-us3.ppe-hosted.com (Proofpoint Essentials ESMTP Server) with ESMTPS id 9B30BB400A1; Tue, 16 Oct 2018 12:48:39 +0000 (UTC) Received: from [192.168.38.17] (91.220.146.112) by ukex01.SolarFlarecom.com (10.17.10.4) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Tue, 16 Oct 2018 13:48:33 +0100 To: Thomas Monjalon CC: , , , "Rahul Lakkireddy" References: <20180907233929.21950-1-thomas@monjalon.net> <20181014232020.12114-2-thomas@monjalon.net> <95172f2a-41d4-aadf-65b0-0e4c57fca826@solarflare.com> <1585953.FJ6NyjtPXU@xps> From: Andrew Rybchenko Message-ID: <118b3e0b-38ac-52bc-1e3c-f8430c4111c0@solarflare.com> Date: Tue, 16 Oct 2018 15:47:54 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.0 MIME-Version: 1.0 In-Reply-To: <1585953.FJ6NyjtPXU@xps> Content-Language: en-GB X-Originating-IP: [91.220.146.112] X-ClientProxiedBy: ocex03.SolarFlarecom.com (10.20.40.36) To ukex01.SolarFlarecom.com (10.17.10.4) X-TM-AS-Product-Ver: SMEX-12.5.0.1300-8.5.1010-24158.003 X-TM-AS-Result: No-10.380600-8.000000-10 X-TMASE-MatchedRID: VfovoVrt/oYOwH4pD14DsPHkpkyUphL97yWPaQc4INT9nZJIPtHyFDuY BlClHjLc4MlnMHmZOwrsiSCMfmP7WEa2DXGqwZmfw69AIwXJn0b8ukmY7cxf9VpbYq2f4jz+/Cn 0gFs3TJQUy0YoPaAASh+7F/Ev8r3ZOrPgsAyL7VHr/EBmiNuXt1PgO2JKQydYl7pREGKosSfzTu 35URal5iBkhyrvdMSlklPOPDP4bOjHuFqMm/pFRcg6fo0rxLVrJd2n2XoSRFnnZVNiuSZvWyzJW Grzf/lSNTcc+FGtHL3/voIzhn8wZuVHGbcDbAq6OX/V8P8ail1yZ8zcONpAsWxlRJiH4397JJH1 AE5C6+YTiiClGdtcb5EIINOAs7OqEUR0ZZsCZOyl+l6Msc1EwyqzCbwRcFaPhiEoFY5/FSYq0Qu faeH54gRfHxXgZ4FA X-TM-AS-User-Approved-Sender: Yes X-TM-AS-User-Blocked-Sender: No X-TMASE-Result: 10--10.380600-8.000000 X-TMASE-Version: SMEX-12.5.0.1300-8.5.1010-24158.003 X-MDID: 1539694120-07G26XFa56mQ Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 7bit X-Content-Filtered-By: Mailman/MimeDel 2.1.15 Subject: Re: [dpdk-dev] [PATCH v3 1/2] ethdev: free all common data when releasing port X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Oct 2018 12:48:41 -0000 On 10/16/18 3:22 PM, Thomas Monjalon wrote: > 16/10/2018 13:16, Andrew Rybchenko: >> On 10/15/18 2:20 AM, Thomas Monjalon wrote: >>> This is a clean-up of common ethdev data freeing. >>> All data freeing are moved to rte_eth_dev_release_port() >>> and done only in case of primary process. >>> >>> It is probably fixing some memory leaks for PMDs which were >>> not freeing all data. > [...] >> In general it looks good, really big work, but ideally it should be >> acked by cxgbe maintainer as well. > Actually, after more thoughts, I think this patch is not correct. > It is freeing MAC adresses in ethdev, even if there was no specific > allocation done for it in the PMD. Only the PMD can know what are the > memory blocks to free. > And it is the same for data->dev_private: are we sure it has been malloc'ed? > Are we sure it has not been allocated as part of a bigger block? > Historically, ethdev was freeing data->dev_private in some cases. > So maybe we can keep this assumption. > Or we can move all data freeing to the PMD? It is allocated in rte_eth_dev_create(), rte_eth_vdev_allocate(), rte_eth_dev_pci_allocate() and some PMDs. I can't say that I'm happy with it, but it could be really required. May be it should be default behaviour and if PMD wants override it, just free before and set dev_private to NULL.