diff mbox series

[i-g-t,1/2] tests/device_reset: Wait for device nodes to re-appear

Message ID 20240726084022.356654-5-janusz.krzysztofik@linux.intel.com (mailing list archive)
State New, archived
Headers show
Series tests/device_reset: Wait for device nodes to re-appear | expand

Commit Message

Janusz Krzysztofik July 26, 2024, 8:34 a.m. UTC
CI sporadically reports the following issue:

(device_reset:1335) DEBUG: rebind the driver to the device
(device_reset:1335) DEBUG: reopen the device
(device_reset:1335) drmtest-DEBUG: Looking for devices to open using filter 0: sys:/sys/devices/pci0000:00/0000:00:02.0
(device_reset:1335) drmtest-DEBUG: Filter matched  | /dev/dri/renderD128
(device_reset:1335) drmtest-WARNING: No card matches the filter! [sys:/sys/devices/pci0000:00/0000:00:02.0]
(device_reset:1335) CRITICAL: Test assertion failure function healthcheck, file ../../../usr/src/igt-gpu-tools/tests/device_reset.c:393:
(device_reset:1335) CRITICAL: Failed assertion: dev->fds.dev >= 0
(device_reset:1335) CRITICAL: Last errno: 22, Invalid argument
(device_reset:1335) CRITICAL: file descriptor dev->fds.dev failed

After rebinding a DRM device driver, we now immediately start looking for
DRM devices that match our PCI filter established before unbind.  The
above messages indicate that occasionally not all device nodes are ready
by the time we are doing that.

Introduce a delay to give the kernel a chance to re-create in devtmpfs all
device nodes we are going to scan for.

Closes: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/11626
Signed-off-by: Janusz Krzysztofik <janusz.krzysztofik@linux.intel.com>
---
 tests/device_reset.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Kamil Konieczny July 26, 2024, 11:46 a.m. UTC | #1
Hi Janusz,
On 2024-07-26 at 10:34:56 +0200, Janusz Krzysztofik wrote:
> CI sporadically reports the following issue:
> 
> (device_reset:1335) DEBUG: rebind the driver to the device
> (device_reset:1335) DEBUG: reopen the device
> (device_reset:1335) drmtest-DEBUG: Looking for devices to open using filter 0: sys:/sys/devices/pci0000:00/0000:00:02.0
> (device_reset:1335) drmtest-DEBUG: Filter matched  | /dev/dri/renderD128
> (device_reset:1335) drmtest-WARNING: No card matches the filter! [sys:/sys/devices/pci0000:00/0000:00:02.0]
> (device_reset:1335) CRITICAL: Test assertion failure function healthcheck, file ../../../usr/src/igt-gpu-tools/tests/device_reset.c:393:
> (device_reset:1335) CRITICAL: Failed assertion: dev->fds.dev >= 0
> (device_reset:1335) CRITICAL: Last errno: 22, Invalid argument
> (device_reset:1335) CRITICAL: file descriptor dev->fds.dev failed
> 
> After rebinding a DRM device driver, we now immediately start looking for
> DRM devices that match our PCI filter established before unbind.  The
> above messages indicate that occasionally not all device nodes are ready
> by the time we are doing that.
> 
> Introduce a delay to give the kernel a chance to re-create in devtmpfs all
> device nodes we are going to scan for.
> 
> Closes: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/11626
> Signed-off-by: Janusz Krzysztofik <janusz.krzysztofik@linux.intel.com>

LGTM,
Reviewed-by: Kamil Konieczny <kamil.konieczny@linux.intel.com>

> ---
>  tests/device_reset.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/tests/device_reset.c b/tests/device_reset.c
> index a669e1224e..8ed3ef5220 100644
> --- a/tests/device_reset.c
> +++ b/tests/device_reset.c
> @@ -385,6 +385,8 @@ static bool is_i915_wedged(int i915)
>  static void healthcheck(struct device_fds *dev)
>  {
>  	if (dev->fds.dev == -1) {
> +		/* give the kernel a breath for re-creating device nodes in devtmpfs */
> +		sleep(1);
>  		/* refresh device list */
>  		igt_devices_scan(true);
>  		igt_debug("reopen the device\n");
> -- 
> 2.45.2
>
diff mbox series

Patch

diff --git a/tests/device_reset.c b/tests/device_reset.c
index a669e1224e..8ed3ef5220 100644
--- a/tests/device_reset.c
+++ b/tests/device_reset.c
@@ -385,6 +385,8 @@  static bool is_i915_wedged(int i915)
 static void healthcheck(struct device_fds *dev)
 {
 	if (dev->fds.dev == -1) {
+		/* give the kernel a breath for re-creating device nodes in devtmpfs */
+		sleep(1);
 		/* refresh device list */
 		igt_devices_scan(true);
 		igt_debug("reopen the device\n");