svn commit: r185297 - user/netchild/linuxulator-dtrace/src/sys/compat/linux

Alexander Leidinger netchild at FreeBSD.org
Tue Nov 25 06:14:59 PST 2008


Author: netchild
Date: Tue Nov 25 14:14:58 2008
New Revision: 185297
URL: http://svn.freebsd.org/changeset/base/185297

Log:
  First dtrace program to check the balancing of the amul_lock aquire/release.
  
  As of now this will show errors, as not all locking/release places are
  instrumented with dtrace probes.
  
  WIP warning: This dtrace script is not even compile tested.

Added:
  user/netchild/linuxulator-dtrace/src/sys/compat/linux/check_emul_lock.d

Added: user/netchild/linuxulator-dtrace/src/sys/compat/linux/check_emul_lock.d
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ user/netchild/linuxulator-dtrace/src/sys/compat/linux/check_emul_lock.d	Tue Nov 25 14:14:58 2008	(r185297)
@@ -0,0 +1,36 @@
+#!/usr/sbin/dtrace -qs
+
+/*
+ * Check if the emul lock is correctly acquired/released:
+ *  - no recursive locking
+ *  - no unlocking of already unlocked one
+ */
+
+linuxulator*::emul_locked
+/check[probeprov, arg0] > 0/
+{
+	printf("ERROR: recursive lock of emul_lock (%p),", arg0);
+	printf("       or missing SDT probe in kernel. Stack trace follows:");
+	stack();
+}
+
+linuxulator*::emul_locked
+{
+	++check[probeprov, arg0];
+}
+
+linuxulator*::emul_unlock
+/check[probeprov, arg0] == 0/
+{
+	printf("ERROR: unlock attemt of unlocked emul_lock (%p),", arg0);
+	printf("       missing SDT probe in kernel, or dtrace program started");
+	printf("       while the emul_lock was already held (race condition).");
+	printf("       Stack trace follows:");
+	stack();
+}
+
+linuxulator*::emul_unlock
+{
+	--check[probeprov, arg0];
+}
+


More information about the svn-src-user mailing list