From owner-freebsd-net@FreeBSD.ORG Mon Dec 1 21:43:45 2008 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3091710656D9; Mon, 1 Dec 2008 21:43:45 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from server.baldwin.cx (bigknife-pt.tunnel.tserv9.chi1.ipv6.he.net [IPv6:2001:470:1f10:75::2]) by mx1.freebsd.org (Postfix) with ESMTP id A8B528FC0A; Mon, 1 Dec 2008 21:43:44 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from localhost.corp.yahoo.com (john@localhost [IPv6:::1]) (authenticated bits=0) by server.baldwin.cx (8.14.3/8.14.3) with ESMTP id mB1LhaQl000939; Mon, 1 Dec 2008 16:43:36 -0500 (EST) (envelope-from jhb@freebsd.org) From: John Baldwin To: freebsd-drivers@freebsd.org Date: Mon, 1 Dec 2008 15:05:56 -0500 User-Agent: KMail/1.9.7 References: <5D267A3F22FD854F8F48B3D2B52381933940B2DEFE@IRVEXCHCCR01.corp.ad.broadcom.com> <492B2306.60404@freebsd.org> In-Reply-To: <492B2306.60404@freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200812011505.56535.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH authentication, not delayed by milter-greylist-2.0.2 (server.baldwin.cx [IPv6:::1]); Mon, 01 Dec 2008 16:43:37 -0500 (EST) X-Virus-Scanned: ClamAV 0.93.1/8704/Mon Dec 1 11:39:36 2008 on server.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-2.6 required=4.2 tests=AWL,BAYES_00,NO_RELAYS autolearn=ham version=3.1.3 X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on server.baldwin.cx Cc: David Christensen , Sam Leffler , "freebsd-net@FreeBSD.org" Subject: Re: Gathering Hardware State During a Driver Initiated Kernel Panic X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Dec 2008 21:43:45 -0000 On Monday 24 November 2008 04:56:22 pm Sam Leffler wrote: > David Christensen wrote: > > Is there a method or callback in FreeBSD where a driver can > > be notified that it has caused a kernel panic in order to > > generate a dump of internal hardware state information? I've > > written a sysctl call for manual intervention and can handle > > some "expected" hardware events completely in the driver but > > I don't know of a way to get control again in cases where the > > driver wasn't expecting a failure. > > > > Not sure how one can deduce a driver is at fault but you might define a > ddb command for the driver and invoke that on panic using the ddb script > mechanisms (see ddb(4)). You might be able to set the current 'panic' ddb script function to one you define in your code somehow. That is, set it on entry to bce_start() and then reset it to empty when bce_start() returns. Similarly for the interrupt handler, bce_init(), and bce_ioctl(). I haven't looked to see if there is a clean way to set a script function in C though. -- John Baldwin