From: Huisong Li <lihuisong@huawei.com>
To: Thomas Monjalon <thomas@monjalon.net>
Cc: <dev@dpdk.org>, <ferruh.yigit@intel.com>, <david.marchand@redhat.com>
Subject: Re: [dpdk-dev] [RFC V1] examples/l3fwd-power: fix memory leak for rte_pci_device
Date: Thu, 30 Sep 2021 14:28:33 +0800 [thread overview]
Message-ID: <6934941a-23e0-5466-3013-69a79c42fec0@huawei.com> (raw)
In-Reply-To: <dc2487dc-f569-6235-6603-78f5bc69b502@huawei.com>
Hi. Thomas
I've summed up our previous discussion.
Can you look at the final proposal again?
Do you think we should deal with the problem better?
在 2021/9/27 9:44, Huisong Li 写道:
>
> 在 2021/9/27 3:16, Thomas Monjalon 写道:
>> 26/09/2021 14:20, Huisong Li:
>>> 在 2021/9/18 16:46, Thomas Monjalon 写道:
>>>> 18/09/2021 05:24, Huisong Li:
>>>>> 在 2021/9/17 20:50, Thomas Monjalon 写道:
>>>>>> 17/09/2021 04:13, Huisong Li:
>>>>>>> How should PMD free it? What should we do? Any good suggestions?
>>>>>> Check that there is no other port sharing the same PCI device,
>>>>>> then call the PMD callback for rte_pci_remove_t.
>>>>> For primary and secondary processes, their rte_pci_device is
>>>>> independent.
>>>> Yes it requires to free on both primary and secondary.
>>>>
>>>>> Is this for a scenario where there are multiple representor ports
>>>>> under
>>>>> the same PCI address in the same processe?
>>>> A PCI device can have multiple physical or representor ports.
>>> Got it.
>>>>>>> Would it be more appropriate to do this in rte_eal_cleanup() if it
>>>>>>> cann't be done in the API above?
>>>>>> rte_eal_cleanup is a last cleanup for what was not done earlier.
>>>>>> We could do that but first we should properly free devices when
>>>>>> closed.
>>>>>>
>>>>> Totally, it is appropriate that rte_eal_cleanup is responsible for
>>>>> releasing devices under the pci bus.
>>>> Yes, but if a device is closed while the rest of the app keep running,
>>>> we should not wait to free it.
>>> From this point of view, it seems to make sense. However,
>>> according to
>>> the OVS-DPDK
>>>
>>> usage, it calls dev_close() first, and then check whether all ports
>>> under the PCI address are
>>>
>>> closed to free rte_pci_device by calling rte_dev_remove().
>>>
>>>
>>> If we do not want the user to be aware of this, and we want
>>> rte_pci_device to be freed
>>>
>>> in a timely manner. Can we add a code logic calculating the number of
>>> ports under a PCI address
>>>
>>> and calling rte_dev_remove() to rte_eth_dev_close() to free
>>> rte_pci_device and delete it from rte_pci_bus?
>>>
>>> If we do, we may need to make some extra work, otherwise some
>>> applications, such as OVS-DPDK, will
>>>
>>> fail due to a second call to rte_dev_remove().
>> I don't understand the proposal.
>> Please could explain again the code path?
>
> 1. This RFC patch intended to free rte_pci_device in DPDK app by calling
>
> rte_dev_remove() after calling dev_close().
>
> 2. For the above-mentioned usage in OVS-DPDK, please see function
>
> netdev_dpdk_destruct() in lib/netdev-dpdk.c.
>
> 3. Later, you suggest that the release of rte_pci_device should be done
>
> in the dev_close() API, not in the rte_eal_init() which is not real-time.
>
> To sum up, the above proposal comes out.
>
>> It may deserve a separate mail thread.
>>
>>
>> .
> .
next prev parent reply other threads:[~2021-09-30 6:28 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-07 3:41 Huisong Li
2021-09-07 8:53 ` Thomas Monjalon
2021-09-08 2:01 ` Huisong Li
2021-09-08 7:20 ` Thomas Monjalon
2021-09-16 8:01 ` Huisong Li
2021-09-16 10:36 ` Thomas Monjalon
2021-09-17 2:13 ` Huisong Li
2021-09-17 12:50 ` Thomas Monjalon
2021-09-18 3:24 ` Huisong Li
2021-09-18 8:46 ` Thomas Monjalon
2021-09-26 12:20 ` Huisong Li
2021-09-26 19:16 ` Thomas Monjalon
2021-09-27 1:44 ` Huisong Li
2021-09-30 6:28 ` Huisong Li [this message]
2021-09-30 7:50 ` Thomas Monjalon
2021-10-08 6:26 ` lihuisong (C)
2021-10-08 6:29 ` Thomas Monjalon
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=6934941a-23e0-5466-3013-69a79c42fec0@huawei.com \
--to=lihuisong@huawei.com \
--cc=david.marchand@redhat.com \
--cc=dev@dpdk.org \
--cc=ferruh.yigit@intel.com \
--cc=thomas@monjalon.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).