Author: marcel Date: Thu May 9 16:28:18 2013 New Revision: 250411 URL: http://svnweb.freebsd.org/changeset/base/250411
Log: Add option WITNESS_NO_VNODE to suppress printing LORs between VNODE locks. To support this, VNODE locks are created with the LK_IS_VNODE flag. This flag is propagated down using the LO_IS_VNODE flag. Note that WITNESS still records the LOR. Only the printing and the optional entering into the kernel debugger is bypassed with the WITNESS_NO_VNODE option. Modified: head/sys/conf/options head/sys/kern/kern_lock.c head/sys/kern/subr_witness.c head/sys/kern/vfs_subr.c head/sys/sys/lock.h head/sys/sys/lockmgr.h Modified: head/sys/conf/options ============================================================================== --- head/sys/conf/options Thu May 9 16:09:39 2013 (r250410) +++ head/sys/conf/options Thu May 9 16:28:18 2013 (r250411) @@ -672,6 +672,7 @@ KTR_ENTRIES opt_global.h KTR_VERBOSE opt_ktr.h WITNESS opt_global.h WITNESS_KDB opt_witness.h +WITNESS_NO_VNODE opt_witness.h WITNESS_SKIPSPIN opt_witness.h # options for ACPI support Modified: head/sys/kern/kern_lock.c ============================================================================== --- head/sys/kern/kern_lock.c Thu May 9 16:09:39 2013 (r250410) +++ head/sys/kern/kern_lock.c Thu May 9 16:28:18 2013 (r250411) @@ -393,6 +393,8 @@ lockinit(struct lock *lk, int pri, const iflags |= LO_WITNESS; if (flags & LK_QUIET) iflags |= LO_QUIET; + if (flags & LK_IS_VNODE) + iflags |= LO_IS_VNODE; iflags |= flags & (LK_ADAPTIVE | LK_NOSHARE); lk->lk_lock = LK_UNLOCKED; Modified: head/sys/kern/subr_witness.c ============================================================================== --- head/sys/kern/subr_witness.c Thu May 9 16:09:39 2013 (r250410) +++ head/sys/kern/subr_witness.c Thu May 9 16:28:18 2013 (r250411) @@ -1289,7 +1289,19 @@ witness_checkorder(struct lock_object *l w->w_reversed = w1->w_reversed = 1; witness_increment_graph_generation(); mtx_unlock_spin(&w_mtx); - + +#ifdef WITNESS_NO_VNODE + /* + * There are known LORs between VNODE locks. They are + * not an indication of a bug. VNODE locks are flagged + * as such (LO_IS_VNODE) and we don't yell if the LOR + * is between 2 VNODE locks. + */ + if ((lock->lo_flags & LO_IS_VNODE) != 0 && + (lock1->li_lock->lo_flags & LO_IS_VNODE) != 0) + return; +#endif + /* * Ok, yell about it. */ Modified: head/sys/kern/vfs_subr.c ============================================================================== --- head/sys/kern/vfs_subr.c Thu May 9 16:09:39 2013 (r250410) +++ head/sys/kern/vfs_subr.c Thu May 9 16:28:18 2013 (r250411) @@ -1037,7 +1037,7 @@ alloc: * By default, don't allow shared locks unless filesystems * opt-in. */ - lockinit(vp->v_vnlock, PVFS, tag, VLKTIMEOUT, LK_NOSHARE); + lockinit(vp->v_vnlock, PVFS, tag, VLKTIMEOUT, LK_NOSHARE | LK_IS_VNODE); /* * Initialize bufobj. */ Modified: head/sys/sys/lock.h ============================================================================== --- head/sys/sys/lock.h Thu May 9 16:09:39 2013 (r250410) +++ head/sys/sys/lock.h Thu May 9 16:28:18 2013 (r250411) @@ -79,6 +79,7 @@ struct lock_class { #define LO_SLEEPABLE 0x00100000 /* Lock may be held while sleeping. */ #define LO_UPGRADABLE 0x00200000 /* Lock may be upgraded/downgraded. */ #define LO_DUPOK 0x00400000 /* Don't check for duplicate acquires */ +#define LO_IS_VNODE 0x00800000 /* Tell WITNESS about a VNODE lock */ #define LO_CLASSMASK 0x0f000000 /* Class index bitmask. */ #define LO_NOPROFILE 0x10000000 /* Don't profile this lock */ Modified: head/sys/sys/lockmgr.h ============================================================================== --- head/sys/sys/lockmgr.h Thu May 9 16:09:39 2013 (r250410) +++ head/sys/sys/lockmgr.h Thu May 9 16:28:18 2013 (r250411) @@ -146,6 +146,7 @@ _lockmgr_args_rw(struct lock *lk, u_int #define LK_NOWITNESS 0x000010 #define LK_QUIET 0x000020 #define LK_ADAPTIVE 0x000040 +#define LK_IS_VNODE 0x000080 /* Tell WITNESS about a VNODE lock */ /* * Additional attributes to be used in lockmgr(). _______________________________________________ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"