diff options
author | Visa Hankala <visa@cvs.openbsd.org> | 2019-02-07 15:11:39 +0000 |
---|---|---|
committer | Visa Hankala <visa@cvs.openbsd.org> | 2019-02-07 15:11:39 +0000 |
commit | 02d3802da85b2d3796370f0f12d1abea9bcbd466 (patch) | |
tree | 555645e0214e898660e2304b3c630c6ec7851dbb /share/man | |
parent | ee65a484c4e4801840e44792155d9a488b3bccb9 (diff) |
Add lock stack trace saving for witness(4).
This lets witness(4) save a stack trace on each lock acquisition.
The saved traces can be viewed in ddb(4) when showing the currently
held locks, which may help when debugging incorrect locking.
Sample output:
ddb{0}> show all locks
Process 63836 (rm) thread 0xffff8000221e52c8 (435004)
exclusive rrwlock inode r = 0 (0xfffffd8119a092c0) locked @ /usr/src/sys/ufs/ufs/ufs_vnops.c:1547
#0 witness_lock+0x419
#1 _rw_enter+0x2bb
#2 _rrw_enter+0x42
#3 VOP_LOCK+0x3f
#4 vn_lock+0x36
#5 vfs_lookup+0xa1
#6 namei+0x2b3
#7 dounlinkat+0x85
#8 syscall+0x338
#9 Xsyscall+0x128
exclusive kernel_lock &kernel_lock r = 1 (0xffffffff81e6a5f0) locked @ /usr/src/sys/arch/amd64/amd64/intr.c:525
#0 witness_lock+0x419
#1 syscall+0x2b6
#2 Xsyscall+0x128
The saving adds overhead, so it is not enabled by default. It can be
taken into use by setting sysctl kern.witness.locktrace=1 at runtime
or by defining WITNESS_LOCKTRACE in the kernel configuration.
Feedback and OK anton@
Diffstat (limited to 'share/man')
-rw-r--r-- | share/man/man4/options.4 | 12 | ||||
-rw-r--r-- | share/man/man9/malloc.9 | 7 |
2 files changed, 15 insertions, 4 deletions
diff --git a/share/man/man4/options.4 b/share/man/man4/options.4 index ce991e68141..6c9f58b9935 100644 --- a/share/man/man4/options.4 +++ b/share/man/man4/options.4 @@ -1,4 +1,4 @@ -.\" $OpenBSD: options.4,v 1.261 2019/02/06 10:59:49 visa Exp $ +.\" $OpenBSD: options.4,v 1.262 2019/02/07 15:11:38 visa Exp $ .\" $NetBSD: options.4,v 1.21 1997/06/25 03:13:00 thorpej Exp $ .\" .\" Copyright (c) 1998 Theo de Raadt @@ -34,7 +34,7 @@ .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .\" .\" -.Dd $Mdocdate: February 6 2019 $ +.Dd $Mdocdate: February 7 2019 $ .Dt OPTIONS 4 .Os .Sh NAME @@ -141,6 +141,14 @@ See Maximum number of lock types that are tracked by .Xr witness 4 . It defaults to 1536. +.It Cd option WITNESS_LOCKTRACE +Enable +.Xr witness 4 +lock stack trace saving at boot. +The feature is disabled by default and has to be enabled by setting the +.Va kern.witness.locktrace +.Xr sysctl 8 +variable. .It Cd option WITNESS_WATCH Enable .Xr witness 4 diff --git a/share/man/man9/malloc.9 b/share/man/man9/malloc.9 index 0b958b0649b..729b76eec17 100644 --- a/share/man/man9/malloc.9 +++ b/share/man/man9/malloc.9 @@ -1,4 +1,4 @@ -.\" $OpenBSD: malloc.9,v 1.66 2019/01/18 17:52:18 visa Exp $ +.\" $OpenBSD: malloc.9,v 1.67 2019/02/07 15:11:38 visa Exp $ .\" $NetBSD: malloc.9,v 1.2 1996/10/30 05:29:54 lukem Exp $ .\" .\" Copyright (c) 1996 The NetBSD Foundation, Inc. @@ -28,7 +28,7 @@ .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\" POSSIBILITY OF SUCH DAMAGE. .\" -.Dd $Mdocdate: January 18 2019 $ +.Dd $Mdocdate: February 7 2019 $ .Dt MALLOC 9 .Os .Sh NAME @@ -267,6 +267,9 @@ USB general. USB device driver. .It Dv M_USBHC USB host controller. +.It Dv M_WITNESS +.Xr witness 4 +memory. .It Dv M_MEMDESC Memory range. .It Dv M_CRYPTO_DATA |