From owner-freebsd-current@FreeBSD.ORG Wed Nov 9 02:35:49 2011 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 485E3106564A for ; Wed, 9 Nov 2011 02:35:49 +0000 (UTC) (envelope-from julian@freebsd.org) Received: from vps1.elischer.org (vps1.elischer.org [204.109.63.16]) by mx1.freebsd.org (Postfix) with ESMTP id 166EB8FC16 for ; Wed, 9 Nov 2011 02:35:48 +0000 (UTC) Received: from julian-mac.elischer.org (home-nat.elischer.org [67.100.89.137]) (authenticated bits=0) by vps1.elischer.org (8.14.4/8.14.4) with ESMTP id pA92Zlxc022676 (version=TLSv1/SSLv3 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NO); Tue, 8 Nov 2011 18:35:48 -0800 (PST) (envelope-from julian@freebsd.org) Message-ID: <4EB9E6FE.3060102@freebsd.org> Date: Tue, 08 Nov 2011 18:35:42 -0800 From: Julian Elischer User-Agent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X 10.4; en-US; rv:1.9.2.23) Gecko/20110920 Thunderbird/3.1.15 MIME-Version: 1.0 To: Arnaud Lacombe References: <4EB9C469.9070208@freebsd.org> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: freebsd-current@freebsd.org Subject: Re: Using Instruction Pointer address in debug interfaces [Was: Re: vm_page_t related KBI [Was: Re: panic at vm_page_wire with FreeBSD 9.0 Beta 3]] X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Nov 2011 02:35:49 -0000 On 11/8/11 5:52 PM, Arnaud Lacombe wrote: > Hi, > > On Tue, Nov 8, 2011 at 7:08 PM, Julian Elischer wrote: >> On 11/8/11 10:49 AM, Arnaud Lacombe wrote: >>> Hi, >>> To avoid future complaints about the fact that I would be only "talk" >>> without "action", I did implement what I suggested above. As it is >>> quite a large patch-set, I will not post it directly here, however, it >>> is available on github: >>> >>> https://github.com/lacombar/freebsd/tree/master/topic/kern-lock-debug >>> >>> It convert a bunch of debug interface to use the caller instruction >>> pointer, as well as a proof-of-concept teaching printf(9) to convert >>> IP to symbol_name+offset. >>> >>> It translates in a direct saving of about +250kB on i386's GENERIC, >>> just in kernel text size. Even the worst case, ie LOCK_DEBUG == 0, >>> translates to a save of +80kB. >>> >>> Please note that this is still WIP code. >> A couple of comments. >> Firstly, the idea of a printf method to print the IP as symbol+offset is an >> interesting idea >> that should be followed up in its own right. >> > FWIW, I have no credit in this idea. It has been in Linux for ages and ages. yeah as I said at work I use linux and BSD... the linux stuff that just prints out IP really annoys me. the list stuff and netgraph debug (which should be off in any production system) just require you to be able to see the console. and have sources nearby. if you need the IP use gdb. it's just what you are used to. You are obviously from the dark side ^H^H^H^H^H^H linux. so you are used to doing it that way.. but don't expect us to change just because that's what Linux does. When we have a problem at work on teh Linux driver, my first step is always to try duplicate it on FreeBSD because: 1/ half the time freebsd will just immediatly assert on something and present you with the bug.. done. 2/ I can run gdb through firewire on it on ANY standard unmodified kernel and find it, where on Linux I need to get a whole universe of stupid patches all aligned and MAYBE I might be able to see what is going on. if it's on redhat I need to do this, on ubuntu that, on suse something else ,and on different revisions of the kernel it all changes anyhow.. > That said, IP address are barely used in FreeBSD, there is no legacy. > As such, the API should not use `unsigned long' but `void *'[0]; this > is the natural type returned by `__builtin_return_address()' and the > `&&' operator. This would allow to introduce a modifier to `%p' to do > the translation. possibly intptr_t is what should be used. but I'd expect Bruce to drop in here and let us us know. > - Arnaud > > ps: netgraph is on my target list, as well as the list code, to some extend :) well let me know what you want to do because while it can do with love it is also used by a lot of people. if you nean to remove file/line.. don't. > [0]: as I really hate `caddr_t' it's probably older than you are.. times change. void* wasn't used much back then.