From owner-svn-src-all@FreeBSD.ORG Mon Dec 2 22:34:48 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 88B10E9B; Mon, 2 Dec 2013 22:34:48 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 693F81110; Mon, 2 Dec 2013 22:34:48 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rB2MYmfP025532; Mon, 2 Dec 2013 22:34:48 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rB2MYlfZ025529; Mon, 2 Dec 2013 22:34:47 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201312022234.rB2MYlfZ025529@svn.freebsd.org> From: Attilio Rao Date: Mon, 2 Dec 2013 22:34:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r258858 - head/sys/sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Dec 2013 22:34:48 -0000 Author: attilio Date: Mon Dec 2 22:34:47 2013 New Revision: 258858 URL: http://svnweb.freebsd.org/changeset/base/258858 Log: Right now LOCK_DEBUG is enabled if KTR is on. This is to support LOCK_LOG_* functionality effectively in debugging environments but it is overkill because really LOCK_DEBUG should be on only if (KTR_COMPILE & KTR_LOCK) is true. Fix this by applying the correct logic. In this process, move the KTR classes to its own header to reduce namespace pollution. Sponsored by: EMC / Isilon storage division Reviewed by: jhb Added: head/sys/sys/ktr_class.h (contents, props changed) Modified: head/sys/sys/ktr.h head/sys/sys/lock.h Modified: head/sys/sys/ktr.h ============================================================================== --- head/sys/sys/ktr.h Mon Dec 2 22:00:15 2013 (r258857) +++ head/sys/sys/ktr.h Mon Dec 2 22:34:47 2013 (r258858) @@ -36,56 +36,7 @@ #ifndef _SYS_KTR_H_ #define _SYS_KTR_H_ -/* - * Trace classes - * - * Two of the trace classes (KTR_DEV and KTR_SUBSYS) are special in that - * they are really placeholders so that indvidual drivers and subsystems - * can map their internal tracing to the general class when they wish to - * have tracing enabled and map it to 0 when they don't. - */ -#define KTR_GEN 0x00000001 /* General (TR) */ -#define KTR_NET 0x00000002 /* Network */ -#define KTR_DEV 0x00000004 /* Device driver */ -#define KTR_LOCK 0x00000008 /* MP locking */ -#define KTR_SMP 0x00000010 /* MP general */ -#define KTR_SUBSYS 0x00000020 /* Subsystem. */ -#define KTR_PMAP 0x00000040 /* Pmap tracing */ -#define KTR_MALLOC 0x00000080 /* Malloc tracing */ -#define KTR_TRAP 0x00000100 /* Trap processing */ -#define KTR_INTR 0x00000200 /* Interrupt tracing */ -#define KTR_SIG 0x00000400 /* Signal processing */ -#define KTR_SPARE2 0x00000800 /* XXX Used by cxgb */ -#define KTR_PROC 0x00001000 /* Process scheduling */ -#define KTR_SYSC 0x00002000 /* System call */ -#define KTR_INIT 0x00004000 /* System initialization */ -#define KTR_SPARE3 0x00008000 /* XXX Used by cxgb */ -#define KTR_SPARE4 0x00010000 /* XXX Used by cxgb */ -#define KTR_EVH 0x00020000 /* Eventhandler */ -#define KTR_VFS 0x00040000 /* VFS events */ -#define KTR_VOP 0x00080000 /* Auto-generated vop events */ -#define KTR_VM 0x00100000 /* The virtual memory system */ -#define KTR_INET 0x00200000 /* IPv4 stack */ -#define KTR_RUNQ 0x00400000 /* Run queue */ -#define KTR_CONTENTION 0x00800000 /* Lock contention */ -#define KTR_UMA 0x01000000 /* UMA slab allocator */ -#define KTR_CALLOUT 0x02000000 /* Callouts and timeouts */ -#define KTR_GEOM 0x04000000 /* GEOM I/O events */ -#define KTR_BUSDMA 0x08000000 /* busdma(9) events */ -#define KTR_INET6 0x10000000 /* IPv6 stack */ -#define KTR_SCHED 0x20000000 /* Machine parsed sched info. */ -#define KTR_BUF 0x40000000 /* Buffer cache */ -#define KTR_ALL 0x7fffffff - -/* Trace classes to compile in */ -#ifdef KTR -#ifndef KTR_COMPILE -#define KTR_COMPILE (KTR_ALL) -#endif -#else /* !KTR */ -#undef KTR_COMPILE -#define KTR_COMPILE 0 -#endif /* KTR */ +#include /* * Version number for ktr_entry struct. Increment this when you break binary Added: head/sys/sys/ktr_class.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/sys/ktr_class.h Mon Dec 2 22:34:47 2013 (r258858) @@ -0,0 +1,86 @@ +/*- + * Copyright (c) 1996 Berkeley Software Design, Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Berkeley Software Design Inc's name may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY BERKELEY SOFTWARE DESIGN INC ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL BERKELEY SOFTWARE DESIGN INC BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * from BSDI $Id: ktr.h,v 1.10.2.7 2000/03/16 21:44:42 cp Exp $ + * $FreeBSD$ + */ + +#ifndef _SYS_KTR_CLASS_H_ +#define _SYS_KTR_CLASS_H_ + +/* + * KTR trace classes + * + * Two of the trace classes (KTR_DEV and KTR_SUBSYS) are special in that + * they are really placeholders so that indvidual drivers and subsystems + * can map their internal tracing to the general class when they wish to + * have tracing enabled and map it to 0 when they don't. + */ +#define KTR_GEN 0x00000001 /* General (TR) */ +#define KTR_NET 0x00000002 /* Network */ +#define KTR_DEV 0x00000004 /* Device driver */ +#define KTR_LOCK 0x00000008 /* MP locking */ +#define KTR_SMP 0x00000010 /* MP general */ +#define KTR_SUBSYS 0x00000020 /* Subsystem. */ +#define KTR_PMAP 0x00000040 /* Pmap tracing */ +#define KTR_MALLOC 0x00000080 /* Malloc tracing */ +#define KTR_TRAP 0x00000100 /* Trap processing */ +#define KTR_INTR 0x00000200 /* Interrupt tracing */ +#define KTR_SIG 0x00000400 /* Signal processing */ +#define KTR_SPARE2 0x00000800 /* XXX Used by cxgb */ +#define KTR_PROC 0x00001000 /* Process scheduling */ +#define KTR_SYSC 0x00002000 /* System call */ +#define KTR_INIT 0x00004000 /* System initialization */ +#define KTR_SPARE3 0x00008000 /* XXX Used by cxgb */ +#define KTR_SPARE4 0x00010000 /* XXX Used by cxgb */ +#define KTR_EVH 0x00020000 /* Eventhandler */ +#define KTR_VFS 0x00040000 /* VFS events */ +#define KTR_VOP 0x00080000 /* Auto-generated vop events */ +#define KTR_VM 0x00100000 /* The virtual memory system */ +#define KTR_INET 0x00200000 /* IPv4 stack */ +#define KTR_RUNQ 0x00400000 /* Run queue */ +#define KTR_CONTENTION 0x00800000 /* Lock contention */ +#define KTR_UMA 0x01000000 /* UMA slab allocator */ +#define KTR_CALLOUT 0x02000000 /* Callouts and timeouts */ +#define KTR_GEOM 0x04000000 /* GEOM I/O events */ +#define KTR_BUSDMA 0x08000000 /* busdma(9) events */ +#define KTR_INET6 0x10000000 /* IPv6 stack */ +#define KTR_SCHED 0x20000000 /* Machine parsed sched info. */ +#define KTR_BUF 0x40000000 /* Buffer cache */ +#define KTR_ALL 0x7fffffff + +/* KTR trace classes to compile in */ +#ifdef KTR +#ifndef KTR_COMPILE +#define KTR_COMPILE (KTR_ALL) +#endif +#else /* !KTR */ +#undef KTR_COMPILE +#define KTR_COMPILE 0 +#endif /* KTR */ + +#endif /* !_SYS_KTR_CLASS_H_ */ Modified: head/sys/sys/lock.h ============================================================================== --- head/sys/sys/lock.h Mon Dec 2 22:00:15 2013 (r258857) +++ head/sys/sys/lock.h Mon Dec 2 22:34:47 2013 (r258858) @@ -34,6 +34,7 @@ #include #include +#include struct lock_list_entry; struct thread; @@ -123,7 +124,7 @@ struct lock_class { * calling conventions for this debugging code in modules so that modules can * work with both debug and non-debug kernels. */ -#if defined(KLD_MODULE) || defined(WITNESS) || defined(INVARIANTS) || defined(INVARIANT_SUPPORT) || defined(KTR) || defined(LOCK_PROFILING) +#if defined(KLD_MODULE) || defined(WITNESS) || defined(INVARIANTS) || defined(INVARIANT_SUPPORT) || defined(LOCK_PROFILING) || (defined(KTR) && (KTR_COMPILE & KTR_LOCK)) #define LOCK_DEBUG 1 #else #define LOCK_DEBUG 0