diff options
author | netchild <netchild@FreeBSD.org> | 2012-05-05 19:42:38 +0000 |
---|---|---|
committer | netchild <netchild@FreeBSD.org> | 2012-05-05 19:42:38 +0000 |
commit | 9895b5ca9df1f0d045ee00e77007e80d4c202ca4 (patch) | |
tree | 2c944ca220ef9f94f80b967133cbd2ab53caa81c /sys/compat/linux/linux_emul.h | |
parent | 096ede817a595e57dafce2910385344f389c8dbd (diff) | |
download | FreeBSD-src-9895b5ca9df1f0d045ee00e77007e80d4c202ca4.zip FreeBSD-src-9895b5ca9df1f0d045ee00e77007e80d4c202ca4.tar.gz |
- >500 static DTrace probes for the linuxulator
- DTrace scripts to check for errors, performance, ...
they serve mostly as examples of what you can do with the static probe;s
with moderate load the scripts may be overwhelmed, excessive lock-tracing
may influence program behavior (see the last design decission)
Design decissions:
- use "linuxulator" as the provider for the native bitsize; add the
bitsize for the non-native emulation (e.g. "linuxuator32" on amd64)
- Add probes only for locks which are acquired in one function and released
in another function. Locks which are aquired and released in the same
function should be easy to pair in the code, inter-function
locking is more easy to verify in DTrace.
- Probes for locks should be fired after locking and before releasing to
prevent races (to provide data/function stability in DTrace, see the
man-page of "dtrace -v ..." and the corresponding DTrace docs).
Diffstat (limited to 'sys/compat/linux/linux_emul.h')
-rw-r--r-- | sys/compat/linux/linux_emul.h | 43 |
1 files changed, 36 insertions, 7 deletions
diff --git a/sys/compat/linux/linux_emul.h b/sys/compat/linux/linux_emul.h index 3acde64..f409a34 100644 --- a/sys/compat/linux/linux_emul.h +++ b/sys/compat/linux/linux_emul.h @@ -64,13 +64,42 @@ struct linux_emuldata { struct linux_emuldata *em_find(struct proc *, int locked); -#define EMUL_LOCK(l) mtx_lock(l) -#define EMUL_UNLOCK(l) mtx_unlock(l) - -#define EMUL_SHARED_RLOCK(l) sx_slock(l) -#define EMUL_SHARED_RUNLOCK(l) sx_sunlock(l) -#define EMUL_SHARED_WLOCK(l) sx_xlock(l) -#define EMUL_SHARED_WUNLOCK(l) sx_xunlock(l) +/* + * DTrace probes for locks should be fired after locking and before releasing + * to prevent races (to provide data/function stability in dtrace, see the + * output of "dtrace -v ..." and the corresponding dtrace docs). + */ +#define EMUL_LOCK(l) do { \ + mtx_lock(l); \ + LIN_SDT_PROBE1(locks, emul_lock, \ + locked, l); \ + } while (0) +#define EMUL_UNLOCK(l) do { \ + LIN_SDT_PROBE1(locks, emul_lock, \ + unlock, l); \ + mtx_unlock(l); \ + } while (0) + +#define EMUL_SHARED_RLOCK(l) do { \ + sx_slock(l); \ + LIN_SDT_PROBE1(locks, emul_shared_rlock, \ + locked, l); \ + } while (0) +#define EMUL_SHARED_RUNLOCK(l) do { \ + LIN_SDT_PROBE1(locks, emul_shared_rlock, \ + unlock, l); \ + sx_sunlock(l); \ + } while (0) +#define EMUL_SHARED_WLOCK(l) do { \ + sx_xlock(l); \ + LIN_SDT_PROBE1(locks, emul_shared_wlock, \ + locked, l); \ + } while (0) +#define EMUL_SHARED_WUNLOCK(l) do { \ + LIN_SDT_PROBE1(locks, emul_shared_wlock, \ + unlock, l); \ + sx_xunlock(l); \ + } while (0) /* for em_find use */ #define EMUL_DOLOCK 1 |