From owner-svn-src-stable@FreeBSD.ORG Sat Oct 27 23:34:19 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 41F5C4F8; Sat, 27 Oct 2012 23:34:19 +0000 (UTC) (envelope-from davide@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 105808FC0C; Sat, 27 Oct 2012 23:34:19 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q9RNYIeJ082065; Sat, 27 Oct 2012 23:34:18 GMT (envelope-from davide@svn.freebsd.org) Received: (from davide@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q9RNYI3J082062; Sat, 27 Oct 2012 23:34:18 GMT (envelope-from davide@svn.freebsd.org) Message-Id: <201210272334.q9RNYI3J082062@svn.freebsd.org> From: Davide Italiano Date: Sat, 27 Oct 2012 23:34:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r242200 - in stable/8/sys: conf kern X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 27 Oct 2012 23:34:19 -0000 Author: davide Date: Sat Oct 27 23:34:18 2012 New Revision: 242200 URL: http://svn.freebsd.org/changeset/base/242200 Log: MFC r238925: Until now KTR_ENTRIES, which defines the size of circular buffer used in ktr(4), was constrained to be a power of two. Remove this constraint and update sys/conf/NOTES accordingly. Modified: stable/8/sys/conf/NOTES stable/8/sys/kern/kern_ktr.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/conf/ (props changed) stable/8/sys/kern/ (props changed) Modified: stable/8/sys/conf/NOTES ============================================================================== --- stable/8/sys/conf/NOTES Sat Oct 27 23:30:46 2012 (r242199) +++ stable/8/sys/conf/NOTES Sat Oct 27 23:34:18 2012 (r242200) @@ -409,7 +409,7 @@ options KTRACE_REQUEST_POOL=101 # KTR is a kernel tracing mechanism imported from BSD/OS. Currently # it has no userland interface aside from a few sysctl's. It is # enabled with the KTR option. KTR_ENTRIES defines the number of -# entries in the circular trace buffer; it must be a power of two. +# entries in the circular trace buffer; it may be an arbitrary number. # KTR_COMPILE defines the mask of events to compile into the kernel as # defined by the KTR_* constants in . KTR_MASK defines the # initial value of the ktr_mask variable which determines at runtime Modified: stable/8/sys/kern/kern_ktr.c ============================================================================== --- stable/8/sys/kern/kern_ktr.c Sat Oct 27 23:30:46 2012 (r242199) +++ stable/8/sys/kern/kern_ktr.c Sat Oct 27 23:34:18 2012 (r242200) @@ -235,7 +235,7 @@ ktr_tracepoint(u_int mask, const char *f { do { saveindex = ktr_idx; - newindex = (saveindex + 1) & (KTR_ENTRIES - 1); + newindex = (saveindex + 1) % KTR_ENTRIES; } while (atomic_cmpset_rel_int(&ktr_idx, saveindex, newindex) == 0); entry = &ktr_buf[saveindex]; } @@ -290,7 +290,7 @@ static int db_mach_vtrace(void); DB_SHOW_COMMAND(ktr, db_ktr_all) { - tstate.cur = (ktr_idx - 1) & (KTR_ENTRIES - 1); + tstate.cur = (ktr_idx - 1) % KTR_ENTRIES; tstate.first = -1; db_ktr_verbose = 0; db_ktr_verbose |= (index(modif, 'v') != NULL) ? 2 : 0;