From: Kevin Laatz <kevin.laatz@intel.com>
To: "lihuisong (C)" <lihuisong@huawei.com>, <dev@dpdk.org>
Cc: "Morten Brørup" <mb@smartsharesystems.com>
Subject: Re: [PATCH v6] eal: add bus cleanup to eal cleanup
Date: Fri, 3 Jun 2022 15:35:21 +0100 [thread overview]
Message-ID: <2ea583db-8738-492f-4119-ff4dff50de5c@intel.com> (raw)
In-Reply-To: <a577db9c-5777-876f-e4df-f6f27e171bb6@huawei.com>
On 02/06/2022 03:06, lihuisong (C) wrote:
> Hi Kevin,
>
> 在 2022/6/2 1:02, Kevin Laatz 写道:
>> During EAL init, all buses are probed and the devices found are
>> initialized. On eal_cleanup(), the inverse does not happen, meaning any
>> allocated memory and other configuration will not be cleaned up
>> appropriately on exit.
>>
>> Currently, in order for device cleanup to take place, applications must
>> call the driver-relevant functions to ensure proper cleanup is done
>> before
>> the application exits. Since initialization occurs for all devices on
>> the
>> bus, not just the devices used by an application, it requires a)
>> application awareness of all bus devices that could have been probed
>> on the
>> system, and b) code duplication across applications to ensure cleanup is
>> performed. An example of this is rte_eth_dev_close() which is
>> commonly used
>> across the example applications.
>>
>> This patch proposes adding bus cleanup to the eal_cleanup() to make
>> EAL's
>> init/exit more symmetrical, ensuring all bus devices are cleaned up
>> appropriately without the application needing to be aware of all bus
>> types
>> that may have been probed during initialization.
>>
>> Contained in this patch are the changes required to perform cleanup for
>> devices on the PCI bus and VDEV bus during eal_cleanup(). There would
>> be an
>> ask for bus maintainers to add the relevant cleanup for their buses
>> since
>> they have the domain expertise.
>>
>> Signed-off-by: Kevin Laatz <kevin.laatz@intel.com>
>> Acked-by: Morten Brørup <mb@smartsharesystems.com>
>>
>> ---
>> v6:
>> * add bus_cleanup to eal_cleanup for FreeBSD
>> * add bus_cleanup to eal_cleanup for Windows
>> * remove bus cleanup function to remove rte_ prefix
>> * other minor fixes
>>
>> v5:
>> * remove unnecessary logs
>> * move rte_bus_cleanup() definition to eal_private.h
>> * fix return values for vdev_cleanup and pci_cleanup
>>
>> v4:
>> * rebase
>>
>> v3:
>> * add vdev bus cleanup
>>
>> v2:
>> * change log level from INFO to DEBUG for PCI cleanup
>> * add abignore entries for rte_bus related false positives
>>
>> ---
>> devtools/libabigail.abignore | 9 +++++++++
>> drivers/bus/pci/pci_common.c | 24 ++++++++++++++++++++++++
>> drivers/bus/vdev/vdev.c | 24 ++++++++++++++++++++++++
>> lib/eal/common/eal_common_bus.c | 17 +++++++++++++++++
>> lib/eal/common/eal_private.h | 10 ++++++++++
>> lib/eal/freebsd/eal.c | 1 +
>> lib/eal/include/rte_bus.h | 13 +++++++++++++
>> lib/eal/linux/eal.c | 1 +
>> lib/eal/windows/eal.c | 1 +
>> 9 files changed, 100 insertions(+)
>>
>> diff --git a/devtools/libabigail.abignore b/devtools/libabigail.abignore
>> index 79ff15dc4e..3e519ee42a 100644
>> --- a/devtools/libabigail.abignore
>> +++ b/devtools/libabigail.abignore
>> @@ -56,3 +56,12 @@
>> ; Ignore libabigail false-positive in clang builds, after moving code.
>> [suppress_function]
>> name = rte_eal_remote_launch
>> +
>> +; Ignore field inserted to rte_bus, adding cleanup function
>> +[suppress_type]
>> + name = rte_bus
>> + has_data_member_inserted_at = end
>> +
>> +; Ignore changes to internally used structs containing rte_bus
>> +[suppress_type]
>> + name = rte_pci_bus, rte_vmbus_bus, rte_vdev_bus
>> diff --git a/drivers/bus/pci/pci_common.c b/drivers/bus/pci/pci_common.c
>> index 37ab879779..8b132ce5fc 100644
>> --- a/drivers/bus/pci/pci_common.c
>> +++ b/drivers/bus/pci/pci_common.c
>> @@ -394,6 +394,29 @@ pci_probe(void)
>> return (probed && probed == failed) ? -1 : 0;
>> }
>> +static int
>> +pci_cleanup(void)
>> +{
>> + struct rte_pci_device *dev = NULL;
>> + int error = 0;
>> +
>> + FOREACH_DEVICE_ON_PCIBUS(dev) {
>> + struct rte_pci_driver *drv = dev->driver;
>> + int ret = 0;
>> +
>> + if (drv == NULL || drv->remove == NULL)
>> + continue;
>> +
>> + ret = drv->remove(dev);
> All devices, such as, compressdev, ethdev and dmadev, on the bus are
> released here.
> However, the rte_pci_device or rte_vdev_device on the bus allocated
> during EAL init
> are not yet released. Why not free these devices here?
v7 sent with this change added, thanks.
/Kevin
next prev parent reply other threads:[~2022-06-03 14:36 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-19 16:14 [RFC] " Kevin Laatz
2022-04-19 16:36 ` Stephen Hemminger
2022-04-20 6:55 ` Morten Brørup
2022-04-22 9:18 ` Kevin Laatz
2022-04-22 12:14 ` Morten Brørup
2022-04-22 16:27 ` [RFC v2] " Kevin Laatz
2022-05-24 9:08 ` [PATCH v3] " Kevin Laatz
2022-05-24 9:25 ` [PATCH v4] " Kevin Laatz
2022-05-24 9:38 ` Bruce Richardson
2022-05-24 15:19 ` Kevin Laatz
2022-05-24 14:48 ` Stephen Hemminger
2022-05-24 15:20 ` Kevin Laatz
2022-05-25 10:39 ` [PATCH v5] " Kevin Laatz
2022-05-25 11:12 ` Bruce Richardson
2022-05-26 8:36 ` Kevin Laatz
2022-06-01 17:02 ` [PATCH v6] " Kevin Laatz
2022-06-01 17:03 ` Bruce Richardson
2022-06-02 2:06 ` lihuisong (C)
2022-06-03 14:35 ` Kevin Laatz [this message]
2022-06-03 14:36 ` [PATCH v7] " Kevin Laatz
2022-06-03 15:11 ` Stephen Hemminger
2022-06-03 15:39 ` Bruce Richardson
2022-06-04 2:07 ` lihuisong (C)
2022-06-07 11:09 ` Thomas Monjalon
2022-06-07 15:12 ` David Marchand
2022-06-13 15:58 ` Bruce Richardson
2022-10-03 12:35 ` David Marchand
2022-10-03 14:39 ` Kevin Laatz
2022-10-04 13:11 ` [PATCH v8] " Kevin Laatz
2022-10-04 15:28 ` David Marchand
2022-10-04 15:36 ` Kevin Laatz
2022-10-04 16:50 ` [PATCH v9] " Kevin Laatz
2022-10-05 7:45 ` David Marchand
2022-10-05 9:41 ` Thomas Monjalon
2022-10-05 11:03 ` Kevin Laatz
2022-10-05 12:06 ` 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=2ea583db-8738-492f-4119-ff4dff50de5c@intel.com \
--to=kevin.laatz@intel.com \
--cc=dev@dpdk.org \
--cc=lihuisong@huawei.com \
--cc=mb@smartsharesystems.com \
/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).