Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756188AbXLFTYM (ORCPT ); Thu, 6 Dec 2007 14:24:12 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1753892AbXLFTX6 (ORCPT ); Thu, 6 Dec 2007 14:23:58 -0500 Received: from mail.suse.de ([195.135.220.2]:57042 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752219AbXLFTX4 (ORCPT ); Thu, 6 Dec 2007 14:23:56 -0500 Date: Thu, 6 Dec 2007 20:23:53 +0100 (CET) From: Bernhard Kaindl To: Stefan Richter , Andi Kleen Cc: Bernhard Kaindl , linux-kernel@vger.kernel.org, linux1394-devel@lists.sourceforge.net, Thomas Renninger , Benjamin Herrenschmidt Subject: [PATCH] Early boot debugging via FireWire (ohci1394_dma=early) In-Reply-To: Message-ID: References: <200702101242.48467.ak@suse.de> <45CDCDCD.5000609@s5r6.in-berlin.de> <4755D186.20204@s5r6.in-berlin.de> <4755D612.1090103@s5r6.in-berlin.de> <4755D757.7060002@s5r6.in-berlin.de> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 25092 Lines: 677 Hi, after summing up the discussion on previous patches, I'm now submitting the patch below for formal review and adoption on branches for mainline inclusion. As this patch is X86-only for now (might be extended for more architectures in incremental patches tough), initially (that was in February 2007) Andi Kleen offered to handle the patch submission. Subject of this patch: This patch adds a new configuration option, which adds support for a new early_param which gets checked in arch/x86/kernel/setup_{32,64}.c:setup_arch() to decide wether OHCI-1394 FireWire controllers should be initialized and enabled for physical DMA access to allow remote debugging of early problems like issues ACPI or other subsystems which are executed very early. If the config option is not enabled, no code is changed, and if the boot paramenter is not given, no new code is executed, and independent of that, all new code is freed after boot, so the config option can be even enabled in standard, non-debug kernels. With specialized tools, it is then possible to get debugging information from machines which have no serial ports (notebooks) such as the printk buffer contents, or any data which can be referenced from global pointers, if it is stored below the 4GB limit and even memory dumps of of the physical RAM region below the 4GB limit can be taken without any cooperation from the CPU of the host, so the machine can be crashed early, it does not matter. In the extreme, even kernel debuggers can be accessed in this way. I wrote a small kgdb module and an accompanying gdb stub for FireWire which allows to gdb to talk to kgdb using remote remory reads and writes over FireWire. An version of the gdb stub fore FireWire is able to read all global data from a system which is running a a normal kernel without any kernel debugger, without any interruption or support of the system's CPU. That way, e.g. the task struct and so on can be read and even manipulated when the physical DMA access is granted. A HOWTO is included in this patch, in Documentation/debugging-via-ohci1394.txt and I've put a copy online at ftp://ftp.suse.de/private/bk/firewire/docs/debugging-via-ohci1394.txt It also has links to all the tools which are available to make use of it another copy of it is online at: ftp://ftp.suse.de/private/bk/firewire/kernel/ohci1394_dma_early-v2.diff Cheers, Bernhard PS: This code can be extended to allow to debug panics, suspend and resume by enabling physical DMA especially on these events, so in incremental patches, we could add support e.g. for ohci1394_dma={suspend,resume,panic} Signed-Off-By: Bernhard Kaindl Tested-By: Thomas Renninger --- linux-2.6.24-rc4/arch/x86/kernel/setup_32.c +++ linux-2.6.24-rc4/arch/x86/kernel/setup_32.c @@ -44,6 +44,7 @@ #include #include #include +#include #include