public inbox for igt-dev@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Petri Latvala <petri.latvala@intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>
Cc: igt-dev@lists.freedesktop.org
Subject: Re: [igt-dev] [PATCH i-g-t] runner: Be patient for processes to die
Date: Tue, 27 Nov 2018 11:32:32 +0200	[thread overview]
Message-ID: <20181127093232.GG17124@platvala-desk.ger.corp.intel.com> (raw)
In-Reply-To: <20181126213744.32050-1-chris@chris-wilson.co.uk>

On Mon, Nov 26, 2018 at 09:37:44PM +0000, Chris Wilson wrote:
> Some machines are very slow and some processes hog a lot of resources
> and so take much longer than a mere 2s to be terminated. Be patient.
> 
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=108073
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> ---
>  runner/executor.c | 44 ++++++++++++++++++++++++++++++--------------
>  1 file changed, 30 insertions(+), 14 deletions(-)
> 
> diff --git a/runner/executor.c b/runner/executor.c
> index 2038c3fda..927696044 100644
> --- a/runner/executor.c
> +++ b/runner/executor.c
> @@ -137,27 +137,36 @@ static char *handle_lockdep(void)
>  	return NULL;
>  }
>  
> -static char *handle_taint(void)
> +
> +static unsigned long tainted(unsigned long *taints)


An extra newline slipped in here.


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



>  {
>  	const unsigned long bad_taints =
>  		0x20  | /* TAINT_PAGE */
>  		0x80  | /* TAINT_DIE */
>  		0x200; /* TAINT_OOPS */
> -	unsigned long taints = 0;
> -	char *reason = NULL;
>  	FILE *f;
>  
> +	*taints = 0;
> +
>  	f = fopen("/proc/sys/kernel/tainted", "r");
>  	if (f) {
> -		fscanf(f, "%lu", &taints);
> +		fscanf(f, "%lu", taints);
>  		fclose(f);
>  	}
>  
> -	if (taints & bad_taints)
> -		asprintf(&reason,
> -			 "Kernel tainted (%#lx -- %lx)",
> -			 taints, taints & bad_taints);
> +	return *taints & bad_taints;
> +}
> +
> +static char *handle_taint(void)
> +{
> +	unsigned long taints, bad_taints;
> +	char *reason;
> +
> +	bad_taints = tainted(&taints);
> +	if (!bad_taints)
> +		return NULL;
>  
> +	asprintf(&reason, "Kernel tainted (%#lx -- %lx)", taints, bad_taints);
>  	return reason;
>  }
>  
> @@ -437,6 +446,7 @@ static int monitor_output(pid_t child,
>  	int wd_extra = 10;
>  	int killed = 0; /* 0 if not killed, signal number otherwise */
>  	struct timespec time_beg, time_end;
> +	unsigned long taints = 0;
>  	bool aborting = false;
>  
>  	igt_gettime(&time_beg);
> @@ -493,10 +503,8 @@ static int monitor_output(pid_t child,
>  		}
>  
>  		if (n == 0) {
> -			intervals_left--;
> -			if (intervals_left) {
> +			if (--intervals_left)
>  				continue;
> -			}
>  
>  			ping_watchdogs();
>  
> @@ -504,6 +512,7 @@ static int monitor_output(pid_t child,
>  			case 0:
>  				if (settings->log_level >= LOG_LEVEL_NORMAL) {
>  					printf("Timeout. Killing the current test with SIGTERM.\n");
> +					fflush(stdout);
>  				}
>  
>  				killed = SIGTERM;
> @@ -514,13 +523,14 @@ static int monitor_output(pid_t child,
>  				 * Now continue the loop and let the
>  				 * dying child be handled normally.
>  				 */
> -				timeout = 2; /* Timeout for waiting selected by fair dice roll. */
> -				watchdogs_set_timeout(20);
> +				timeout = 20;
> +				watchdogs_set_timeout(120);
>  				intervals_left = timeout_intervals = 1;
>  				break;
>  			case SIGTERM:
>  				if (settings->log_level >= LOG_LEVEL_NORMAL) {
>  					printf("Timeout. Killing the current test with SIGKILL.\n");
> +					fflush(stdout);
>  				}
>  
>  				killed = SIGKILL;
> @@ -530,9 +540,15 @@ static int monitor_output(pid_t child,
>  				intervals_left = timeout_intervals = 1;
>  				break;
>  			case SIGKILL:
> +				if (kill(0, child) == 0 && !tainted(&taints)) {
> +					intervals_left =  1;
> +					break;
> +				}
> +
>  				/* Nothing that can be done, really. Let's tell the caller we want to abort. */
>  				if (settings->log_level >= LOG_LEVEL_NORMAL) {
> -					fprintf(stderr, "Child refuses to die. Aborting.\n");
> +					fprintf(stderr, "Child refuses to die, tainted %x. Aborting.\n",
> +						taints);
>  				}
>  				close_watchdogs(settings);
>  				free(outbuf);
> -- 
> 2.20.0.rc1
> 
> _______________________________________________
> igt-dev mailing list
> igt-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/igt-dev
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

  parent reply	other threads:[~2018-11-27  9:32 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-26 21:37 [igt-dev] [PATCH i-g-t] runner: Be patient for processes to die Chris Wilson
2018-11-26 22:44 ` [igt-dev] ✓ Fi.CI.BAT: success for " Patchwork
2018-11-27  2:58 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
2018-11-27  9:32 ` Petri Latvala [this message]
2018-11-27  9:41   ` [igt-dev] [PATCH i-g-t] " Chris Wilson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181127093232.GG17124@platvala-desk.ger.corp.intel.com \
    --to=petri.latvala@intel.com \
    --cc=chris@chris-wilson.co.uk \
    --cc=igt-dev@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox