public inbox for igt-dev@lists.freedesktop.org
 help / color / mirror / Atom feed
* [igt-dev] [PATCH i-g-t v2] lib: Fix device lists not cleaned up sufficiently before rescan
@ 2020-04-03 11:47 Janusz Krzysztofik
  2020-04-03 13:29 ` [igt-dev] ✗ Fi.CI.BAT: failure for lib: Fix device lists not cleaned up sufficiently before rescan (rev2) Patchwork
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: Janusz Krzysztofik @ 2020-04-03 11:47 UTC (permalink / raw)
  To: igt-dev; +Cc: intel-gfx, Petri Latvala

Some effort is already taken to clean up previous content of device
lists before forced device rescan is performed but it is not
sufficient.  An attempt to use forced device rescan in a test results
in that test crashing or spinning until being killed by OOM killer.
Fix it.

v2: Remove device from the list before device attributes are destroyed

Signed-off-by: Janusz Krzysztofik <janusz.krzysztofik@linux.intel.com>
Reviewed-by: Zbigniew Kempczyński <zbigniew.kempczynski@intel.com>
---
 lib/igt_device_scan.c | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/lib/igt_device_scan.c b/lib/igt_device_scan.c
index cf7c4d951..30a9704a5 100644
--- a/lib/igt_device_scan.c
+++ b/lib/igt_device_scan.c
@@ -353,14 +353,11 @@ static void set_vendor_device(struct igt_device *dev)
 	dev->device = strndup(pci_id + 5, 4);
 }
 
-/* Allocate arrays for keeping scanned devices */
+/* Initialize lists for keeping scanned devices */
 static bool prepare_scan(void)
 {
-	if (igt_devs.all.prev == NULL || igt_devs.all.next == NULL)
-		IGT_INIT_LIST_HEAD(&igt_devs.all);
-
-	if (igt_devs.filtered.prev == NULL || igt_devs.filtered.next == NULL)
-		IGT_INIT_LIST_HEAD(&igt_devs.filtered);
+	IGT_INIT_LIST_HEAD(&igt_devs.all);
+	IGT_INIT_LIST_HEAD(&igt_devs.filtered);
 
 	return true;
 }
@@ -595,7 +592,14 @@ void igt_devices_scan(bool force)
 {
 	if (force && igt_devs.devs_scanned) {
 		struct igt_device *dev, *tmp;
+
+		igt_list_for_each_entry_safe(dev, tmp, &igt_devs.filtered,
+					     link) {
+			igt_list_del(&dev->link);
+			free(dev);
+		}
 		igt_list_for_each_entry_safe(dev, tmp, &igt_devs.all, link) {
+			igt_list_del(&dev->link);
 			igt_device_free(dev);
 			free(dev);
 		}
-- 
2.21.1

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

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

end of thread, other threads:[~2020-04-06 11:33 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-04-03 11:47 [igt-dev] [PATCH i-g-t v2] lib: Fix device lists not cleaned up sufficiently before rescan Janusz Krzysztofik
2020-04-03 13:29 ` [igt-dev] ✗ Fi.CI.BAT: failure for lib: Fix device lists not cleaned up sufficiently before rescan (rev2) Patchwork
2020-04-03 13:34   ` Janusz Krzysztofik
2020-04-06  7:19     ` Peres, Martin
2020-04-03 14:06 ` [igt-dev] ✓ Fi.CI.BAT: success " Patchwork
2020-04-03 19:25 ` [igt-dev] ✗ Fi.CI.IGT: failure " Patchwork
2020-04-06  9:36   ` Arkadiusz Hiler
2020-04-06  9:38     ` Vudum, Lakshminarayana
2020-04-06 11:33 ` [igt-dev] ✓ Fi.CI.IGT: success " Patchwork

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox