Skip to contentSkip to conversation

lib/igt_device_scan: Assert if there's no empty PCI_SLOT_NAME

PATCH New Zbigniew Kempczyński 2 participants 2 messages Jul 28, 2022 Library code

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 lib/igt_device_scan: Assert if there's no empty PCI_SLOT_NAME

On one of our testing machines executed i915_pm_rpm@module-reload subtest catches SIGSEGV with following callstack:

Received signal SIGSEGV.
Stack trace:

There's single suspicious code line in devtype_intel() which might trigger this behavior - it is strncmp(). But that means pci_slot variable would be null or point to some garbage. This variable is initialized before from uevent property so lets verify and assert if there's no PCI_SLOT_NAME passed from the kernel for pci device. Additionally dump all properties and attributes to get bigger picture what comes from the kernel to device scanning library.

---
 lib/igt_device_scan.c | 31 ++++++++++++++++++++++++-------
 1 file changed, 24 insertions(+), 7 deletions(-)
lib/igt_device_scan.c +24 -7
index aad7966764..d6fae0650c 100644
@@ -558,6 +558,16 @@ static void get_attrs(struct udev_device *dev, struct igt_device *idev)
 #define is_drm_subsystem(dev)  (strequal(get_prop_subsystem(dev), "drm"))
 #define is_pci_subsystem(dev)  (strequal(get_prop_subsystem(dev), "pci"))
 
