On Tue, Apr 19, 2016 at 03:12:38PM +0200, Maarten Lankhorst wrote:
> When running tests, it will produce warnings like this:
> 
> (core_auth:2552) igt-core-WARNING: Lockdep is turned off.
> 
> This makes sure lockdep warnings during load aren't accidentally ignored.
> 
> Signed-off-by: Maarten Lankhorst <[email protected]>

Ack on the idea.
-Daniel

> ---
> Unfortunately this version suffers from a small problem, piglit still 
> succeeds without WARN. :(
> 
> Seems to be an issue in piglit/tests/igt.py that needs a separate fix.
> 
> diff --git a/lib/igt_core.c b/lib/igt_core.c
> index 832361b0a9f9..bb17ddfbcadb 100644
> --- a/lib/igt_core.c
> +++ b/lib/igt_core.c
> @@ -570,6 +570,39 @@ static void oom_adjust_for_doom(void)
>  
>  }
>  
> +static void igt_warn_lockdep(void)
> +{
> +     FILE *f;
> +     long val;
> +     char line[256];
> +
> +     f = fopen("/proc/lockdep_stats", "r");
> +     if (!f && errno == ENOENT) {
> +             igt_debug("Lockdep is not compiled in.\n");
> +             return;
> +     }
> +
> +     igt_assert(f);
> +
> +     while (fgets(line, sizeof(line), f)) {
> +             if (strncmp(line, " debug_locks:", 13))
> +                     continue;
> +
> +             val = strtol(line + 13, NULL, 10);
> +
> +             if (!val)
> +                     igt_warn("Lockdep is turned off.\n");
> +             else
> +                     igt_debug("Lockdep is active.\n");
> +             goto out;
> +     }
> +
> +     igt_warn("Could not find lockdep setting.\n");
> +
> +out:
> +     fclose(f);
> +}
> +
>  static int common_init(int *argc, char **argv,
>                      const char *extra_short_opts,
>                      const struct option *extra_long_opts,
> @@ -741,6 +774,8 @@ out:
>               low_mem_killer_disable(true);
>       }
>  
> +     igt_warn_lockdep();
> +
>       /* install exit handler, to ensure we clean up */
>       igt_install_exit_handler(common_exit_handler);
>  
> 
> _______________________________________________
> Intel-gfx mailing list
> [email protected]
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

Reply via email to