[igt-dev] [PATCH i-g-t] runner: Show why we dump the task state

Jani Nikula jani.nikula at linux.intel.com
Tue Apr 7 08:42:01 UTC 2020


On Tue, 07 Apr 2020, Chris Wilson <chris at chris-wilson.co.uk> wrote:
> Include the reason why we are dumping the task state (test timeout) in
> the kmsg log prior to the task state. Hopefully this helps when reading
> the dump.
>
> Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
> Cc: Petri Latvala <petri.latvala at intel.com>
> ---
>  runner/executor.c | 25 ++++++++++++++++---------
>  1 file changed, 16 insertions(+), 9 deletions(-)
>
> diff --git a/runner/executor.c b/runner/executor.c
> index 1b69f9c57..7061b28d3 100644
> --- a/runner/executor.c
> +++ b/runner/executor.c
> @@ -678,9 +678,20 @@ static bool sysrq(char cmd)
>  	return success;
>  }
>  
> -static void show_kernel_task_state(void)
> +static const char *show_kernel_task_state(const char *msg)
>  {
> +	int fd;
> +
> +	fd = open("/dev/kmsg", O_WRONLY);
> +	if (fd != -1) {
> +		write(fd, "<4>[IGT] ", 7);
> +		write(fd, msg, strlen(msg));
> +		close(fd);
> +	}
> +

igt_kmsg(KMSG_WARNING "%s\n", msg);

BR,
Jani.


>  	sysrq('t');
> +
> +	return msg;
>  }
>  
>  static const char *need_to_timeout(struct settings *settings,
> @@ -725,16 +736,12 @@ static const char *need_to_timeout(struct settings *settings,
>  		return "Killing the test because the kernel is tainted.\n";
>  
>  	if (settings->per_test_timeout != 0 &&
> -	    time_since_subtest > settings->per_test_timeout) {
> -		show_kernel_task_state();
> -		return "Per-test timeout exceeded. Killing the current test with SIGQUIT.\n";
> -	}
> +	    time_since_subtest > settings->per_test_timeout)
> +		return show_kernel_task_state("Per-test timeout exceeded. Killing the current test with SIGQUIT.\n");
>  
>  	if (settings->inactivity_timeout != 0 &&
> -	    time_since_activity > settings->inactivity_timeout) {
> -		show_kernel_task_state();
> -		return "Inactivity timeout exceeded. Killing the current test with SIGQUIT.\n";
> -	}
> +	    time_since_activity > settings->inactivity_timeout)
> +		return show_kernel_task_state("Inactivity timeout exceeded. Killing the current test with SIGQUIT.\n");
>  
>  	return NULL;
>  }

-- 
Jani Nikula, Intel Open Source Graphics Center


More information about the igt-dev mailing list