+static void print_ht(GHashTable *ht);
+static void dump_props_and_attrs(const struct igt_device *dev)
+{
+	printf("\n[properties]\n");
+	print_ht(dev->props_ht);
+	printf("\n[attributes]\n");
+	print_ht(dev->attrs_ht);
+	printf("\n");
+}
+
 /*
  * Get PCI_SLOT_NAME property, it should be in format of
  * xxxx:yy:zz.z
@@ -565,9 +575,20 @@ static void get_attrs(struct udev_device *dev, struct igt_device *idev)
 static void set_pci_slot_name(struct igt_device *dev)
 {
 	const char *pci_slot_name = get_prop(dev, "PCI_SLOT_NAME");
+	int len;
+
+	if (!pci_slot_name) {
+		dump_props_and_attrs(dev);
+		igt_assert_f(pci_slot_name, "PCI_SLOT_NAME property == NULL\n");
+	}
+
+	len = strlen(pci_slot_name);
+	if (len != PCI_SLOT_NAME_SIZE) {
+		dump_props_and_attrs(dev);
+		igt_assert_f(len != PCI_SLOT_NAME_SIZE,
+			     "PCI_SLOT_NAME length != %d [%s]\n", len, pci_slot_name);
+	}
 
-	if (!pci_slot_name || (strlen(pci_slot_name) != PCI_SLOT_NAME_SIZE))
-		return;
 	dev->pci_slot_name = strdup(pci_slot_name);
 }
 
@@ -1249,11 +1270,7 @@ igt_devs_print_detail(struct igt_list_head *view,
 			_print_key_value("codename", dev->codename);
 		}
 
-		printf("\n[properties]\n");
-		print_ht(dev->props_ht);
-		printf("\n[attributes]\n");
-		print_ht(dev->attrs_ht);
-		printf("\n");
+		dump_props_and_attrs(dev);
 	}
 }
 
Signature · 1 line
2.34.1
#1 lore raw

[igt-dev] ✗ Fi.CI.BAT: failure for lib/igt_device_scan: Assert if there's no empty PCI_SLOT_NAME

== Series Details ==

== Series Details ==

Series: lib/igt_device_scan: Assert if there's no empty PCI_SLOT_NAME
URL : https://patchwork.freedesktop.org/series/106795/
State : failure

== Summary ==

CI Bug Log - changes from IGT_6602 -> IGTPW_7575
====================================================

Summary
-------

**FAILURE**

Serious unknown changes coming with IGTPW_7575 absolutely need to be verified manually.

If you think the reported changes have nothing to do with the changes introduced in IGTPW_7575, please notify your bug team to allow them to document this new failure mode, which will reduce false positives in CI.

External URL: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_7575/index.html

Participating hosts (35 -> 33)
------------------------------

Additional (2): bat-dg2-8 bat-dg2-9
Missing (4): fi-rkl-11600 bat-jsl-3 fi-bdw-samus fi-pnv-d510

Possible new issues
-------------------

Here are the unknown changes that may have been introduced in IGTPW_7575:

### IGT changes ###

#### Possible regressions ####

* igt@kms_cursor_legacy@basic-flip-after-cursor@toggle:
- fi-bsw-kefka: [PASS][1] -> [FAIL][2]
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_6602/fi-bsw-kefka/igt@kms_cursor_legacy@[email protected]
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_7575/fi-bsw-kefka/igt@kms_cursor_legacy@[email protected]

Known issues
------------

Here are the changes found in IGTPW_7575 that come from known issues:

### IGT changes ###

#### Issues hit ####

* igt@i915_pm_rpm@module-reload:
- fi-cfl-8109u: [PASS][3] -> [DMESG-FAIL][4] ([i915#62])
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_6602/fi-cfl-8109u/igt@[email protected]
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_7575/fi-cfl-8109u/igt@[email protected]

* igt@i915_selftest@live@hangcheck:
- fi-hsw-4770: [PASS][5] -> [INCOMPLETE][6] ([i915#4785])
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_6602/fi-hsw-4770/igt@i915_selftest@[email protected]
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_7575/fi-hsw-4770/igt@i915_selftest@[email protected]

* igt@i915_selftest@live@ring_submission:
- fi-cfl-8109u: [PASS][7] -> [DMESG-WARN][8] ([i915#5904]) +29 similar issues
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_6602/fi-cfl-8109u/igt@i915_selftest@live@ring_submission.html
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_7575/fi-cfl-8109u/igt@i915_selftest@live@ring_submission.html

* igt@i915_suspend@basic-s2idle-without-i915:
- fi-cfl-8109u: [PASS][9] -> [DMESG-WARN][10] ([i915#5904] / [i915#62])
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_6602/fi-cfl-8109u/igt@[email protected]
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_7575/fi-cfl-8109u/igt@[email protected]

* igt@kms_frontbuffer_tracking@basic:
- fi-cfl-8109u: [PASS][11] -> [DMESG-WARN][12] ([i915#62]) +12 similar issues
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_6602/fi-cfl-8109u/igt@[email protected]
[12]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_7575/fi-cfl-8109u/igt@[email protected]

* igt@runner@aborted:
- fi-hsw-4770: NOTRUN -> [FAIL][13] ([fdo#109271] / [i915#4312] / [i915#5594] / [i915#6246])
[13]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_7575/fi-hsw-4770/igt@[email protected]

{name}: This element is suppressed. This means it is ignored when computing
the status of the difference (SUCCESS, WARNING, or FAILURE).

[fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271
[fdo#109285]: https://bugs.freedesktop.org/show_bug.cgi?id=109285
[fdo#111827]: https://bugs.freedesktop.org/show_bug.cgi?id=111827
[i915#1072]: https://gitlab.freedesktop.org/drm/intel/issues/1072
[i915#1155]: https://gitlab.freedesktop.org/drm/intel/issues/1155
[i915#2582]: https://gitlab.freedesktop.org/drm/intel/issues/2582
[i915#3291]: https://gitlab.freedesktop.org/drm/intel/issues/3291
[i915#3555]: https://gitlab.freedesktop.org/drm/intel/issues/3555
[i915#3595]: https://gitlab.freedesktop.org/drm/intel/issues/3595
[i915#3708]: https://gitlab.freedesktop.org/drm/intel/issues/3708
[i915#4077]: https://gitlab.freedesktop.org/drm/intel/issues/4077
[i915#4079]: https://gitlab.freedesktop.org/drm/intel/issues/4079
[i915#4083]: https://gitlab.freedesktop.org/drm/intel/issues/4083
[i915#4103]: https://gitlab.freedesktop.org/drm/intel/issues/4103
[i915#4212]: https://gitlab.freedesktop.org/drm/intel/issues/4212
[i915#4213]: https://gitlab.freedesktop.org/drm/intel/issues/4213
[i915#4215]: https://gitlab.freedesktop.org/drm/intel/issues/4215
[i915#4312]: https://gitlab.freedesktop.org/drm/intel/issues/4312
[i915#4579]: https://gitlab.freedesktop.org/drm/intel/issues/4579
[i915#4785]: https://gitlab.freedesktop.org/drm/intel/issues/4785
[i915#4873]: https://gitlab.freedesktop.org/drm/intel/issues/4873
[i915#5122]: https://gitlab.freedesktop.org/drm/intel/issues/5122
[i915#5190]: https://gitlab.freedesktop.org/drm/intel/issues/5190
[i915#5274]: https://gitlab.freedesktop.org/drm/intel/issues/5274
[i915#5354]: https://gitlab.freedesktop.org/drm/intel/issues/5354
[i915#5594]: https://gitlab.freedesktop.org/drm/intel/issues/5594
[i915#5763]: https://gitlab.freedesktop.org/drm/intel/issues/5763
[i915#5836]: https://gitlab.freedesktop.org/drm/intel/issues/5836
[i915#5903]: https://gitlab.freedesktop.org/drm/intel/issues/5903
[i915#5904]: https://gitlab.freedesktop.org/drm/intel/issues/5904
[i915#62]: https://gitlab.freedesktop.org/drm/intel/issues/62
[i915#6246]: https://gitlab.freedesktop.org/drm/intel/issues/6246
[i915#6380]: https://gitlab.freedesktop.org/drm/intel/issues/6380
[i915#6477]: https://gitlab.freedesktop.org/drm/intel/issues/6477

Build changes
-------------

* CI: CI-20190529 -> None
* IGT: IGT_6602 -> IGTPW_7575

CI-20190529: 20190529
CI_DRM_11946: 0e9c43d76a145712da46e935d429ce2a3eea80e8 @ git://anongit.freedesktop.org/gfx-ci/linux
IGTPW_7575: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_7575/index.html
IGT_6602: 5a8fa05a824032aab4c8980727a075f71065e27c @ https://gitlab.freedesktop.org/drm/igt-gpu-tools.git

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_7575/index.html