* [PATCH] tests/intel/xe_wedged: Fix DEVPATH check for cold-reset wedge
@ 2026-12-02 11:57 Sk Anirban
2026-12-02 13:26 ` Raag Jadav
0 siblings, 1 reply; 2+ messages in thread
From: Sk Anirban @ 2026-12-02 11:57 UTC (permalink / raw)
To: igt-dev
Cc: anshuman.gupta, badal.nilawar, riana.tauro, karthik.poosa,
raag.jadav, soham.purkait, mallesh.koujalagi, hiresh.kumar.yadav,
Sk Anirban
The cold-reset-wedged subtest validated the uevent DEVPATH by
looking for the device's PCI BDF in it.
Recent kernel RAS changes moved probe-time error processing to an
earlier point in device initialization. A cold-reset wedge is now
declared before the DRM device is registered, so the uevent
DEVPATH no longer contains the PCI hierarchy. It holds only the
card node, e.g. "DEVPATH=/card0".
Drop the BDF match and compare the last DEVPATH component with
the card name predicted before rebind.
Signed-off-by: Sk Anirban <sk.anirban@intel.com>
---
tests/intel/xe_wedged.c | 39 ++++++++++++++++++++++++++++++++-------
1 file changed, 32 insertions(+), 7 deletions(-)
diff --git a/tests/intel/xe_wedged.c b/tests/intel/xe_wedged.c
index c67a4dda5..07e04927b 100644
--- a/tests/intel/xe_wedged.c
+++ b/tests/intel/xe_wedged.c
@@ -93,7 +93,27 @@ static void force_wedged(int fd)
sleep(1);
}
-static void wait_for_wedged_uevent(struct udev_monitor *mon)
+/*
+ * The card index may change across rebind and the bound device is wedged, so
+ * predict it: DRM reuses the lowest minor that is not held by another device.
+ */
+static void predict_card_name_after_rebind(char *card, size_t len)
+{
+ char path[PATH_MAX], real[PATH_MAX];
+ unsigned int idx;
+
+ for (idx = 0; idx < 64; idx++) {
+ snprintf(path, sizeof(path), "/sys/class/drm/card%u", idx);
+
+ /* Free slot, or our own card which gets released by the unbind */
+ if (!realpath(path, real) || strstr(real, pci_slot))
+ break;
+ }
+
+ snprintf(card, len, "card%u", idx);
+}
+
+static void wait_for_wedged_uevent(struct udev_monitor *mon, const char *card)
{
struct udev_device *dev;
const char *prop_val;
@@ -118,9 +138,10 @@ static void wait_for_wedged_uevent(struct udev_monitor *mon)
if (prop_val && !strcmp(prop_val, "cold-reset")) {
event_received = true;
- igt_assert_f(dev_path && strstr(dev_path, pci_slot),
- "Expected bus address '%s' to be part of DEVPATH '%s'",
- pci_slot, dev_path);
+ igt_assert_f(dev_path &&
+ !strcmp(strrchr(dev_path, '/') + 1, card),
+ "Expected '%s' in DEVPATH '%s'",
+ card, dev_path);
udev_device_unref(dev);
break;
}
@@ -415,6 +436,7 @@ int igt_main()
igt_subtest_f("cold-reset-wedged") {
struct udev_monitor *mon;
+ char card[NAME_MAX];
errno = 0;
igt_skip_on_f(!IS_CRESCENTISLAND(intel_get_drm_devid(fd)),
@@ -430,15 +452,18 @@ int igt_main()
ignore_wedged_in_dmesg();
mon = igt_watch_uevents();
+ predict_card_name_after_rebind(card, sizeof(card));
+
drm_close_driver(fd);
igt_kmod_rebind("xe", pci_slot);
- wait_for_wedged_uevent(mon);
+ wait_for_wedged_uevent(mon, card);
/*
- * Rebind to restore device operation. The first wedge decrements
+ * Bind again to restore device operation. The first wedge decrements
* times to zero, disabling further fault injection even though
* probability remains at 100.
*/
- igt_kmod_rebind("xe", pci_slot);
+ igt_kmod_bind("xe", pci_slot);
+
fd = drm_open_driver(DRIVER_XE);
test_spinner_after_recovery(fd);
}
--
2.43.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] tests/intel/xe_wedged: Fix DEVPATH check for cold-reset wedge
2026-12-02 11:57 [PATCH] tests/intel/xe_wedged: Fix DEVPATH check for cold-reset wedge Sk Anirban
@ 2026-12-02 13:26 ` Raag Jadav
0 siblings, 0 replies; 2+ messages in thread
From: Raag Jadav @ 2026-12-02 13:26 UTC (permalink / raw)
To: Sk Anirban
Cc: igt-dev, anshuman.gupta, badal.nilawar, riana.tauro,
karthik.poosa, soham.purkait, mallesh.koujalagi,
hiresh.kumar.yadav
On Wed, Dec 02, 2026 at 05:27:49PM +0530, Sk Anirban wrote:
> The cold-reset-wedged subtest validated the uevent DEVPATH by
> looking for the device's PCI BDF in it.
>
> Recent kernel RAS changes moved probe-time error processing to an
> earlier point in device initialization. A cold-reset wedge is now
> declared before the DRM device is registered, so the uevent
> DEVPATH no longer contains the PCI hierarchy. It holds only the
> card node, e.g. "DEVPATH=/card0".
>
> Drop the BDF match and compare the last DEVPATH component with
> the card name predicted before rebind.
>
> Signed-off-by: Sk Anirban <sk.anirban@intel.com>
> ---
> tests/intel/xe_wedged.c | 39 ++++++++++++++++++++++++++++++++-------
> 1 file changed, 32 insertions(+), 7 deletions(-)
>
> diff --git a/tests/intel/xe_wedged.c b/tests/intel/xe_wedged.c
> index c67a4dda5..07e04927b 100644
> --- a/tests/intel/xe_wedged.c
> +++ b/tests/intel/xe_wedged.c
> @@ -93,7 +93,27 @@ static void force_wedged(int fd)
> sleep(1);
> }
>
> -static void wait_for_wedged_uevent(struct udev_monitor *mon)
> +/*
> + * The card index may change across rebind and the bound device is wedged, so
> + * predict it: DRM reuses the lowest minor that is not held by another device.
> + */
> +static void predict_card_name_after_rebind(char *card, size_t len)
> +{
> + char path[PATH_MAX], real[PATH_MAX];
> + unsigned int idx;
> +
> + for (idx = 0; idx < 64; idx++) {
Curious, why 64?
> + snprintf(path, sizeof(path), "/sys/class/drm/card%u", idx);
> +
> + /* Free slot, or our own card which gets released by the unbind */
> + if (!realpath(path, real) || strstr(real, pci_slot))
This may seem to work but looks a bit fragile. Let me think of something.
Raag
> + break;
> + }
> +
> + snprintf(card, len, "card%u", idx);
> +}
> +
> +static void wait_for_wedged_uevent(struct udev_monitor *mon, const char *card)
> {
> struct udev_device *dev;
> const char *prop_val;
> @@ -118,9 +138,10 @@ static void wait_for_wedged_uevent(struct udev_monitor *mon)
>
> if (prop_val && !strcmp(prop_val, "cold-reset")) {
> event_received = true;
> - igt_assert_f(dev_path && strstr(dev_path, pci_slot),
> - "Expected bus address '%s' to be part of DEVPATH '%s'",
> - pci_slot, dev_path);
> + igt_assert_f(dev_path &&
> + !strcmp(strrchr(dev_path, '/') + 1, card),
> + "Expected '%s' in DEVPATH '%s'",
> + card, dev_path);
> udev_device_unref(dev);
> break;
> }
> @@ -415,6 +436,7 @@ int igt_main()
>
> igt_subtest_f("cold-reset-wedged") {
> struct udev_monitor *mon;
> + char card[NAME_MAX];
>
> errno = 0;
> igt_skip_on_f(!IS_CRESCENTISLAND(intel_get_drm_devid(fd)),
> @@ -430,15 +452,18 @@ int igt_main()
> ignore_wedged_in_dmesg();
> mon = igt_watch_uevents();
>
> + predict_card_name_after_rebind(card, sizeof(card));
> +
> drm_close_driver(fd);
> igt_kmod_rebind("xe", pci_slot);
> - wait_for_wedged_uevent(mon);
> + wait_for_wedged_uevent(mon, card);
> /*
> - * Rebind to restore device operation. The first wedge decrements
> + * Bind again to restore device operation. The first wedge decrements
> * times to zero, disabling further fault injection even though
> * probability remains at 100.
> */
> - igt_kmod_rebind("xe", pci_slot);
> + igt_kmod_bind("xe", pci_slot);
> +
> fd = drm_open_driver(DRIVER_XE);
> test_spinner_after_recovery(fd);
> }
> --
> 2.43.0
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-12-02 13:28 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-02 11:57 [PATCH] tests/intel/xe_wedged: Fix DEVPATH check for cold-reset wedge Sk Anirban
2026-12-02 13:26 ` Raag Jadav
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.