From: Chengwen Feng <fengchengwen@huawei.com>
To: thomas@monjalon.net, "Chenbo Xia" <chenbox@nvidia.com>,
"Nipun Gupta" <nipun.gupta@amd.com>,
"Long Li" <longli@microsoft.com>, "Wei Hu" <weh@microsoft.com>,
"Morten Brørup" <mb@smartsharesystems.com>,
"Kevin Laatz" <kevin.laatz@intel.com>,
"Bruce Richardson" <bruce.richardson@intel.com>,
"Huisong Li" <lihuisong@huawei.com>,
"Zhangfei Gao" <zhangfei.gao@linaro.org>
Cc: <dev@dpdk.org>
Subject: [PATCH] bus: invoke TAILQ_REMOVE when bus cleanup
Date: Thu, 20 Feb 2025 16:09:06 +0800 [thread overview]
Message-ID: <20250220080906.49705-1-fengchengwen@huawei.com> (raw)
Although eal_bus_cleanup() is not invoked for multiple times, this is a
good programming habit to remove the device object from list when
cleanup bus.
Fixes: 1cab1a40ea9b ("bus: cleanup devices on shutdown")
Fixes: 62b906cf06ba ("bus/uacce: introduce UACCE bus")
Fixes: 65780eada9d9 ("bus/vmbus: support cleanup")
Cc: stable@dpdk.org
Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
---
drivers/bus/pci/pci_common.c | 1 +
drivers/bus/uacce/uacce.c | 1 +
drivers/bus/vdev/vdev.c | 1 +
drivers/bus/vmbus/vmbus_common.c | 1 +
4 files changed, 4 insertions(+)
diff --git a/drivers/bus/pci/pci_common.c b/drivers/bus/pci/pci_common.c
index 1173f0887c..2e6d7e43dc 100644
--- a/drivers/bus/pci/pci_common.c
+++ b/drivers/bus/pci/pci_common.c
@@ -459,6 +459,7 @@ pci_cleanup(void)
rte_intr_instance_free(dev->vfio_req_intr_handle);
dev->vfio_req_intr_handle = NULL;
+ TAILQ_REMOVE(&rte_pci_bus.device_list, dev, next);
pci_free(RTE_PCI_DEVICE_INTERNAL(dev));
}
diff --git a/drivers/bus/uacce/uacce.c b/drivers/bus/uacce/uacce.c
index 9ca048122d..75a07957bf 100644
--- a/drivers/bus/uacce/uacce.c
+++ b/drivers/bus/uacce/uacce.c
@@ -454,6 +454,7 @@ uacce_cleanup(void)
dev->device.driver = NULL;
free:
+ TAILQ_REMOVE(&uacce_bus.device_list, dev, next);
memset(dev, 0, sizeof(*dev));
free(dev);
}
diff --git a/drivers/bus/vdev/vdev.c b/drivers/bus/vdev/vdev.c
index ec7abe7cda..ae79cfd049 100644
--- a/drivers/bus/vdev/vdev.c
+++ b/drivers/bus/vdev/vdev.c
@@ -596,6 +596,7 @@ vdev_cleanup(void)
dev->device.driver = NULL;
free:
+ TAILQ_REMOVE(&vdev_device_list, dev, next);
free(dev);
}
diff --git a/drivers/bus/vmbus/vmbus_common.c b/drivers/bus/vmbus/vmbus_common.c
index 8a965d10d9..4dac5a6298 100644
--- a/drivers/bus/vmbus/vmbus_common.c
+++ b/drivers/bus/vmbus/vmbus_common.c
@@ -238,6 +238,7 @@ rte_vmbus_cleanup(void)
dev->driver = NULL;
dev->device.driver = NULL;
+ TAILQ_REMOVE(&rte_vmbus_bus.device_list, dev, next);
free(dev);
}
--
2.17.1
next reply other threads:[~2025-02-20 8:09 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-20 8:09 Chengwen Feng [this message]
2025-02-20 10:31 ` Morten Brørup
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=20250220080906.49705-1-fengchengwen@huawei.com \
--to=fengchengwen@huawei.com \
--cc=bruce.richardson@intel.com \
--cc=chenbox@nvidia.com \
--cc=dev@dpdk.org \
--cc=kevin.laatz@intel.com \
--cc=lihuisong@huawei.com \
--cc=longli@microsoft.com \
--cc=mb@smartsharesystems.com \
--cc=nipun.gupta@amd.com \
--cc=thomas@monjalon.net \
--cc=weh@microsoft.com \
--cc=zhangfei.gao@linaro.org \
/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).