[igt-dev] [PATCH igt 1/2] lib: force a reset on an uncooperative i915 device

Antonio Argenziano antonio.argenziano at intel.com
Mon Feb 12 21:28:13 UTC 2018



On 09/02/18 03:46, Chris Wilson wrote:
> Try to reset the GPU from within igt_require_gem() if we notice we are
> starting with a wedged device. If it remains wedged, the test definitely
> cannot run. We leave a warning in place to highlight the potentially
> suspect result, which will keep the flip-flops alive in CI!
> 
> Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
> ---
>   lib/ioctl_wrappers.c | 12 +++++++++---
>   1 file changed, 9 insertions(+), 3 deletions(-)
> 
> diff --git a/lib/ioctl_wrappers.c b/lib/ioctl_wrappers.c
> index 10d958726..5d2c82099 100644
> --- a/lib/ioctl_wrappers.c
> +++ b/lib/ioctl_wrappers.c
> @@ -1428,14 +1428,20 @@ void igt_require_gem(int fd)
>   	 * sequences of batches.
>   	 */
>   	err = igt_debugfs_dir(fd);

I would prefer to use two variables, one for the debugfs fd and one for 
-errno for the IOCTL below.

With or without the new variable,
Reviewed-by: Antonio Argenziano <antonio.argenziano at intel.com>

> -	if (err != -1) {
> -		igt_sysfs_printf(err, "i915_next_seqno", "1");
> -		close(err);
> +	igt_require(err >= 0);
> +
> +	if (ioctl(fd, DRM_IOCTL_I915_GEM_THROTTLE)) {
> +		igt_warn("Found wedged device, trying to reset and continue\n");
> +		igt_sysfs_set(err, "i915_wedged", "-1");
>   	}
> +	igt_sysfs_set(err, "i915_next_seqno", "1");
> +
> +	close(err);
>   
>   	err = 0;
>   	if (ioctl(fd, DRM_IOCTL_I915_GEM_THROTTLE))
>   		err = -errno;
> +
>   	close(fd);
>   
>   	igt_require_f(err == 0, "Unresponsive i915/GEM device\n");
> 


More information about the igt-dev mailing list