[PATCH i-g-t 4/4] lib/igt_device_scan: Fix scan vs bind/unbind/reload

Kamil Konieczny kamil.konieczny at linux.intel.com
Wed Dec 18 08:20:16 UTC 2024


Hi Lucas,
On 2024-12-17 at 21:13:24 -0800, Lucas De Marchi wrote:
> There's no guarantee a card will end up with the same device node when
> modules are loaded/unloaded and drivers bound/unbound. There's some
> fundamental issue with the igt's the way it is and it's also puzzling
> from the logs it looks like the device vanished from the bus, when in
> reality is just the SW state out of sync with what the kernel is
> exporting.
> 
> Re-scanning when trying to match a device is not expensive compared to
> what most tests are doing, so simply force it to occur whenever trying
> to match a card.
> 
> Example for xe_wedged:
> 
> 	$ sudo ./build/tests/xe_wedged --device pci:0000:03:00.0 --r wedged-at-any-timeout
> 	(xe_wedged:11173) drmtest-DEBUG: Looking for devices to open using filter 0: pci:0000:03:00.0
> 	(xe_wedged:11173) drmtest-DEBUG: Filter matched /dev/dri/card1 | /dev/dri/renderD129
> 
> 	... [ wedge and rebind here ]
> 
> 	(xe_wedged:11173) drmtest-DEBUG: Looking for devices to open using filter 0: pci:0000:03:00.0
> 	(xe_wedged:11173) drmtest-DEBUG: Filter matched /dev/dri/card2 | /dev/dri/renderD130

I tried to tackle this problem in patch here:
https://patchwork.freedesktop.org/patch/626243/?series=140511&rev=6
[i-g-t,v4,3/4] lib/drmtest: invalidate cached fds after unbind

so next call to drm_open_driver() will start anew, like
after test just starts.

Regards,
Kamil

> 
> Signed-off-by: Lucas De Marchi <lucas.demarchi at intel.com>
> ---
>  lib/igt_device_scan.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/lib/igt_device_scan.c b/lib/igt_device_scan.c
> index 8e2297087..956719fba 100644
> --- a/lib/igt_device_scan.c
> +++ b/lib/igt_device_scan.c
> @@ -1983,7 +1983,7 @@ static bool __igt_device_card_match(const char *filter,
>  	 * Scan devices in case the user hasn't yet,
>  	 * but leave a decision on forced rescan on the user side.
>  	 */
> -	igt_devices_scan(false);
> +	igt_devices_scan(true);
>  
>  	if (igt_device_filter_apply(filter) == false)
>  		return false;
> -- 
> 2.47.0
> 


More information about the igt-dev mailing list