From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dispatch1-us1.ppe-hosted.com (dispatch1-us1.ppe-hosted.com [67.231.154.164]) by dpdk.org (Postfix) with ESMTP id 73F0C2BD3 for ; Tue, 16 Oct 2018 14:56:15 +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 204E9B800A0; Tue, 16 Oct 2018 12:56:14 +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:56:07 +0100 To: Thomas Monjalon CC: , , , "Rahul Lakkireddy" References: <20180907233929.21950-1-thomas@monjalon.net> <1585953.FJ6NyjtPXU@xps> <118b3e0b-38ac-52bc-1e3c-f8430c4111c0@solarflare.com> <1789121.QrbBs7g2FO@xps> From: Andrew Rybchenko Message-ID: <287a1f00-5dfc-f6bf-ab26-a9e9fac24570@solarflare.com> Date: Tue, 16 Oct 2018 15:55:26 +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: <1789121.QrbBs7g2FO@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-15.259000-8.000000-10 X-TMASE-MatchedRID: 1GZI+iG+MtcOwH4pD14DsPHkpkyUphL97yWPaQc4INT9nZJIPtHyFDuY BlClHjLc4MlnMHmZOwrsiSCMfmP7WEa2DXGqwZmfw69AIwXJn0b8ukmY7cxf9VpbYq2f4jz+/Cn 0gFs3TJQUy0YoPaAASh+7F/Ev8r3ZOrPgsAyL7VHr/EBmiNuXt1PgO2JKQydYTUobVis5Bb830E eCx5K2K6qlmnJLkcBo9VgPHvTj6oJeIuWW8+N372g4D2QV/2zL6r3HCixfuKcML9Wb3Qh/hVTNq f3EQ8oxYnP+cq2mFg5XmxqYx7OZlsZXUijhl2l8GQlUVP2iPczHbZsG8T5ZjjssXelfet1UuPFr kRUFXWri8zVgXoAltkWL4rBlm20vt7DW3B48kkGyO81X3yak85v6tqvaaiKSNWCXmrnXtPCx9PW 9wQfgnMZ6vVK7S/X0Vh4OVciemKcWCB/muZSODcz9p/hQC36ab9KjsjvZCiDjlgZWJ5XXXA== X-TM-AS-User-Approved-Sender: Yes X-TM-AS-User-Blocked-Sender: No X-TMASE-Result: 10--15.259000-8.000000 X-TMASE-Version: SMEX-12.5.0.1300-8.5.1010-24158.003 X-MDID: 1539694574-2oxekgCZYS9Z 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:56:15 -0000 On 10/16/18 3:52 PM, Thomas Monjalon wrote: > 16/10/2018 14:47, Andrew Rybchenko: >> 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. > Yes, you're right! > So freeing is done by default in rte_eth_dev_release_port(), > and PMD can avoid it by setting fields to NULL before calling it. > > In this case, I just need to double check the MAC freeing, > and set NULL in some PMDs which do not allocate MAC separately. One more thought that we should document it since it is used by all PMDs and we have really a lot already and it looks like every release cycle we have at least plus one.