public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
* [RFC PATCH i-g-t] lib: Add warning if lockdep is disabled before a test.
@ 2016-04-19 13:12 Maarten Lankhorst
  2016-04-20 14:17 ` Daniel Vetter
  0 siblings, 1 reply; 2+ messages in thread
From: Maarten Lankhorst @ 2016-04-19 13:12 UTC (permalink / raw)
  To: Intel Graphics Development

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

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-04-20 14:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-04-19 13:12 [RFC PATCH i-g-t] lib: Add warning if lockdep is disabled before a test Maarten Lankhorst
2016-04-20 14:17 ` Daniel Vetter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox