DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH] bus: invoke TAILQ_REMOVE when bus cleanup
@ 2025-02-20  8:09 Chengwen Feng
  2025-02-20 10:31 ` Morten Brørup
  0 siblings, 1 reply; 2+ messages in thread
From: Chengwen Feng @ 2025-02-20  8:09 UTC (permalink / raw)
  To: thomas, Chenbo Xia, Nipun Gupta, Long Li, Wei Hu,
	Morten Brørup, Kevin Laatz, Bruce Richardson, Huisong Li,
	Zhangfei Gao
  Cc: dev

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

* RE: [PATCH] bus: invoke TAILQ_REMOVE when bus cleanup
  2025-02-20  8:09 [PATCH] bus: invoke TAILQ_REMOVE when bus cleanup Chengwen Feng
@ 2025-02-20 10:31 ` Morten Brørup
  0 siblings, 0 replies; 2+ messages in thread
From: Morten Brørup @ 2025-02-20 10:31 UTC (permalink / raw)
  To: Chengwen Feng, thomas, Chenbo Xia, Nipun Gupta, Long Li, Wei Hu,
	Kevin Laatz, Bruce Richardson, Huisong Li, Zhangfei Gao
  Cc: dev

> From: Chengwen Feng [mailto:fengchengwen@huawei.com]
> Sent: Thursday, 20 February 2025 09.09
> 
> 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>
> ---

Thank you for cleaning this up.

Acked-by: Morten Brørup <mb@smartsharesystems.com>


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-02-20 10:31 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-02-20  8:09 [PATCH] bus: invoke TAILQ_REMOVE when bus cleanup Chengwen Feng
2025-02-20 10:31 ` Morten Brørup

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).