From owner-freebsd-hackers@FreeBSD.ORG Tue Mar 18 19:29:41 2014 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 37E36508; Tue, 18 Mar 2014 19:29:41 +0000 (UTC) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher ADH-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 0ED2A191; Tue, 18 Mar 2014 19:29:41 +0000 (UTC) Received: from jhbbsd.localnet (unknown [209.249.190.124]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 014C0B94B; Tue, 18 Mar 2014 15:29:40 -0400 (EDT) From: John Baldwin To: freebsd-current@freebsd.org Subject: Re: FreeBSD GSOC proposal in 2014 Date: Tue, 18 Mar 2014 14:26:19 -0400 User-Agent: KMail/1.13.5 (FreeBSD/8.4-CBSD-20130906; KDE/4.5.5; amd64; ; ) References: <20140314070218.GA37327@FreeBSD.org> In-Reply-To: <20140314070218.GA37327@FreeBSD.org> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201403181426.19929.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Tue, 18 Mar 2014 15:29:40 -0400 (EDT) Cc: freebsd-hackers@freebsd.org, soc-status@freebsd.org, "Wojciech A. Koszek" , yan cui X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Mar 2014 19:29:41 -0000 On Friday, March 14, 2014 3:02:18 am Wojciech A. Koszek wrote: > On Thu, Mar 13, 2014 at 09:56:35PM -0400, yan cui wrote: > > Hi all, > > > > I write this mail to make my question clear. I know witness can be used > > to detect wrong lock order in the kernel. However, can it be used to do > > lock profiling (what I mean is to report the information such as which > > locks are most contended and print some related statistics such as calling > > graph, etc)? > > In other words, is it enough to finish the task by porting witness to the > > pthread library? > > > > Yan, > > To my knowledge WITNESS is the only tool for lock order verification. > > For lock profiling in the FreeBSD kernel there's a KTR subsystem. KTR > mechanism is basically like syslog() in the user-space, but for the kernel. > KTR subsystem will receive messages from KTR API that is placed in the > FreeBSD kernel. Messages get stored on the list of some sort. List can be > exported to a file. File you can later analyze. > > Jeff wrote a Python app which can be used for pre-processing the KTR logs > from scheduler and protting them visually. Link: > > http://svnweb.freebsd.org/base/head/tools/sched/schedgraph.py > > Instead of porting witness to pthreads, maybe we could evaluate expanding > WITNESS to cover kern_umtx? This could prove to be more universal. > > Wojciech There is a dedicated lock profiler (LOCK_PROFILING) in the kernel. A previous GSoC student from an earlier year has already re-implemented both LOCK_PROFILING and WITNESS for pthreads. -- John Baldwin