From owner-freebsd-arch@FreeBSD.ORG Wed May 4 21:26:06 2011 Return-Path: Delivered-To: arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 34D51106564A; Wed, 4 May 2011 21:26:05 +0000 (UTC) (envelope-from jilles@stack.nl) Received: from mx1.stack.nl (relay04.stack.nl [IPv6:2001:610:1108:5010::107]) by mx1.freebsd.org (Postfix) with ESMTP id 8C5908FC15; Wed, 4 May 2011 21:26:05 +0000 (UTC) Received: from turtle.stack.nl (turtle.stack.nl [IPv6:2001:610:1108:5010::132]) by mx1.stack.nl (Postfix) with ESMTP id E98691DD82D; Wed, 4 May 2011 23:26:04 +0200 (CEST) Received: by turtle.stack.nl (Postfix, from userid 1677) id D5B6817395; Wed, 4 May 2011 23:26:04 +0200 (CEST) Date: Wed, 4 May 2011 23:26:04 +0200 From: Jilles Tjoelker To: John Baldwin Message-ID: <20110504212604.GA13717@stack.nl> References: <201105021537.19507.jhb@freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201105021537.19507.jhb@freebsd.org> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: arch@freebsd.org Subject: Re: [PATCH] Add ktrace records for user page faults X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 May 2011 21:26:06 -0000 On Mon, May 02, 2011 at 03:37:19PM -0400, John Baldwin wrote: > One thing I have found useful is knowing when processes are in the > kernel instead of in userland. ktrace already provides records for > syscall entry/exit. The other major source of time spent in the > kernel that I've seen is page fault handling. To that end, I have a > patch that adds ktrace records to the beginning and end of VM faults. > This gives a pair of records so a user can see how long a fault took > (similar to how one can see how long a syscall takes now). Sample > output from kdump is below: > 47565 echo CALL mmap(0x800a87000,0x179000,PROT_READ| > PROT_WRITE,MAP_PRIVATE|MAP_ANON,0xffffffff,0) > 47565 echo RET mmap 34370777088/0x800a87000 > 47565 echo PFLT 0x800723000 VM_PROT_EXECUTE > 47565 echo RET KERN_SUCCESS > 47565 echo CALL munmap(0x800887000,0x179000) > 47565 echo RET munmap 0 > 47565 echo PFLT 0x800a00000 VM_PROT_WRITE > 47565 echo RET KERN_SUCCESS Just a small nitpick, I think the return from a page fault should not use the same "RET" keyword; even though the next word unambiguously distinguishes it from a return from a syscall, I think it is clearer in the documentation and possibly useful for automated processing to use a separate keyword such as "PRET". -- Jilles Tjoelker