public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
To: Intel Graphics Development <intel-gfx@lists.freedesktop.org>
Subject: [RFC PATCH i-g-t] lib: Add warning if lockdep is disabled before a test.
Date: Tue, 19 Apr 2016 15:12:38 +0200	[thread overview]
Message-ID: <57162EC6.7070709@linux.intel.com> (raw)

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 <maarten.lankhorst@linux.intel.com>
---
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
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

             reply	other threads:[~2016-04-19 13:12 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-19 13:12 Maarten Lankhorst [this message]
2016-04-20 14:17 ` [RFC PATCH i-g-t] lib: Add warning if lockdep is disabled before a test Daniel Vetter

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=57162EC6.7070709@linux.intel.com \
    --to=maarten.lankhorst@linux.intel.com \
    --cc=intel-gfx@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