[Intel-gfx] [PATCH igt] lib: Capture the error state on an unexpected hang

Petri Latvala petri.latvala at intel.com
Thu Sep 28 10:16:08 UTC 2017


On Tue, Sep 12, 2017 at 09:10:25PM +0100, Chris Wilson wrote:
> Dump debugfs/i915_error_state to the debug channel if we detect an ERROR
> uevent. This poses a few problems, not least that it is the auxiliary
> process doing the dumping (so the output may be interleaved with the
> test, but considering a hang occurred it is likely the test is blocked)
> and the average error state is around 60k, which may prove unwieldy!
> 
> On the other hand, it may prove invaluable in debugging those impossible
> to reproduce bugs.
> 
> Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>


Reviewed-by: Petri Latvala <petri.latvala at intel.com>

> ---
>  lib/igt_aux.c | 8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/lib/igt_aux.c b/lib/igt_aux.c
> index 65f832ab..ae076aaa 100644
> --- a/lib/igt_aux.c
> +++ b/lib/igt_aux.c
> @@ -395,7 +395,7 @@ void igt_stop_shrink_helper(void)
>  
>  static struct igt_helper_process hang_detector;
>  static void __attribute__((noreturn))
> -hang_detector_process(pid_t pid, dev_t rdev)
> +hang_detector_process(int fd, pid_t pid, dev_t rdev)
>  {
>  	struct udev_monitor *mon =
>  		udev_monitor_new_from_netlink(udev_new(), "kernel");
> @@ -429,8 +429,10 @@ hang_detector_process(pid_t pid, dev_t rdev)
>  			const char *str;
>  
>  			str = udev_device_get_property_value(dev, "ERROR");
> -			if (str && atoi(str) == 1)
> +			if (str && atoi(str) == 1) {
> +				igt_debugfs_dump(fd, "i915_error_state");
>  				kill(pid, SIGIO);
> +			}
>  		}
>  
>  		udev_device_unref(dev);
> @@ -462,7 +464,7 @@ void igt_fork_hang_detector(int fd)
>  
>  	signal(SIGIO, sig_abort);
>  	igt_fork_helper(&hang_detector)
> -		hang_detector_process(getppid(), st.st_rdev);
> +		hang_detector_process(fd, getppid(), st.st_rdev);
>  }
>  
>  void igt_stop_hang_detector(void)
> -- 
> 2.14.1
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx


More information about the Intel-gfx mailing list