From owner-freebsd-hackers@FreeBSD.ORG Wed Nov 28 09:33:45 2007 Return-Path: Delivered-To: hackers@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EB6B016A417 for ; Wed, 28 Nov 2007 09:33:45 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from cyrus.watson.org (cyrus.watson.org [209.31.154.42]) by mx1.freebsd.org (Postfix) with ESMTP id C4CD913C478 for ; Wed, 28 Nov 2007 09:33:45 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from fledge.watson.org (fledge.watson.org [209.31.154.41]) by cyrus.watson.org (Postfix) with ESMTP id 95ECF475BD; Wed, 28 Nov 2007 04:37:36 -0500 (EST) Date: Wed, 28 Nov 2007 09:33:38 +0000 (GMT) From: Robert Watson X-X-Sender: robert@fledge.watson.org To: Skip Ford In-Reply-To: <20071128054208.GA813@menantico.com> Message-ID: <20071128092434.J94692@fledge.watson.org> References: <20071127171228.N94692@fledge.watson.org> <20071128054208.GA813@menantico.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: hackers@FreeBSD.org Subject: Re: Updated procstat(1) X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Nov 2007 09:33:46 -0000 On Wed, 28 Nov 2007, Skip Ford wrote: >> - "-a" now means "all processes", > > Thanks. :-) I'm a little surprised. You seemed pretty dedicated to a > per-process tool. I was, but then I read your e-mail and became convinced that the first patch that would be submitted against procstat(1) would be a "-a" patch. :-) > I personally would change it to allow either the all flag or a list of pids, > rather than "at least one of". For pathname, command-line, and credential > information, the output will likely not change between showing the pid in > the "all" output and the "list" output so you're just outputting it twice. > If one really wants the same pid to be output multiple times for threads, > kstack, or file descriptors, then I'd expect "procstat -k 0 0 0 0 0" to be > more useful for that. > > I would think a mistake in usage has been made if a list of pids is > specified along with the "all" flag. But, no real harm is done by doing it > the current way. I think your argument is convincing, and have changed it so that only one of -a and a pidlist can be specified. I've also tightened down the syntax checking on flags a bit more. >> - A new "-k" has been added, which prints the kernel thread stacks for >> threads >> in a process (although not swapped out or actively running threads). This >> is extremely useful for answering questions of the sort "But *why* is the >> process blocked in UMA". It has both a simple mode (-k_, which lists just >> kernel function names, and a slightly more detailed mode (-kk), which adds >> the offset into the function. > > This is excellent. Does this absolutely have to depend on DDB and KDB? Currently, yes, as stack(9) is conditional on DDB, and the MD bits of stack(9) are defined in db_trace.c (and in some cases, depend on DDB definitions, such as DDB types, although I think not critically so). I've also been pondering breaking out stack(9) from DDB but haven't done that yet. Maybe that will be today's task, as I'd like -k to work without the kernel debugger, as it has use significantly beyond kernel debugging. > In sys/amd64/amd64/db_trace.c on line 537, change "SWWAPPED" to "SWAPPED". Fixed, thanks. > The newly introducted function stack_save_td() doesn't panic in the MD > powerpc code like it does for other arches. I have no idea if this is > correct, it just doesn't match the others. Indeed, and I've now fixed this, thanks! Robert N M Watson Computer Laboratory University of Cambridge