Skip to contentSkip to conversation

lib: Add warning if lockdep is disabled before a test.

RFC PATCH In review Maarten Lankhorst 2 participants 2 messages Apr 19, 2016 – Apr 20, 2016 Library code

lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/1 lib: Add warning if lockdep is disabled before a test.

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.

---
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.

lib/igt_core.c +35 -0
index 832361b0a9f9..bb17ddfbcadb 100644
@@ -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

#1 lore raw
Quoted 7 lines · Maarten Lankhorst

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.

Ack on the idea.
-Daniel

Quoted 63 lines

---
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.

lib/igt_core.c +35 -0
index 832361b0a9f9..bb17ddfbcadb 100644
@@ -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

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