From owner-svn-src-head@FreeBSD.ORG Thu May 9 16:28:20 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id F29B2D17; Thu, 9 May 2013 16:28:19 +0000 (UTC) (envelope-from marcel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id E41E5B5; Thu, 9 May 2013 16:28:19 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r49GSJhf039882; Thu, 9 May 2013 16:28:19 GMT (envelope-from marcel@svn.freebsd.org) Received: (from marcel@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r49GSI33039873; Thu, 9 May 2013 16:28:18 GMT (envelope-from marcel@svn.freebsd.org) Message-Id: <201305091628.r49GSI33039873@svn.freebsd.org> From: Marcel Moolenaar Date: Thu, 9 May 2013 16:28:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r250411 - in head/sys: conf kern sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 May 2013 16:28:20 -0000 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().