From owner-freebsd-current@FreeBSD.ORG Wed Nov 9 01:52:39 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 235F51065673; Wed, 9 Nov 2011 01:52:39 +0000 (UTC) (envelope-from lacombar@gmail.com) Received: from mail-ww0-f50.google.com (mail-ww0-f50.google.com [74.125.82.50]) by mx1.freebsd.org (Postfix) with ESMTP id 7D9B58FC0C; Wed, 9 Nov 2011 01:52:35 +0000 (UTC) Received: by wwp14 with SMTP id 14so1642225wwp.31 for ; Tue, 08 Nov 2011 17:52:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=3s+4hi+bg1FtoA2JPsNe5UTbWVWoVv9ISf6+R5Dj+kk=; b=Gfb6Yjw1vbmXharkbArzbP6DlBZ3k8ONAhEYqgPlov3HPTe6sDxCc1hmRgxIJt/RqL dE2yzTR4jspBUZ2sXeI9qs9f6BKBHqdwaqMsS+/5YW1n2GTDCF9H1gSPgEhkJmE6vuOW +VAzV1jdjpwM/WG6KjLaQruAKAiffZ/2B9H3Q= MIME-Version: 1.0 Received: by 10.180.102.4 with SMTP id fk4mr396965wib.15.1320803554204; Tue, 08 Nov 2011 17:52:34 -0800 (PST) Received: by 10.180.81.200 with HTTP; Tue, 8 Nov 2011 17:52:34 -0800 (PST) In-Reply-To: <4EB9C469.9070208@freebsd.org> References: <4EB9C469.9070208@freebsd.org> Date: Tue, 8 Nov 2011 20:52:34 -0500 Message-ID: From: Arnaud Lacombe To: Julian Elischer Content-Type: text/plain; charset=ISO-8859-1 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 01:52:39 -0000 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. 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. - Arnaud ps: netgraph is on my target list, as well as the list code, to some extend :) [0]: as I really hate `caddr_t'