All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chris Wilson <chris@chris-wilson.co.uk>
To: Petri Latvala <petri.latvala@intel.com>, igt-dev@lists.freedesktop.org
Cc: Tomi Sarvela <tomi.p.sarvela@intel.com>,
	Petri Latvala <petri.latvala@intel.com>,
	Martin Peres <martin.peres@linux.intel.com>
Subject: Re: [igt-dev] [PATCH i-g-t 1/1] runner: Implement --abort-on-monitored-error
Date: Fri, 02 Nov 2018 12:24:54 +0000	[thread overview]
Message-ID: <154116149410.30246.3371254971372855644@skylake-alporthouse-com> (raw)
In-Reply-To: <20181102120848.28899-1-petri.latvala@intel.com>

Quoting Petri Latvala (2018-11-02 12:08:48)
> Deviating a bit from the piglit command line flag, igt_runner takes an
> optional comma-separated list as an argument to
> --abort-on-monitored-error for the list of conditions to abort
> on. Without a list all possible conditions will be checked.
> 
> Two conditions implemented:
>  - "taint" checks the kernel taint level for TAINT_PAGE, TAINT_DIE and
>  TAINT_OOPS
>  - "lockdep" checks the kernel lockdep status
> 
> Checking is done after every test binary execution, and if an abort
> condition is met, the reason is printed to stderr (unless log level is
> quiet) and the runner doesn't execute any further tests. Aborting
> between subtests (when running in --multiple-mode) is not done.
> 
> A TODO item for the future is having aborting appear in the test
> results.
> 
> Signed-off-by: Petri Latvala <petri.latvala@intel.com>
> Cc: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
> Cc: Tomi Sarvela <tomi.p.sarvela@intel.com>
> Cc: Martin Peres <martin.peres@linux.intel.com>
> Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
> ---
> 
> It should be noted that this is automatically active in CI, for it
> gives --abort-on-monitored-error without a list to igt_runner already.
> 
> 
>  runner/executor.c     | 92 ++++++++++++++++++++++++++++++++++++++++---
>  runner/runner_tests.c | 49 ++++++++++++++++++++---
>  runner/settings.c     | 75 ++++++++++++++++++++++++++++++++---
>  runner/settings.h     |  8 +++-
>  4 files changed, 206 insertions(+), 18 deletions(-)
> 
> diff --git a/runner/executor.c b/runner/executor.c
> index fc79f772..98c31f36 100644
> --- a/runner/executor.c
> +++ b/runner/executor.c
> @@ -108,6 +108,79 @@ static void ping_watchdogs(void)
>         }
>  }
>  
> +static bool handle_lockdep(struct settings *settings)
> +{
> +       FILE *f = fopen("/proc/lockdep_stats", "r");
> +       const char *debug_locks_line = " debug_locks:";
> +       char buf[512];
> +       int val;
> +
> +       if (!f)
> +               return false;
> +
> +       while (fgets(buf, sizeof(buf), f) != NULL) {
> +               if (!strncmp(buf, debug_locks_line, strlen(debug_locks_line))) {

There's no guarantee here that you have the complete line within the
buf before parsing. Try getline() instead.

> +                       char *p = buf + strlen(debug_locks_line);
> +                       if (sscanf(p, "%d", &val) == 1 &&
> +                           val != 0) {
> +                               if (settings->log_level >= LOG_LEVEL_NORMAL) {
> +                                       fprintf(stderr, "Lockdep triggered, aborting\n");
> +                               }
> +                               return true;
> +                       }
> +
> +                       break;
> +               }
> +       }
> +
> +       return false;
> +}
> +
> +static bool handle_taint(struct settings *settings)
> +{
> +       FILE *f = fopen("/proc/sys/kernel/tainted", "r");
> +       int taint;

The value is (unsigned) long, important if we ever get more than 32b of
taints on 64b machines.
-Chris
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

  parent reply	other threads:[~2018-11-02 12:25 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-02 12:08 [igt-dev] [PATCH i-g-t 1/1] runner: Implement --abort-on-monitored-error Petri Latvala
2018-11-02 12:24 ` Martin Peres
2018-11-02 12:24 ` Chris Wilson [this message]
2018-11-02 12:53 ` [igt-dev] [PATCH i-g-t v2 " Petri Latvala
2018-11-02 13:26   ` [igt-dev] [PATCH i-g-t v3 " Petri Latvala
2018-11-02 13:06 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,1/1] " Patchwork
2018-11-02 14:55 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,v3,1/1] runner: Implement --abort-on-monitored-error (rev3) Patchwork
2018-11-02 16:39 ` [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=154116149410.30246.3371254971372855644@skylake-alporthouse-com \
    --to=chris@chris-wilson.co.uk \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=martin.peres@linux.intel.com \
    --cc=petri.latvala@intel.com \
    --cc=tomi.p.sarvela@intel.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.