Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 4 Apr 2012 12:00:10 -0400
From:      John Baldwin <jhb@freebsd.org>
To:        freebsd-arch@freebsd.org
Subject:   Re: [PATCH] Add ktrace records for user page faults
Message-ID:  <201204041200.10773.jhb@freebsd.org>
In-Reply-To: <201105021537.19507.jhb@freebsd.org>
References:  <201105021537.19507.jhb@freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Monday, May 02, 2011 3:37:19 pm 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
> 
> The patch is available at www.freebsd.org/~jhb/patches/ktrace_fault.patch and 
> included below.

I've updated this based on some previous feedback.  It now uses 'PRET'
instead of 'RET' for return from a page fault.  I've also made it possible
for the MD layers to pass a non-truncated address, though those changes are
not part of this patch.  The updated patch is available at the URL above.
I'd like to merge it in if there are no objections.  If folks have other
suggestions than 'PFLT' and 'PRET' for the markers for page faults that
is fine with me.

-- 
John Baldwin



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201204041200.10773.jhb>