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] lib: Show stacktrace when terminated by runner
Date: Tue, 27 Nov 2018 15:29:54 +0200 [thread overview]
Message-ID: <20181127132954.GJ17124@platvala-desk.ger.corp.intel.com> (raw)
In-Reply-To: <20181127132216.17160-1-chris@chris-wilson.co.uk>
On Tue, Nov 27, 2018 at 01:22:16PM +0000, Chris Wilson wrote:
> The igt_runner sends a SIGTERM to ask the test to cleanly exit upon an
> external timeout. It is useful to know what the code was doing when the
> timeout occurred, just in case it was unexpectedly stuck. However, since
> we use SIGTERM internally to marshal helper processes, we want to keep
> SIGTERM quiet, and so opt to use SIGQUIT for the timeout request
> instead.
>
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Petri Latvala <petri.latvala@intel.com>
Reviewed-by: Petri Latvala <petri.latvala@intel.com>
> ---
> lib/igt_core.c | 27 +++++++++++++++++++++------
> runner/executor.c | 8 ++++----
> 2 files changed, 25 insertions(+), 10 deletions(-)
>
> diff --git a/lib/igt_core.c b/lib/igt_core.c
> index e0989f538..64883d640 100644
> --- a/lib/igt_core.c
> +++ b/lib/igt_core.c
> @@ -1852,14 +1852,29 @@ static struct {
>
> static igt_exit_handler_t exit_handler_fn[MAX_EXIT_HANDLERS];
> static bool exit_handler_disabled;
> +static const struct {
> + int number;
> + const char *name;
> + size_t name_len;
> +} handled_signals[] = {
> #define SIGDEF(x) { x, #x, sizeof(#x) - 1 }
> #define SILENT(x) { x, NULL, 0 }
> -static const struct { int number; const char *name; size_t name_len; } handled_signals[] =
> - { SILENT(SIGINT), SILENT(SIGHUP), SILENT(SIGTERM), SILENT(SIGQUIT),
> - SILENT(SIGPIPE), SIGDEF(SIGABRT), SIGDEF(SIGSEGV), SIGDEF(SIGBUS),
> - SIGDEF(SIGFPE) };
> +
> + SILENT(SIGINT),
> + SILENT(SIGHUP),
> + SILENT(SIGPIPE),
> + SILENT(SIGTERM),
> +
> + SIGDEF(SIGQUIT), /* used by igt_runner for its external timeout */
> +
> + SIGDEF(SIGABRT),
> + SIGDEF(SIGSEGV),
> + SIGDEF(SIGBUS),
> + SIGDEF(SIGFPE)
> +
> #undef SILENT
> #undef SIGDEF
> +};
>
> static int install_sig_handler(int sig_num, sighandler_t handler)
> {
> @@ -1940,15 +1955,15 @@ static void fatal_sig_handler(int sig)
> __write_stderr(handled_signals[i].name,
> handled_signals[i].name_len);
> write_stderr(".\n");
> +
> + print_backtrace_sig_safe();
> }
>
> if (crash_signal(sig)) {
> /* Linux standard to return exit code as 128 + signal */
> if (!failed_one)
> igt_exitcode = 128 + sig;
> -
> failed_one = true;
> - print_backtrace_sig_safe();
>
> if (in_subtest)
> exit_subtest("CRASH");
> diff --git a/runner/executor.c b/runner/executor.c
> index 4a0a1219a..4b5e01fdb 100644
> --- a/runner/executor.c
> +++ b/runner/executor.c
> @@ -510,11 +510,11 @@ static int monitor_output(pid_t child,
> switch (killed) {
> case 0:
> if (settings->log_level >= LOG_LEVEL_NORMAL) {
> - printf("Timeout. Killing the current test with SIGTERM.\n");
> + printf("Timeout. Killing the current test with SIGQUIT.\n");
> fflush(stdout);
> }
>
> - killed = SIGTERM;
> + killed = SIGQUIT;
> if (!kill_child(killed, child))
> return -1;
>
> @@ -526,7 +526,7 @@ static int monitor_output(pid_t child,
> watchdogs_set_timeout(120);
> intervals_left = timeout_intervals = 1;
> break;
> - case SIGTERM:
> + case SIGQUIT:
> if (settings->log_level >= LOG_LEVEL_NORMAL) {
> printf("Timeout. Killing the current test with SIGKILL.\n");
> fflush(stdout);
> @@ -706,7 +706,7 @@ static int monitor_output(pid_t child,
>
> aborting = true;
> timeout = 2;
> - killed = SIGTERM;
> + killed = SIGQUIT;
> if (!kill_child(killed, child))
> return -1;
>
> --
> 2.20.0.rc1
>
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
next prev parent reply other threads:[~2018-11-27 13:29 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-27 13:22 [igt-dev] [PATCH i-g-t] lib: Show stacktrace when terminated by runner Chris Wilson
2018-11-27 13:29 ` Petri Latvala [this message]
2018-11-27 13:55 ` [igt-dev] ✗ Fi.CI.BAT: failure for " Patchwork
2018-11-27 14:02 ` [igt-dev] ✓ Fi.CI.BAT: success " Patchwork
2018-11-27 15:28 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
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=20181127132954.GJ17124@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