From randy.dunlap@verizon.net Mon May 14 17:30:16 2007 Received: with ECARTIS (v1.0.0; list kdb); Mon, 14 May 2007 17:30:22 -0700 (PDT) Received: from vms040pub.verizon.net (vms040pub.verizon.net [206.46.252.40]) by oss.sgi.com (8.12.10/8.12.10/SuSE Linux 0.7) with ESMTP id l4F0UAfB026964 for ; Mon, 14 May 2007 17:30:11 -0700 Received: from midway.site ([71.245.96.31]) by vms040.mailsrvcs.net (Sun Java System Messaging Server 6.2-6.01 (built Apr 3 2006)) with ESMTPA id <0JI2005Y219T7QL5@vms040.mailsrvcs.net> for kdb@oss.sgi.com; Mon, 14 May 2007 18:29:53 -0500 (CDT) Date: Mon, 14 May 2007 16:35:19 -0700 From: "Randy.Dunlap" Subject: software breakpoint To: kdb@oss.sgi.com Message-id: <20070514163519.0d1710e2.randy.dunlap@verizon.net> Organization: YPO4 MIME-version: 1.0 X-Mailer: Sylpheed 2.3.1 (GTK+ 2.8.10; x86_64-unknown-linux-gnu) Content-type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 8bit X-archive-position: 1198 X-ecartis-version: Ecartis v1.0.0 Sender: kdb-bounce@oss.sgi.com Errors-to: kdb-bounce@oss.sgi.com X-original-sender: randy.dunlap@verizon.net Precedence: bulk X-list: kdb Hi, (This is on Linux 2.6.21.) I tried to use KDB_ENTER() in a kernel init function, specifically, in net/core/netpoll.c::netpoll_setup(), which is called from drivers/net/netconsole.c::init_netconsole(). kdb didn't break/trap. The kernel just printed a message similar to: do_IRQ: 0.129 no handler Am I trying to break before kdb is ready to be used or what? Any suggestions? Thanks, --- ~Randy *** Remember to use Documentation/SubmitChecklist when testing your code *** --------------------------- Use http://oss.sgi.com/ecartis to modify your settings or to unsubscribe. From kaos@sgi.com Mon May 14 22:15:21 2007 Received: with ECARTIS (v1.0.0; list kdb); Mon, 14 May 2007 22:15:26 -0700 (PDT) Received: from larry.melbourne.sgi.com (larry.melbourne.sgi.com [134.14.52.130]) by oss.sgi.com (8.12.10/8.12.10/SuSE Linux 0.7) with SMTP id l4F5FIfB010510 for ; Mon, 14 May 2007 22:15:20 -0700 Received: from kao2.melbourne.sgi.com (kao2.melbourne.sgi.com [134.14.55.180]) by larry.melbourne.sgi.com (950413.SGI.8.6.12/950213.SGI.AUTOCF) via ESMTP id OAA28340 for ; Tue, 15 May 2007 14:52:30 +1000 Received: by kao2.melbourne.sgi.com (Postfix, from userid 16331) id 6802F2F40; Tue, 15 May 2007 14:52:52 +1000 (EST) Received: from kao2.melbourne.sgi.com (localhost [127.0.0.1]) by kao2.melbourne.sgi.com (Postfix) with ESMTP id 4D50081EC0; Tue, 15 May 2007 14:52:52 +1000 (EST) X-Mailer: exmh version 2.7.2 01/07/2005 with nmh-1.1 From: Keith Owens To: "Randy.Dunlap" cc: kdb@oss.sgi.com Subject: Re: software breakpoint In-reply-to: Your message of "Mon, 14 May 2007 16:35:19 MST." <20070514163519.0d1710e2.randy.dunlap@verizon.net> Mime-Version: 1.0 Content-type: text/plain; charset=us-ascii Date: Tue, 15 May 2007 14:52:52 +1000 Message-ID: <6691.1179204772@kao2.melbourne.sgi.com> Content-Transfer-Encoding: 8bit X-archive-position: 1199 X-ecartis-version: Ecartis v1.0.0 Sender: kdb-bounce@oss.sgi.com Errors-to: kdb-bounce@oss.sgi.com X-original-sender: kaos@sgi.com Precedence: bulk X-list: kdb "Randy.Dunlap" (on Mon, 14 May 2007 16:35:19 -0700) wrote: >I tried to use KDB_ENTER() in a kernel init function, >specifically, in net/core/netpoll.c::netpoll_setup(), which is >called from drivers/net/netconsole.c::init_netconsole(). > >kdb didn't break/trap. The kernel just printed a message >similar to: > >do_IRQ: 0.129 no handler > >Am I trying to break before kdb is ready to be used or what? arch/i386/kdb/kdbasupport::kdba_late_init() sets up the interrupt gate for KDBENTER_VECTOR (129). kdba_late_init() is defined as __initcall, init_netconsole is module_init which also maps to __initcall. Booting with initcall_debug shows netconsole being initialized before kdba_late_init. >Any suggestions? Apply this patch, it will be rolled into the next kdb patch set, along with an x86_64 equivalent. Index: linux/arch/i386/kdb/kdbasupport.c =================================================================== --- linux.orig/arch/i386/kdb/kdbasupport.c 2007-05-15 14:50:28.271496876 +1000 +++ linux/arch/i386/kdb/kdbasupport.c 2007-05-15 14:49:30.786998513 +1000 @@ -1010,7 +1010,7 @@ kdba_verify_rw(unsigned long addr, size_ } static int __init -kdba_late_init(void) +kdba_arch_init(void) { #ifdef CONFIG_SMP set_intr_gate(KDB_VECTOR, kdb_interrupt); @@ -1019,7 +1019,7 @@ kdba_late_init(void) return 0; } -__initcall(kdba_late_init); +arch_initcall(kdba_arch_init); #ifdef CONFIG_SMP --------------------------- Use http://oss.sgi.com/ecartis to modify your settings or to unsubscribe. From randy.dunlap@verizon.net Tue May 15 11:29:23 2007 Received: with ECARTIS (v1.0.0; list kdb); Tue, 15 May 2007 11:29:28 -0700 (PDT) Received: from vms042pub.verizon.net (vms042pub.verizon.net [206.46.252.42]) by oss.sgi.com (8.12.10/8.12.10/SuSE Linux 0.7) with ESMTP id l4FITHfB004402 for ; Tue, 15 May 2007 11:29:22 -0700 Received: from midway.site ([71.245.96.31]) by vms042.mailsrvcs.net (Sun Java System Messaging Server 6.2-6.01 (built Apr 3 2006)) with ESMTPA id <0JI300F0ZI0DRA69@vms042.mailsrvcs.net> for kdb@oss.sgi.com; Tue, 15 May 2007 13:29:02 -0500 (CDT) Date: Tue, 15 May 2007 11:34:32 -0700 From: "Randy.Dunlap" Subject: Re: software breakpoint In-reply-to: <6691.1179204772@kao2.melbourne.sgi.com> To: Keith Owens Cc: kdb@oss.sgi.com Message-id: <20070515113432.c106e32e.randy.dunlap@verizon.net> Organization: YPO4 MIME-version: 1.0 X-Mailer: Sylpheed 2.3.1 (GTK+ 2.8.10; x86_64-unknown-linux-gnu) Content-type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 8bit References: <20070514163519.0d1710e2.randy.dunlap@verizon.net> <6691.1179204772@kao2.melbourne.sgi.com> X-archive-position: 1200 X-ecartis-version: Ecartis v1.0.0 Sender: kdb-bounce@oss.sgi.com Errors-to: kdb-bounce@oss.sgi.com X-original-sender: randy.dunlap@verizon.net Precedence: bulk X-list: kdb On Tue, 15 May 2007 14:52:52 +1000 Keith Owens wrote: > "Randy.Dunlap" (on Mon, 14 May 2007 16:35:19 -0700) wrote: > >I tried to use KDB_ENTER() in a kernel init function, > >specifically, in net/core/netpoll.c::netpoll_setup(), which is > >called from drivers/net/netconsole.c::init_netconsole(). > > > >kdb didn't break/trap. The kernel just printed a message > >similar to: > > > >do_IRQ: 0.129 no handler > > > >Am I trying to break before kdb is ready to be used or what? > > arch/i386/kdb/kdbasupport::kdba_late_init() sets up the interrupt gate > for KDBENTER_VECTOR (129). kdba_late_init() is defined as __initcall, > init_netconsole is module_init which also maps to __initcall. Booting > with initcall_debug shows netconsole being initialized before kdba_late_init. > > >Any suggestions? > > Apply this patch, it will be rolled into the next kdb patch set, along > with an x86_64 equivalent. Ack, I needed it for x86_64 and it's working now. Thanks, Keith. > Index: linux/arch/i386/kdb/kdbasupport.c > =================================================================== > --- linux.orig/arch/i386/kdb/kdbasupport.c 2007-05-15 14:50:28.271496876 +1000 > +++ linux/arch/i386/kdb/kdbasupport.c 2007-05-15 14:49:30.786998513 +1000 > @@ -1010,7 +1010,7 @@ kdba_verify_rw(unsigned long addr, size_ > } > > static int __init > -kdba_late_init(void) > +kdba_arch_init(void) > { > #ifdef CONFIG_SMP > set_intr_gate(KDB_VECTOR, kdb_interrupt); > @@ -1019,7 +1019,7 @@ kdba_late_init(void) > return 0; > } > > -__initcall(kdba_late_init); > +arch_initcall(kdba_arch_init); > > #ifdef CONFIG_SMP > > --- ~Randy *** Remember to use Documentation/SubmitChecklist when testing your code *** --------------------------- Use http://oss.sgi.com/ecartis to modify your settings or to unsubscribe. From bernie@codewiz.org Tue May 15 12:44:11 2007 Received: with ECARTIS (v1.0.0; list kdb); Tue, 15 May 2007 12:44:18 -0700 (PDT) Received: from develer.com (81-174-33-43.f5.ngi.it [81.174.33.43] (may be forged)) by oss.sgi.com (8.12.10/8.12.10/SuSE Linux 0.7) with ESMTP id l4FJi8fB020263 for ; Tue, 15 May 2007 12:44:10 -0700 Received: (qmail 23786 invoked from network); 15 May 2007 19:44:07 -0000 Received: from 1cc-dhcp-121.media.mit.edu (HELO ?18.85.46.121?) (bernie@18.85.46.121) by trinity.develer.com with ESMTPA; 15 May 2007 19:44:07 -0000 Message-ID: <464A0D85.4070003@codewiz.org> Date: Tue, 15 May 2007 15:44:05 -0400 From: Bernardo Innocenti Organization: http://www.codewiz.org/ User-Agent: Thunderbird 2.0.0.0 (X11/20070504) MIME-Version: 1.0 To: Mitch Bradley CC: kdb@oss.sgi.com, lkml@vger.kernel.org, devel@laptop.org Subject: Re: [PATCH] kdb: add rdmsr and wrmsr commands for i386 References: <46494B99.2030502@codewiz.org> <46495C6F.1050207@firmworks.com> In-Reply-To: <46495C6F.1050207@firmworks.com> Content-type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-archive-position: 1201 X-ecartis-version: Ecartis v1.0.0 Sender: kdb-bounce@oss.sgi.com Errors-to: kdb-bounce@oss.sgi.com X-original-sender: bernie@codewiz.org Precedence: bulk X-list: kdb Mitch Bradley wrote: > Bernardo Innocenti wrote: >> The syntax is: >> rdmsr >> wrmsr > > In the hardware documentation that I have seen, MSR values are > conventionally shown as 64-bit numbers. The ordering will make > it necessary to do a mental flip. The 32-bit pieces of MSR do not have > individual addresses, so considerations of endianness are not directly > relevant. I reveresed the order as you asked, but, honestly, I don't like it very much either way :-) Here's the patch again: From d03f36a5cbe079de855ef83625dbb26f11f3a2bf Mon Sep 17 00:00:00 2001 From: Bernardo Innocenti Date: Tue, 15 May 2007 15:29:48 -0400 Subject: [PATCH] kdb: add rdmsr and wrmsr commands for i386 The syntax is: rdmsr wrmsr Signed-off-by: Bernardo Innocenti --- arch/i386/kdb/kdbasupport.c | 48 +++++++++++++++++++++++++++++++++++++++--- kdb/kdbmain.c | 3 +- 2 files changed, 45 insertions(+), 6 deletions(-) diff --git a/arch/i386/kdb/kdbasupport.c b/arch/i386/kdb/kdbasupport.c index 482b319..5109db9 100644 --- a/arch/i386/kdb/kdbasupport.c +++ b/arch/i386/kdb/kdbasupport.c @@ -223,6 +223,47 @@ kdba_removedbreg(kdb_bp_t *bp) kdba_putdr7(dr7); } +static int +kdba_rdmsr(int argc, const char **argv) +{ + unsigned long addr; + uint64_t val; + int diag; + + if (argc != 1) { + return KDB_ARGCOUNT; + } + + if ((diag = kdbgetularg(argv[1], &addr))) + return diag; + + kdb_printf("msr(0x%lx) = ", addr); + rdmsrl(addr, val); + kdb_printf("0x%llx\n", val); + + return 0; +} + +static int +kdba_wrmsr(int argc, const char **argv) +{ + unsigned long addr; + unsigned long l, h; + int diag; + + if (argc != 3) + return KDB_ARGCOUNT; + + if ((diag = kdbgetularg(argv[1], &addr)) + || (diag = kdbgetularg(argv[2], &h)) + || (diag = kdbgetularg(argv[3], &l))) + return diag; + + wrmsr(addr, l, h); + + return 0; +} + /* * kdba_getregcontents @@ -474,12 +515,11 @@ kdba_setregcontents(const char *regname, * argument is NULL (struct pt_regs). The alternate register * set types supported by this function: * - * d Debug registers + * d Debug registers * c Control registers * u User registers at most recent entry to kernel * for the process currently selected with "pid" command. * Following not yet implemented: - * m Model Specific Registers (extra defines register #) * r Memory Type Range Registers (extra defines register) */ @@ -546,8 +586,6 @@ kdba_dumpregs(struct pt_regs *regs, cr[0], cr[1], cr[2], cr[3], cr[4]); return 0; } - case 'm': - break; case 'r': break; default: @@ -899,6 +937,8 @@ kdba_init(void) { kdb_register("pt_regs", kdba_pt_regs, "address", "Format struct pt_regs", 0); kdb_register("stackdepth", kdba_stackdepth, "[percentage]", "Print processes using >= stack percentage", 0); + kdb_register("rdmsr", kdba_rdmsr, "", "Display Model Specific Register", 0); + kdb_register("wrmsr", kdba_wrmsr, " ", "Modify Model Specific Register", 0); return; } diff --git a/kdb/kdbmain.c b/kdb/kdbmain.c index 0b2cb91..88bf14f 100644 --- a/kdb/kdbmain.c +++ b/kdb/kdbmain.c @@ -2596,8 +2596,7 @@ kdb_rd(int argc, const char **argv) * none. * Remarks: * Currently doesn't allow modification of control or - * debug registers, nor does it allow modification - * of model-specific registers (MSR). + * debug registers. */ static int -- 1.5.0.2 -- // Bernardo Innocenti \X/ http://www.codewiz.org/ --------------------------- Use http://oss.sgi.com/ecartis to modify your settings or to unsubscribe. From bernie@codewiz.org Tue May 15 13:35:32 2007 Received: with ECARTIS (v1.0.0; list kdb); Tue, 15 May 2007 13:35:36 -0700 (PDT) Received: from develer.com (81-174-33-43.f5.ngi.it [81.174.33.43] (may be forged)) by oss.sgi.com (8.12.10/8.12.10/SuSE Linux 0.7) with ESMTP id l4FKZRfB030870 for ; Tue, 15 May 2007 13:35:30 -0700 Received: (qmail 1745 invoked from network); 15 May 2007 20:35:25 -0000 Received: from 1cc-dhcp-121.media.mit.edu (HELO ?18.85.46.121?) (bernie@18.85.46.121) by trinity.develer.com with ESMTPA; 15 May 2007 20:35:25 -0000 Message-ID: <464A1985.1010903@codewiz.org> Date: Tue, 15 May 2007 16:35:17 -0400 From: Bernardo Innocenti Organization: http://www.codewiz.org/ User-Agent: Thunderbird 2.0.0.0 (X11/20070504) MIME-Version: 1.0 To: Mitch Bradley CC: Jordan Crouse , kdb@oss.sgi.com, lkml@vger.kernel.org, devel@laptop.org Subject: Re: kdb: add rdmsr and wrmsr commands for i386 References: <46494B99.2030502@codewiz.org> <20070515145133.GE27984@cosmic.amd.com> <4649E9CA.8090902@firmworks.com> <20070515171511.GA32726@cosmic.amd.com> <4649ECE6.7080404@firmworks.com> In-Reply-To: <4649ECE6.7080404@firmworks.com> Content-type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-archive-position: 1202 X-ecartis-version: Ecartis v1.0.0 Sender: kdb-bounce@oss.sgi.com Errors-to: kdb-bounce@oss.sgi.com X-original-sender: bernie@codewiz.org Precedence: bulk X-list: kdb Mitch Bradley wrote: > If it wouldn't be too difficult, it would also be nice to permit > embedded commas or dots in the number, because counting digits in a > 64-bit number is very difficult without the help of punctuation. It is customary to use _ for this purpose: 0x01234567_89ABCDEF. Some people even break it in 16bit words, but it seems overkill to me. -- // Bernardo Innocenti \X/ http://www.codewiz.org/ --------------------------- Use http://oss.sgi.com/ecartis to modify your settings or to unsubscribe. From randy.dunlap@verizon.net Tue May 15 16:37:28 2007 Received: with ECARTIS (v1.0.0; list kdb); Tue, 15 May 2007 16:37:33 -0700 (PDT) Received: from vms044pub.verizon.net (vms044pub.verizon.net [206.46.252.44]) by oss.sgi.com (8.12.10/8.12.10/SuSE Linux 0.7) with ESMTP id l4FNbRfB007569 for ; Tue, 15 May 2007 16:37:28 -0700 Received: from midway.site ([71.245.96.31]) by vms044.mailsrvcs.net (Sun Java System Messaging Server 6.2-6.01 (built Apr 3 2006)) with ESMTPA id <0JI30058RWA1EHK7@vms044.mailsrvcs.net> for kdb@oss.sgi.com; Tue, 15 May 2007 18:37:14 -0500 (CDT) Date: Tue, 15 May 2007 16:42:45 -0700 From: "Randy.Dunlap" Subject: kdb_cmds: new (returning) user questions To: kdb@oss.sgi.com Message-id: <20070515164245.492e14ef.randy.dunlap@verizon.net> Organization: YPO4 MIME-version: 1.0 X-Mailer: Sylpheed 2.3.1 (GTK+ 2.8.10; x86_64-unknown-linux-gnu) Content-type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 8bit X-archive-position: 1203 X-ecartis-version: Ecartis v1.0.0 Sender: kdb-bounce@oss.sgi.com Errors-to: kdb-bounce@oss.sgi.com X-original-sender: randy.dunlap@verizon.net Precedence: bulk X-list: kdb Howdy, I have a few basic questions. 1. Is there a way to "import" custom kdb commands other than putting them into kdb_cmds and rebuilding the kernel? 2. I'd like to be able to "bc all" (or "bca"). or I can put that into a custom defcmd... Should I just do the latter? 3. I often need to use what some debuggers call "step over", i.e., execute a call instruction and break after it returns, immediately after the call instruction. Does kdb already have this command and I just don't see it? Currently I just use: defcmd soc "" "step over call" bp %rip+5 # CPU-specific go endefcmd but that leaves me with (should be temporary) breakpoints that should be deleted ASAP. Can I determine what bpnum was used and then clear it later? (although I don't know when I would clear it) 4. Is there a way to print (decode) the CPU flags register so that I can see which bits (conditions) are set/clear? Thanks. --- ~Randy --- ~Randy *** Remember to use Documentation/SubmitChecklist when testing your code *** --------------------------- Use http://oss.sgi.com/ecartis to modify your settings or to unsubscribe. From slurndal@3leafnetworks.com Tue May 15 17:43:09 2007 Received: with ECARTIS (v1.0.0; list kdb); Tue, 15 May 2007 17:43:14 -0700 (PDT) Received: from pendragon.3leafnetworks.com (65-115-68-194.dia.static.qwest.net [65.115.68.194]) by oss.sgi.com (8.12.10/8.12.10/SuSE Linux 0.7) with ESMTP id l4G0h7fB021598 for ; Tue, 15 May 2007 17:43:08 -0700 Received: from pendragon.3leafnetworks.com (localhost.localdomain [127.0.0.1]) by pendragon.3leafnetworks.com (8.13.7/8.13.7) with ESMTP id l4FNiex3005167; Tue, 15 May 2007 16:44:40 -0700 Received: (from slurndal@localhost) by pendragon.3leafnetworks.com (8.13.7/8.13.7/Submit) id l4FNief5005166; Tue, 15 May 2007 16:44:40 -0700 Date: Tue, 15 May 2007 16:44:40 -0700 From: Scott Lurndal To: "Randy.Dunlap" Cc: kdb@oss.sgi.com Subject: Re: kdb_cmds: new (returning) user questions Message-ID: <20070515234440.GB4972@pendragon.3leafnetworks.com> References: <20070515164245.492e14ef.randy.dunlap@verizon.net> Mime-Version: 1.0 Content-type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20070515164245.492e14ef.randy.dunlap@verizon.net> User-Agent: Mutt/1.4.2.1i Content-Transfer-Encoding: 8bit X-archive-position: 1204 X-ecartis-version: Ecartis v1.0.0 Sender: kdb-bounce@oss.sgi.com Errors-to: kdb-bounce@oss.sgi.com X-original-sender: scott.lurndal@3leafnetworks.com Precedence: bulk X-list: kdb On Tue, May 15, 2007 at 04:42:45PM -0700, Randy.Dunlap wrote: > Howdy, > > I have a few basic questions. > > 1. Is there a way to "import" custom kdb commands other than > putting them into kdb_cmds and rebuilding the kernel? The traditional method is to create a loadable kernel module which registers a command using kdb_register. There are several examples in the KDB patch. > > 2. I'd like to be able to "bc all" (or "bca"). or I can put > that into a custom defcmd... Should I just do the latter? One difficultly with loadable kernel modules is that they only have access symbols in the base KDB that have been exported. You may not have access to all the symbols to implement bc all in a module-based command. > > 3. I often need to use what some debuggers call "step over", > i.e., execute a call instruction and break after it returns, > immediately after the call instruction. Does kdb already have > this command and I just don't see it? Currently I just use: > > defcmd soc "" "step over call" > bp %rip+5 # CPU-specific > go > endefcmd > > but that leaves me with (should be temporary) breakpoints that > should be deleted ASAP. Can I determine what bpnum was used and > then clear it later? (although I don't know when I would clear it) I don't believe this capability exists at this point; Keith may have something in progress for this. There is a flavor of ss that will single step to the next branch-type instruction, but nothing that can be used to step -over- a call (e.g. step vs. next). > > 4. Is there a way to print (decode) the CPU flags register so that > I can see which bits (conditions) are set/clear? Not aware of a method for this. This is something that a module registered command could implement. scott --------------------------- Use http://oss.sgi.com/ecartis to modify your settings or to unsubscribe. From bernie@codewiz.org Tue May 15 20:04:02 2007 Received: with ECARTIS (v1.0.0; list kdb); Tue, 15 May 2007 20:04:07 -0700 (PDT) Received: from develer.com (81-174-33-43.f5.ngi.it [81.174.33.43] (may be forged)) by oss.sgi.com (8.12.10/8.12.10/SuSE Linux 0.7) with ESMTP id l4G33xfB010891 for ; Tue, 15 May 2007 20:04:01 -0700 Received: (qmail 18243 invoked from network); 16 May 2007 03:03:58 -0000 Received: from 1cc-dhcp-121.media.mit.edu (HELO ?18.85.46.121?) (bernie@18.85.46.121) by trinity.develer.com with ESMTPA; 16 May 2007 03:03:58 -0000 Message-ID: <464A749B.4010906@codewiz.org> Date: Tue, 15 May 2007 23:03:55 -0400 From: Bernardo Innocenti Organization: http://www.codewiz.org/ User-Agent: Thunderbird 2.0.0.0 (X11/20070504) MIME-Version: 1.0 To: Jordan Crouse CC: kdb@oss.sgi.com, linux-kernel@vger.kernel.org, devel@laptop.org Subject: Re: kdb: add rdmsr and wrmsr commands for i386 References: <46494B99.2030502@codewiz.org> <20070515145133.GE27984@cosmic.amd.com> In-Reply-To: <20070515145133.GE27984@cosmic.amd.com> Content-type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-archive-position: 1205 X-ecartis-version: Ecartis v1.0.0 Sender: kdb-bounce@oss.sgi.com Errors-to: kdb-bounce@oss.sgi.com X-original-sender: bernie@codewiz.org Precedence: bulk X-list: kdb Jordan Crouse wrote: > Can you break this up with a : between the high dword and the low dword? > That makes it easier to parse when debugging. Good idea, but I used "_" instead because it's what AMD uses in their documentation and it looks better with a "0x" prefix. > Also, would it make sense to coordinate the order of the high and low > dwords with the order they are specified with 'wrmsr'? Yeah, I did it as suggested by Mitch. Here's a thrid revision of the patch with everything included: From 1850ca76585306e2484cf5e709434049f1df3c1f Mon Sep 17 00:00:00 2001 From: Bernardo Innocenti Date: Tue, 15 May 2007 15:29:48 -0400 Subject: [PATCH] kdb: add rdmsr and wrmsr commands for i386 (take 3) The syntax is: rdmsr wrmsr Signed-off-by: Bernardo Innocenti --- arch/i386/kdb/kdbasupport.c | 47 +++++++++++++++++++++++++++++++++++++++--- kdb/kdbmain.c | 3 +- 2 files changed, 44 insertions(+), 6 deletions(-) diff --git a/arch/i386/kdb/kdbasupport.c b/arch/i386/kdb/kdbasupport.c index 482b319..7038dfb 100644 --- a/arch/i386/kdb/kdbasupport.c +++ b/arch/i386/kdb/kdbasupport.c @@ -223,6 +223,46 @@ kdba_removedbreg(kdb_bp_t *bp) kdba_putdr7(dr7); } +static int +kdba_rdmsr(int argc, const char **argv) +{ + unsigned long addr; + uint32_t l, h; + int diag; + + if (argc != 1) + return KDB_ARGCOUNT; + + if ((diag = kdbgetularg(argv[1], &addr))) + return diag; + + kdb_printf("msr(0x%lx) = ", addr); + rdmsr(addr, l, h); + kdb_printf("0x%08lx_%08lx\n", h, l); + + return 0; +} + +static int +kdba_wrmsr(int argc, const char **argv) +{ + unsigned long addr; + unsigned long l, h; + int diag; + + if (argc != 3) + return KDB_ARGCOUNT; + + if ((diag = kdbgetularg(argv[1], &addr)) + || (diag = kdbgetularg(argv[2], &h)) + || (diag = kdbgetularg(argv[3], &l))) + return diag; + + wrmsr(addr, l, h); + + return 0; +} + /* * kdba_getregcontents @@ -474,12 +514,11 @@ kdba_setregcontents(const char *regname, * argument is NULL (struct pt_regs). The alternate register * set types supported by this function: * - * d Debug registers + * d Debug registers * c Control registers * u User registers at most recent entry to kernel * for the process currently selected with "pid" command. * Following not yet implemented: - * m Model Specific Registers (extra defines register #) * r Memory Type Range Registers (extra defines register) */ @@ -546,8 +585,6 @@ kdba_dumpregs(struct pt_regs *regs, cr[0], cr[1], cr[2], cr[3], cr[4]); return 0; } - case 'm': - break; case 'r': break; default: @@ -899,6 +936,8 @@ kdba_init(void) { kdb_register("pt_regs", kdba_pt_regs, "address", "Format struct pt_regs", 0); kdb_register("stackdepth", kdba_stackdepth, "[percentage]", "Print processes using >= stack percentage", 0); + kdb_register("rdmsr", kdba_rdmsr, "", "Display Model Specific Register", 0); + kdb_register("wrmsr", kdba_wrmsr, " ", "Modify Model Specific Register", 0); return; } diff --git a/kdb/kdbmain.c b/kdb/kdbmain.c index 0b2cb91..88bf14f 100644 --- a/kdb/kdbmain.c +++ b/kdb/kdbmain.c @@ -2596,8 +2596,7 @@ kdb_rd(int argc, const char **argv) * none. * Remarks: * Currently doesn't allow modification of control or - * debug registers, nor does it allow modification - * of model-specific registers (MSR). + * debug registers. */ static int -- 1.5.0.2 -- // Bernardo Innocenti \X/ http://www.codewiz.org/ --------------------------- Use http://oss.sgi.com/ecartis to modify your settings or to unsubscribe. From kaos@sgi.com Wed May 16 04:20:29 2007 Received: with ECARTIS (v1.0.0; list kdb); Wed, 16 May 2007 04:20:36 -0700 (PDT) Received: from larry.melbourne.sgi.com (larry.melbourne.sgi.com [134.14.52.130]) by oss.sgi.com (8.12.10/8.12.10/SuSE Linux 0.7) with SMTP id l4GBKOfB019825 for ; Wed, 16 May 2007 04:20:27 -0700 Received: from mail.ocs.com.au (kao1.melbourne.sgi.com [134.14.55.179]) by larry.melbourne.sgi.com (950413.SGI.8.6.12/950213.SGI.AUTOCF) via ESMTP id VAA09343 for ; Wed, 16 May 2007 21:20:21 +1000 Received: from ocs3.ocs.com.au (ocs3w.ocs.com.au [192.168.254.3]) by mail.ocs.com.au (Postfix) with ESMTP id 6BF79E12CF3; Wed, 16 May 2007 21:20:21 +1000 (EST) Received: by ocs3.ocs.com.au (Postfix, from userid 16331) id F16C92F40; Wed, 16 May 2007 21:20:20 +1000 (EST) Received: from ocs3.ocs.com.au (localhost [127.0.0.1]) by ocs3.ocs.com.au (Postfix) with ESMTP id B9ACA81EC0; Wed, 16 May 2007 21:20:20 +1000 (EST) X-Mailer: exmh version 2.7.2 01/07/2005 with nmh-1.1 From: Keith Owens To: "Randy.Dunlap" cc: kdb@oss.sgi.com Subject: Re: kdb_cmds: new (returning) user questions In-reply-to: Your message of "Tue, 15 May 2007 16:42:45 MST." <20070515164245.492e14ef.randy.dunlap@verizon.net> Mime-Version: 1.0 Content-type: text/plain; charset=us-ascii Date: Wed, 16 May 2007 21:20:20 +1000 Message-ID: <11527.1179314420@ocs3.ocs.com.au> Content-Transfer-Encoding: 8bit X-archive-position: 1206 X-ecartis-version: Ecartis v1.0.0 Sender: kdb-bounce@oss.sgi.com Errors-to: kdb-bounce@oss.sgi.com X-original-sender: kaos@sgi.com Precedence: bulk X-list: kdb "Randy.Dunlap" (on Tue, 15 May 2007 16:42:45 -0700) wrote: >2. I'd like to be able to "bc all" (or "bca"). or I can put >that into a custom defcmd... Should I just do the latter? "bc *". man linux/Documentation/kdb/kdb_bp.man >3. I often need to use what some debuggers call "step over", >i.e., execute a call instruction and break after it returns, >immediately after the call instruction. Does kdb already have >this command and I just don't see it? Currently I just use: > >defcmd soc "" "step over call" > bp %rip+5 # CPU-specific > go >endefcmd > >but that leaves me with (should be temporary) breakpoints that >should be deleted ASAP. Can I determine what bpnum was used and >then clear it later? (although I don't know when I would clear it) AFAIK, the "step over" function of a debugger does :- * single step the call * get the return address * set a breakpoint on the return address * allow the cpu(s) to run * when the breakpoint trips, delete the breakpoint. That can almost be automated as a kdb command, the problem areas are SMP, interrupts and preemption. When the cpus are allowed to run, any of them can hit the breakpoint, not just the current cpu. Even the current cpu can hit the breakpoint if the task is interrupted or preempted and other code runs on the same cpu before your original code gets a chance to run. I never found an acceptable solution to work around the reentrancy problems for kernel code. >4. Is there a way to print (decode) the CPU flags register so that >I can see which bits (conditions) are set/clear? No. Feel free to write one for kdb, but I usually handle this sort of problem by taking the hex value and feeding it to an external script. Like this one for decoding the IA64 psr bits. #!/usr/bin/perl -w use strict; use integer; my @fields = ( [ 0, 6, "User mask" ], [ 0, 1, "rv" ], [ 1, 1, "be" ], [ 2, 1, "up" ], [ 3, 1, "ac" ], [ 4, 1, "mfl" ], [ 5, 1, "mfh" ], [ 0, 24, "System mask" ], [ 6, 7, "rv" ], [ 13, 1, "ic" ], [ 14, 1, "i" ], [ 15, 1, "pk" ], [ 16, 1, "rv" ], [ 17, 1, "dt" ], [ 18, 1, "dfl" ], [ 19, 1, "dfh" ], [ 20, 1, "sp" ], [ 21, 1, "pp" ], [ 22, 1, "di" ], [ 23, 1, "si" ], [ 24, 1, "db" ], [ 25, 1, "lp" ], [ 26, 1, "tb" ], [ 27, 1, "rt" ], [ 28, 4, "rv" ], [ 32, 2, "cpl" ], [ 34, 1, "is" ], [ 35, 1, "mc" ], [ 36, 1, "it" ], [ 37, 1, "id" ], [ 38, 1, "da" ], [ 39, 1, "dd" ], [ 40, 1, "ss" ], [ 41, 2, "ri" ], [ 43, 1, "ed" ], [ 44, 1, "bn" ], [ 45, 1, "ia" ], [ 46, 1, "vm" ], [ 47, 17, "rv" ], ); while (defined($_ = )) { chomp(); my $w0 = hex(substr($_, 0, -8)); my $w1 = hex(substr($_, -8)); printf("psr %s\n", $_); &ia64_word($w1, 0, 32); &ia64_word($w0, 32, 64); } sub ia64_word() { my ($w, $s, $e) = @_; my $v; foreach (@fields) { next if ($_->[0] >= $e); next if ($_->[0] < $s); # use integer implies signed shift, I want unsigned no integer; $v = ($w >> ($_->[0] - $s)) & (~0 >> (32 - $_->[1])); printf("%2d %2d %12s %x\n", $_->[0], $_->[1], $_->[2], $v); } } --------------------------- Use http://oss.sgi.com/ecartis to modify your settings or to unsubscribe. From kaos@sgi.com Wed May 16 23:22:40 2007 Received: with ECARTIS (v1.0.0; list kdb); Wed, 16 May 2007 23:22:45 -0700 (PDT) Received: from larry.melbourne.sgi.com (larry.melbourne.sgi.com [134.14.52.130]) by oss.sgi.com (8.12.10/8.12.10/SuSE Linux 0.7) with SMTP id l4H6MZfB013629 for ; Wed, 16 May 2007 23:22:37 -0700 Received: from kao2.melbourne.sgi.com (kao2.melbourne.sgi.com [134.14.55.180]) by larry.melbourne.sgi.com (950413.SGI.8.6.12/950213.SGI.AUTOCF) via ESMTP id QAA08386 for ; Thu, 17 May 2007 16:22:33 +1000 Received: by kao2.melbourne.sgi.com (Postfix, from userid 16331) id 9C27E2F40; Thu, 17 May 2007 16:22:33 +1000 (EST) Received: from kao2.melbourne.sgi.com (localhost [127.0.0.1]) by kao2.melbourne.sgi.com (Postfix) with ESMTP id 7EE9581EC0; Thu, 17 May 2007 16:22:33 +1000 (EST) X-Mailer: exmh version 2.7.2 01/07/2005 with nmh-1.1 From: Keith Owens To: Bernardo Innocenti cc: Jordan Crouse , kdb@oss.sgi.com, linux-kernel@vger.kernel.org, devel@laptop.org Subject: Re: kdb: add rdmsr and wrmsr commands for i386 In-reply-to: Your message of "Tue, 15 May 2007 23:03:55 -0400." <464A749B.4010906@codewiz.org> Mime-Version: 1.0 Content-type: text/plain; charset=us-ascii Date: Thu, 17 May 2007 16:22:33 +1000 Message-ID: <6778.1179382953@kao2.melbourne.sgi.com> Content-Transfer-Encoding: 8bit X-archive-position: 1207 X-ecartis-version: Ecartis v1.0.0 Sender: kdb-bounce@oss.sgi.com Errors-to: kdb-bounce@oss.sgi.com X-original-sender: kaos@sgi.com Precedence: bulk X-list: kdb Bernardo Innocenti (on Tue, 15 May 2007 23:03:55 -0400) wrote: >Jordan Crouse wrote: > >> Can you break this up with a : between the high dword and the low dword? >> That makes it easier to parse when debugging. > >Good idea, but I used "_" instead because it's what AMD uses in their >documentation and it looks better with a "0x" prefix. > >> Also, would it make sense to coordinate the order of the high and low >> dwords with the order they are specified with 'wrmsr'? > >Yeah, I did it as suggested by Mitch. Here's a thrid >revision of the patch with everything included: > >From 1850ca76585306e2484cf5e709434049f1df3c1f Mon Sep 17 00:00:00 2001 >From: Bernardo Innocenti >Date: Tue, 15 May 2007 15:29:48 -0400 >Subject: [PATCH] kdb: add rdmsr and wrmsr commands for i386 (take 3) > >The syntax is: > rdmsr > wrmsr > >Signed-off-by: Bernardo Innocenti >--- > arch/i386/kdb/kdbasupport.c | 47 +++++++++++++++++++++++++++++++++++++++--- > kdb/kdbmain.c | 3 +- Thanks for the patch, but ... Before using MSR, you must first check that the cpu supports the instruction, rd/wrmsr cause an oops on 486 or earlier. Also using an invalid msr number causes an oops, so use rd/wrmsr_safe(). Finally, kdb on x86_64 needs the commands as well, so move it to kdb/modules/kdbm_x86.c (common i386/x86_64 code). Cleaned up patch + changelogs. --- arch/i386/kdb/ChangeLog | 6 ++++ arch/i386/kdb/kdbasupport.c | 7 ++-- arch/x86_64/kdb/ChangeLog | 6 ++++ arch/x86_64/kdb/kdbasupport.c | 7 ++-- kdb/ChangeLog | 7 ++++ kdb/kdbmain.c | 3 -- kdb/modules/kdbm_x86.c | 59 ++++++++++++++++++++++++++++++++++++++++++ 7 files changed, 85 insertions(+), 10 deletions(-) diff -u linux/arch/i386/kdb/ChangeLog linux/arch/i386/kdb/ChangeLog --- linux/arch/i386/kdb/ChangeLog +++ linux/arch/i386/kdb/ChangeLog @@ -1,3 +1,9 @@ +2007-05-17 Keith Owens + + * Update dumpregs comments for rdmsr and wrmsr commands. + Bernardo Innocenti. + * kdb v4.4-2.6.21-i386-3. + 2007-05-15 Keith Owens * Change kdba_late_init to kdba_arch_init so KDB_ENTER() can be used diff -u linux/arch/i386/kdb/kdbasupport.c linux/arch/i386/kdb/kdbasupport.c --- linux/arch/i386/kdb/kdbasupport.c +++ linux/arch/i386/kdb/kdbasupport.c @@ -474,13 +474,14 @@ * argument is NULL (struct pt_regs). The alternate register * set types supported by this function: * - * d Debug registers + * d Debug registers * c Control registers * u User registers at most recent entry to kernel * for the process currently selected with "pid" command. * Following not yet implemented: - * m Model Specific Registers (extra defines register #) * r Memory Type Range Registers (extra defines register) + * + * MSR on i386/x86_64 are handled by rdmsr/wrmsr commands. */ int @@ -546,8 +547,6 @@ cr[0], cr[1], cr[2], cr[3], cr[4]); return 0; } - case 'm': - break; case 'r': break; default: diff -u linux/arch/x86_64/kdb/ChangeLog linux/arch/x86_64/kdb/ChangeLog --- linux/arch/x86_64/kdb/ChangeLog +++ linux/arch/x86_64/kdb/ChangeLog @@ -1,3 +1,9 @@ +2007-05-17 Keith Owens + + * Update dumpregs comments for rdmsr and wrmsr commands. + Bernardo Innocenti. + * kdb v4.4-2.6.21-x86_64-3. + 2007-05-15 Keith Owens * Change kdba_late_init to kdba_arch_init so KDB_ENTER() can be used diff -u linux/arch/x86_64/kdb/kdbasupport.c linux/arch/x86_64/kdb/kdbasupport.c --- linux/arch/x86_64/kdb/kdbasupport.c +++ linux/arch/x86_64/kdb/kdbasupport.c @@ -470,12 +470,13 @@ * argument is NULL (struct pt_regs). The alternate register * set types supported by this function: * - * d Debug registers + * d Debug registers * c Control registers * u User registers at most recent entry to kernel * Following not yet implemented: - * m Model Specific Registers (extra defines register #) * r Memory Type Range Registers (extra defines register) + * + * MSR on i386/x86_64 are handled by rdmsr/wrmsr commands. */ int @@ -536,8 +537,6 @@ cr[0], cr[1], cr[2], cr[3], cr[4]); return 0; } - case 'm': - break; case 'r': break; default: diff -u linux/kdb/ChangeLog linux/kdb/ChangeLog --- linux/kdb/ChangeLog +++ linux/kdb/ChangeLog @@ -1,3 +1,10 @@ +2007-05-17 Keith Owens + + * Add rdmsr and wrmsr commands for i386 and x86_64. Original patch by + Bernardo Innocenti for i386, reworked by Keith Owens to make it safe + on all cpu models and to handle both i386 and x86_64. + * kdb v4.4-2.6.21-common-3. + 2007-05-15 Keith Owens * Correct alignment of debug_alloc_header. diff -u linux/kdb/kdbmain.c linux/kdb/kdbmain.c --- linux/kdb/kdbmain.c +++ linux/kdb/kdbmain.c @@ -2596,8 +2596,7 @@ * none. * Remarks: * Currently doesn't allow modification of control or - * debug registers, nor does it allow modification - * of model-specific registers (MSR). + * debug registers. */ static int diff -u linux/kdb/modules/kdbm_x86.c linux/kdb/modules/kdbm_x86.c --- linux/kdb/modules/kdbm_x86.c +++ linux/kdb/modules/kdbm_x86.c @@ -1012,6 +1012,61 @@ return 0; } +static int +kdb_rdmsr(int argc, const char **argv) +{ + unsigned long addr; + uint32_t l, h; + int diag; + struct cpuinfo_x86 *c = cpu_data + smp_processor_id(); + + if (argc != 1) + return KDB_ARGCOUNT; + + if ((diag = kdbgetularg(argv[1], &addr))) + return diag; + + if (!cpu_has(c, X86_FEATURE_MSR)) + return KDB_NOTIMP; + + kdb_printf("msr(0x%lx) = ", addr); + if ((diag = rdmsr_safe(addr, &l, &h))) { + kdb_printf("error %d\n", diag); + return KDB_BADINT; + } else { + kdb_printf("0x%08x_%08x\n", h, l); + } + + return 0; +} + +static int +kdb_wrmsr(int argc, const char **argv) +{ + unsigned long addr; + unsigned long l, h; + int diag; + struct cpuinfo_x86 *c = cpu_data + smp_processor_id(); + + if (argc != 3) + return KDB_ARGCOUNT; + + if ((diag = kdbgetularg(argv[1], &addr)) + || (diag = kdbgetularg(argv[2], &h)) + || (diag = kdbgetularg(argv[3], &l))) + return diag; + + if (!cpu_has(c, X86_FEATURE_MSR)) + return KDB_NOTIMP; + + if ((diag = wrmsr_safe(addr, l, h))) { + kdb_printf("error %d\n", diag); + return KDB_BADINT; + } + + return 0; +} + static int __init kdbm_x86_init(void) { kdb_register("rdv", kdb_rdv, NULL, "Display registers in verbose mode", 0); @@ -1020,6 +1075,8 @@ kdb_register_repeat("ldt", kdb_ldt, " []", "Display LDT", 0, KDB_REPEAT_NO_ARGS); kdb_register_repeat("ptex", kdb_pte, " []", "Display pagetables", 0, KDB_REPEAT_NO_ARGS); kdb_register_repeat("ldtp", kdb_ldt, " []", "Display Process LDT", 0, KDB_REPEAT_NO_ARGS); + kdb_register("rdmsr", kdb_rdmsr, "", "Display Model Specific Register", 0); + kdb_register("wrmsr", kdb_wrmsr, " ", "Modify Model Specific Register", 0); return 0; } @@ -1031,6 +1088,8 @@ kdb_unregister("idt"); kdb_unregister("ptex"); kdb_unregister("ldtp"); + kdb_unregister("rdmsr"); + kdb_unregister("wrmsr"); } module_init(kdbm_x86_init) --------------------------- Use http://oss.sgi.com/ecartis to modify your settings or to unsubscribe. From bernie@codewiz.org Wed May 16 23:36:37 2007 Received: with ECARTIS (v1.0.0; list kdb); Wed, 16 May 2007 23:36:41 -0700 (PDT) Received: from develer.com (81-174-33-43.f5.ngi.it [81.174.33.43] (may be forged)) by oss.sgi.com (8.12.10/8.12.10/SuSE Linux 0.7) with ESMTP id l4H6aZfB016416 for ; Wed, 16 May 2007 23:36:36 -0700 Received: (qmail 28628 invoked from network); 17 May 2007 06:36:34 -0000 Received: from 1cc-dhcp-121.media.mit.edu (HELO ?18.85.46.121?) (bernie@18.85.46.121) by trinity.develer.com with ESMTPA; 17 May 2007 06:36:34 -0000 Message-ID: <464BF7E5.4080105@codewiz.org> Date: Thu, 17 May 2007 02:36:21 -0400 From: Bernardo Innocenti Organization: http://www.codewiz.org/ User-Agent: Thunderbird 2.0.0.0 (X11/20070419) MIME-Version: 1.0 To: Keith Owens CC: Jordan Crouse , kdb@oss.sgi.com, linux-kernel@vger.kernel.org, devel@laptop.org Subject: Re: kdb: add rdmsr and wrmsr commands for i386 References: <6778.1179382953@kao2.melbourne.sgi.com> In-Reply-To: <6778.1179382953@kao2.melbourne.sgi.com> Content-type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-archive-position: 1208 X-ecartis-version: Ecartis v1.0.0 Sender: kdb-bounce@oss.sgi.com Errors-to: kdb-bounce@oss.sgi.com X-original-sender: bernie@codewiz.org Precedence: bulk X-list: kdb Keith Owens wrote: > Before using MSR, you must first check that the cpu supports the > instruction, rd/wrmsr cause an oops on 486 or earlier. Also using an > invalid msr number causes an oops, so use rd/wrmsr_safe(). I didn't bother implementing those checks because kdb recovers nicely from GPF anyway. It's the valid MSR writes that could cause unrecoveable problems! :) -- // Bernardo Innocenti \X/ http://www.codewiz.org/ --------------------------- Use http://oss.sgi.com/ecartis to modify your settings or to unsubscribe. From kaos@sgi.com Wed May 16 23:39:40 2007 Received: with ECARTIS (v1.0.0; list kdb); Wed, 16 May 2007 23:39:44 -0700 (PDT) Received: from larry.melbourne.sgi.com (larry.melbourne.sgi.com [134.14.52.130]) by oss.sgi.com (8.12.10/8.12.10/SuSE Linux 0.7) with SMTP id l4H6dbfB017327 for ; Wed, 16 May 2007 23:39:39 -0700 Received: from kao2.melbourne.sgi.com (kao2.melbourne.sgi.com [134.14.55.180]) by larry.melbourne.sgi.com (950413.SGI.8.6.12/950213.SGI.AUTOCF) via ESMTP id QAA08868 for ; Thu, 17 May 2007 16:39:36 +1000 Received: by kao2.melbourne.sgi.com (Postfix, from userid 16331) id DEFDA2F40; Thu, 17 May 2007 16:39:35 +1000 (EST) Received: from kao2.melbourne.sgi.com (localhost [127.0.0.1]) by kao2.melbourne.sgi.com (Postfix) with ESMTP id A71CF81EC0; Thu, 17 May 2007 16:39:35 +1000 (EST) X-Mailer: exmh version 2.7.2 01/07/2005 with nmh-1.1 From: Keith Owens To: Bernardo Innocenti cc: Jordan Crouse , kdb@oss.sgi.com, linux-kernel@vger.kernel.org, devel@laptop.org Subject: Re: kdb: add rdmsr and wrmsr commands for i386 In-reply-to: Your message of "Thu, 17 May 2007 02:36:21 -0400." <464BF7E5.4080105@codewiz.org> Mime-Version: 1.0 Content-type: text/plain; charset=us-ascii Date: Thu, 17 May 2007 16:39:35 +1000 Message-ID: <7803.1179383975@kao2.melbourne.sgi.com> Content-Transfer-Encoding: 8bit X-archive-position: 1209 X-ecartis-version: Ecartis v1.0.0 Sender: kdb-bounce@oss.sgi.com Errors-to: kdb-bounce@oss.sgi.com X-original-sender: kaos@sgi.com Precedence: bulk X-list: kdb Bernardo Innocenti (on Thu, 17 May 2007 02:36:21 -0400) wrote: >Keith Owens wrote: > >> Before using MSR, you must first check that the cpu supports the >> instruction, rd/wrmsr cause an oops on 486 or earlier. Also using an >> invalid msr number causes an oops, so use rd/wrmsr_safe(). > >I didn't bother implementing those checks because kdb recovers >nicely from GPF anyway. Yes and no. Yes, kdb will recover from a GPF. No, because if the system was already running correctly (i.e. manual entry into kdb), then taking a GPF and not recovering will flag the rest of the system as corrupt and can kill a running system. I try to avoid adding spurious system corruption. >It's the valid MSR writes that could >cause unrecoveable problems! :) Tell me about it :-( --------------------------- Use http://oss.sgi.com/ecartis to modify your settings or to unsubscribe. From kbaidarov@ru.mvista.com Fri May 18 08:03:02 2007 Received: with ECARTIS (v1.0.0; list kdb); Fri, 18 May 2007 08:03:08 -0700 (PDT) Received: from mail.dev.rtsoft.ru (rtsoft2.corbina.net [85.21.88.2] (may be forged)) by oss.sgi.com (8.12.10/8.12.10/SuSE Linux 0.7) with SMTP id l4IF30fB022797 for ; Fri, 18 May 2007 08:03:02 -0700 Received: (qmail 13554 invoked from network); 18 May 2007 14:36:19 -0000 Received: from windmill.dev.rtsoft.ru (192.168.1.116) by mail.dev.rtsoft.ru with SMTP; 18 May 2007 14:36:19 -0000 Date: Fri, 18 May 2007 18:40:50 +0400 From: Konstantin Baydarov To: kdb@oss.sgi.com Subject: [PATHC] kdb early fix for i386 kernel Message-ID: <20070518184050.3bcd6933@windmill.dev.rtsoft.ru> X-Mailer: Sylpheed-Claws 2.6.0 (GTK+ 2.8.19; i386-redhat-linux-gnu) Mime-Version: 1.0 Content-type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 8bit X-archive-position: 1210 X-ecartis-version: Ecartis v1.0.0 Sender: kdb-bounce@oss.sgi.com Errors-to: kdb-bounce@oss.sgi.com X-original-sender: kbaidarov@ru.mvista.com Precedence: bulk X-list: kdb Hi! I didn't get any reply on my previous message, I update patch and I hope I'll get reply on that one. Issue: KDB early doesn't work. Can't get kdb console during boot. Investigations: KDB tries to stop kernel very early (in star_kernel() function) executing KDB_ENTER(). To stop kernel kdb have to register trap kdb_call() in IDT before KDB_ENTER() call. But KDB set gate traps later using initcall. How Solved: Patch set KDBENTER_VECTOR trap gate before KDB_ENTER call - in the end of init_IRQ(). I set KDBENTER_VECTOR trap gate in init_IRQ, not in init_traps(), because in SMP case init_IRQ() can reset KDBENTER_VECTOR trap gate to default handler. I set KDB_VECTOR SMP trap gate in smp_intr_init() - also before KDB_ENTER() call. Another issue: kernel can reset KDB trap gates in setup_IO_APIC_irqs(), so I've added extra check in setup_IO_APIC_irqs() to prevent KDB trap gates reset. Patch against krenel 2.6.18. Thanks. Signed-off-by: Konstantin Baydarov arch/i386/kdb/kdbasupport.c | 38 -------------------------------------- arch/i386/kernel/i8259.c | 8 ++++++++ arch/i386/kernel/io_apic.c | 5 ++++- arch/i386/kernel/smpboot.c | 8 ++++++++ arch/i386/kernel/traps.c | 8 ++++++++ 5 files changed, 28 insertions(+), 39 deletions(-) Index: linux-2.6.18/arch/i386/kdb/kdbasupport.c =================================================================== --- linux-2.6.18.orig/arch/i386/kdb/kdbasupport.c +++ linux-2.6.18/arch/i386/kdb/kdbasupport.c @@ -875,32 +875,6 @@ kdba_stackdepth(int argc, const char **a return 0; } -/* Copied from arch/i386/kernel/traps.c */ - -extern struct desc_struct idt_table[256]; - -#define _set_gate(gate_addr,type,dpl,addr,seg) \ -do { \ - int __d0, __d1; \ - __asm__ __volatile__ ("movw %%dx,%%ax\n\t" \ - "movw %4,%%dx\n\t" \ - "movl %%eax,%0\n\t" \ - "movl %%edx,%1" \ - :"=m" (*((long *) (gate_addr))), \ - "=m" (*(1+(long *) (gate_addr))), "=&a" (__d0), "=&d" (__d1) \ - :"i" ((short) (0x8000+(dpl<<13)+(type<<8))), \ - "3" ((char *) (addr)),"2" ((seg) << 16)); \ -} while (0) - -static void __init set_trap_gate(unsigned int n, void *addr) -{ - _set_gate(idt_table+n,15,0,addr,__KERNEL_CS); -} - -/* End of copy from arch/i386/kernel/traps.c */ - -asmlinkage int kdb_call(void); - /* Executed once on each cpu at startup. */ void kdba_cpu_up(void) @@ -1037,18 +1011,6 @@ kdba_verify_rw(unsigned long addr, size_ return(kdba_getarea_size(data, addr, size) || kdba_putarea_size(addr, data, size)); } -static int __init -kdba_late_init(void) -{ -#ifdef CONFIG_SMP - set_intr_gate(KDB_VECTOR, kdb_interrupt); -#endif - set_trap_gate(KDBENTER_VECTOR, kdb_call); - return 0; -} - -__initcall(kdba_late_init); - #ifdef CONFIG_SMP #include Index: linux-2.6.18/arch/i386/kernel/i8259.c =================================================================== --- linux-2.6.18.orig/arch/i386/kernel/i8259.c +++ linux-2.6.18/arch/i386/kernel/i8259.c @@ -395,6 +395,11 @@ void __init init_ISA_irqs (void) } } +#ifdef CONFIG_KDB +asmlinkage int kdb_call(void); +void __init kdb_set_trap_gate(unsigned int n, void *addr); +#endif /* CONFIG_KDB */ + void __init init_IRQ(void) { int i; @@ -434,4 +439,7 @@ void __init init_IRQ(void) setup_irq(FPU_IRQ, &fpu_irq); irq_ctx_init(smp_processor_id()); +#ifdef CONFIG_KDB + kdb_set_trap_gate(KDBENTER_VECTOR, kdb_call); +#endif } Index: linux-2.6.18/arch/i386/kernel/io_apic.c =================================================================== --- linux-2.6.18.orig/arch/i386/kernel/io_apic.c +++ linux-2.6.18/arch/i386/kernel/io_apic.c @@ -1278,7 +1278,10 @@ static void __init setup_IO_APIC_irqs(vo if (IO_APIC_IRQ(irq)) { vector = assign_irq_vector(irq); entry.vector = vector; - ioapic_register_intr(irq, vector, IOAPIC_AUTO); +#ifdef CONFIG_KDB + if((vector != KDB_VECTOR) && (vector != KDBENTER_VECTOR)) +#endif + ioapic_register_intr(irq, vector, IOAPIC_AUTO); if (!apic && (irq < 16)) disable_8259A_irq(irq); Index: linux-2.6.18/arch/i386/kernel/smpboot.c =================================================================== --- linux-2.6.18.orig/arch/i386/kernel/smpboot.c +++ linux-2.6.18/arch/i386/kernel/smpboot.c @@ -57,6 +57,11 @@ #include #include +#ifdef CONFIG_KDB +#include +#include +#endif + /* Set if we find a B stepping CPU */ static int __devinitdata smp_b_stepping; @@ -1485,4 +1490,7 @@ void __init smp_intr_init(void) /* IPI for generic function call */ set_intr_gate(CALL_FUNCTION_VECTOR, call_function_interrupt); +#ifdef CONFIG_KDB + set_intr_gate(KDB_VECTOR, kdb_interrupt); +#endif } Index: linux-2.6.18/arch/i386/kernel/traps.c =================================================================== --- linux-2.6.18.orig/arch/i386/kernel/traps.c +++ linux-2.6.18/arch/i386/kernel/traps.c @@ -40,6 +40,7 @@ #ifdef CONFIG_KDB #include +#include #endif /* CONFIG_KDB */ #include @@ -1200,6 +1201,13 @@ static void __init set_trap_gate(unsigne _set_gate(idt_table+n,15,0,addr,__KERNEL_CS); } +#ifdef CONFIG_KDB +void __init kdb_set_trap_gate(unsigned int n, void *addr) +{ + set_trap_gate(n, addr); +} +#endif + static void __init set_system_gate(unsigned int n, void *addr) { _set_gate(idt_table+n,15,3,addr,__KERNEL_CS); --------------------------- Use http://oss.sgi.com/ecartis to modify your settings or to unsubscribe. From bernie@codewiz.org Fri May 18 09:21:11 2007 Received: with ECARTIS (v1.0.0; list kdb); Fri, 18 May 2007 09:21:16 -0700 (PDT) Received: from develer.com (81-174-33-43.f5.ngi.it [81.174.33.43] (may be forged)) by oss.sgi.com (8.12.10/8.12.10/SuSE Linux 0.7) with ESMTP id l4IGL7fB005228 for ; Fri, 18 May 2007 09:21:10 -0700 Received: (qmail 10351 invoked from network); 18 May 2007 16:21:05 -0000 Received: from 1cc-dhcp-121.media.mit.edu (HELO ?18.85.46.121?) (bernie@18.85.46.121) by trinity.develer.com with ESMTPA; 18 May 2007 16:21:05 -0000 Message-ID: <464DD270.8060708@codewiz.org> Date: Fri, 18 May 2007 12:21:04 -0400 From: Bernardo Innocenti Organization: http://www.codewiz.org/ User-Agent: Thunderbird 2.0.0.0 (X11/20070419) MIME-Version: 1.0 To: kdb@oss.sgi.com Subject: reading mmapped I/O registers Content-type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-archive-position: 1211 X-ecartis-version: Ecartis v1.0.0 Sender: kdb-bounce@oss.sgi.com Errors-to: kdb-bounce@oss.sgi.com X-original-sender: bernie@codewiz.org Precedence: bulk X-list: kdb Hello, I'm debugging Xorg's driver for the AND Geode GX/LX. The driver mmap()s /dev/mem to access the graphics processor registers. But from kdb I can't dump this memory range neither through the process virtual address nor using the physical address. Any idea why? -- // Bernardo Innocenti \X/ http://www.codewiz.org/ --------------------------- Use http://oss.sgi.com/ecartis to modify your settings or to unsubscribe. From randy.dunlap@verizon.net Fri May 18 14:53:48 2007 Received: with ECARTIS (v1.0.0; list kdb); Fri, 18 May 2007 14:53:51 -0700 (PDT) Received: from vms046pub.verizon.net (vms046pub.verizon.net [206.46.252.46]) by oss.sgi.com (8.12.10/8.12.10/SuSE Linux 0.7) with ESMTP id l4ILrkfB032291 for ; Fri, 18 May 2007 14:53:47 -0700 Received: from midway.site ([71.245.96.31]) by vms046.mailsrvcs.net (Sun Java System Messaging Server 6.2-6.01 (built Apr 3 2006)) with ESMTPA id <0JI9003U1BHKOXR5@vms046.mailsrvcs.net> for kdb@oss.sgi.com; Fri, 18 May 2007 16:53:44 -0500 (CDT) Date: Fri, 18 May 2007 14:59:32 -0700 From: "Randy.Dunlap" Subject: Re: kdb_cmds: new (returning) user questions In-reply-to: <11527.1179314420@ocs3.ocs.com.au> To: Keith Owens Cc: kdb@oss.sgi.com Message-id: <20070518145932.6d97b159.randy.dunlap@verizon.net> Organization: YPO4 MIME-version: 1.0 X-Mailer: Sylpheed 2.3.1 (GTK+ 2.8.10; x86_64-unknown-linux-gnu) Content-type: text/plain References: <20070515164245.492e14ef.randy.dunlap@verizon.net> <11527.1179314420@ocs3.ocs.com.au> Content-Transfer-Encoding: 8bit X-archive-position: 1212 X-ecartis-version: Ecartis v1.0.0 Sender: kdb-bounce@oss.sgi.com Errors-to: kdb-bounce@oss.sgi.com X-original-sender: randy.dunlap@verizon.net Precedence: bulk X-list: kdb On Wed, 16 May 2007 21:20:20 +1000 Keith Owens wrote: > >4. Is there a way to print (decode) the CPU flags register so that > >I can see which bits (conditions) are set/clear? > > No. Feel free to write one for kdb, but I usually handle this sort of > problem by taking the hex value and feeding it to an external script. > Like this one for decoding the IA64 psr bits. Does that mean that you usually use kdb over a serial line instead of on the target system's keyboard+display? (sounds like that to me, since you feed psr bits to an external script, whereas I typically don't use a serial line for kdb, so having flag-bit-decoding done internally would make some sense) Anyway, I took your ia64 psr bits script and modified it to decode x86/x86-64 EFLAGS bits. The eflags are fed to it on the command line instead of via STDIN, and the output bit values are not shifted right, but that didn't matter to me. E.g.: $ decode-x86flags 10296 246 flags: 0x10296 = PF [4] AF [10] SF [80] IF [200] RF [10000] flags: 0x246 = PF [4] ZF [40] IF [200] It's attached, in case anyone cares for it. Thanks. --- ~Randy -- Binary/unsupported file stripped by Ecartis -- -- Type: application/octet-stream -- File: decode-x86flags --------------------------- Use http://oss.sgi.com/ecartis to modify your settings or to unsubscribe. From kaos@sgi.com Tue May 22 00:59:52 2007 Received: with ECARTIS (v1.0.0; list kdb); Tue, 22 May 2007 01:00:02 -0700 (PDT) Received: from larry.melbourne.sgi.com (larry.melbourne.sgi.com [134.14.52.130]) by oss.sgi.com (8.12.10/8.12.10/SuSE Linux 0.7) with SMTP id l4M7xmWt014214 for ; Tue, 22 May 2007 00:59:50 -0700 Received: from kao2.melbourne.sgi.com (kao2.melbourne.sgi.com [134.14.55.180]) by larry.melbourne.sgi.com (950413.SGI.8.6.12/950213.SGI.AUTOCF) via ESMTP id RAA07918 for ; Tue, 22 May 2007 17:59:47 +1000 Received: by kao2.melbourne.sgi.com (Postfix, from userid 16331) id 98B9D2F40; Tue, 22 May 2007 17:59:47 +1000 (EST) Received: from kao2.melbourne.sgi.com (localhost [127.0.0.1]) by kao2.melbourne.sgi.com (Postfix) with ESMTP id 6257481EC0; Tue, 22 May 2007 17:59:47 +1000 (EST) X-Mailer: exmh version 2.7.2 01/07/2005 with nmh-1.1 From: Keith Owens To: Konstantin Baydarov cc: kdb@oss.sgi.com, Bjorn Helgaas Subject: Re: [PATHC] kdb early fix for i386 kernel In-reply-to: Your message of "Fri, 18 May 2007 18:40:50 +0400." <20070518184050.3bcd6933@windmill.dev.rtsoft.ru> Mime-Version: 1.0 Content-type: text/plain; charset=us-ascii Date: Tue, 22 May 2007 17:59:47 +1000 Message-ID: <10365.1179820787@kao2.melbourne.sgi.com> Content-Transfer-Encoding: 8bit X-archive-position: 1213 X-ecartis-version: Ecartis v1.0.0 Sender: kdb-bounce@oss.sgi.com Errors-to: kdb-bounce@oss.sgi.com X-original-sender: kaos@sgi.com Precedence: bulk X-list: kdb Konstantin Baydarov (on Fri, 18 May 2007 18:40:50 +0400) wrote: > KDB early doesn't work. Can't get kdb console during boot. >Investigations: > KDB tries to stop kernel very early (in star_kernel() function) executing KDB_ENTER(). > To stop kernel kdb have to register trap kdb_call() in IDT before KDB_ENTER() call. > But KDB set gate traps later using initcall. >How Solved: > Patch set KDBENTER_VECTOR trap gate before KDB_ENTER call - in the end of init_IRQ(). > I set KDBENTER_VECTOR trap gate in init_IRQ, not in init_traps(), because in SMP > case init_IRQ() can reset KDBENTER_VECTOR trap gate to default handler. > I set KDB_VECTOR SMP trap gate in smp_intr_init() - also before KDB_ENTER() call. > Another issue: kernel can reset KDB trap gates in setup_IO_APIC_irqs(), > so I've added extra check in setup_IO_APIC_irqs() to prevent KDB trap gates reset. The patch below is a bit simpler and does the same job. KDBENTER_VECTOR gets registered twice on the boot cpu, once very early and again after setup_IO_APIC_irqs() has been run, no need to change setup_IO_APIC_irqs. The patch is included in kdb-v4.4-2.6.22-rc2-i386-2, with a corresponding x86_64-2 update. Unfortunately Linus's 2.6.22-rc1 patch has changed the order of console initialization, serial consoles now get intialized much later. AFAICT this is an unexpected side effect of Bjorn Helgaas's patch to only initialize UARTs once. The effect of the new console initialization order is that when kdb=early is issued, only the tty console has been created. Consoles for serial lines (ttyS0) get created much later, too late for early debugging. This change affects _all_ early kernel debugging, not just kdb. There is no output on the serial console until ACPI is initialized, any kernel errors before that point cannot be diagnosed over a serial line. Not good. diff -u linux/arch/i386/kdb/kdbasupport.c linux/arch/i386/kdb/kdbasupport.c --- linux/arch/i386/kdb/kdbasupport.c +++ linux/arch/i386/kdb/kdbasupport.c @@ -878,6 +878,18 @@ { } +static int __init +kdba_arch_init(void) +{ +#ifdef CONFIG_SMP + set_intr_gate(KDB_VECTOR, kdb_interrupt); +#endif + set_intr_gate(KDBENTER_VECTOR, kdb_call); + return 0; +} + +arch_initcall(kdba_arch_init); + /* * kdba_init * @@ -896,6 +908,7 @@ void __init kdba_init(void) { + kdba_arch_init(); /* Need to register KDBENTER_VECTOR early */ kdb_register("pt_regs", kdba_pt_regs, "address", "Format struct pt_regs", 0); kdb_register("stackdepth", kdba_stackdepth, "[percentage]", "Print processes using >= stack percentage", 0); @@ -1008,18 +1021,6 @@ return(kdba_getarea_size(data, addr, size) || kdba_putarea_size(addr, data, size)); } -static int __init -kdba_arch_init(void) -{ -#ifdef CONFIG_SMP - set_intr_gate(KDB_VECTOR, kdb_interrupt); -#endif - set_intr_gate(KDBENTER_VECTOR, kdb_call); - return 0; -} - -arch_initcall(kdba_arch_init); - #ifdef CONFIG_SMP #include --------------------------- Use http://oss.sgi.com/ecartis to modify your settings or to unsubscribe. From da-x@monatomic.org Thu May 24 03:05:49 2007 Received: with ECARTIS (v1.0.0; list kdb); Thu, 24 May 2007 03:05:56 -0700 (PDT) Received: from noname.neutralserver.com (noname.neutralserver.com [70.84.186.210]) by oss.sgi.com (8.12.10/8.12.10/SuSE Linux 0.7) with ESMTP id l4OA5mWt031045 for ; Thu, 24 May 2007 03:05:49 -0700 Received: from bzq-88-153-198-148.red.bezeqint.net ([88.153.198.148] helo=callisto.gotdns.org) by noname.neutralserver.com with esmtpa (Exim 4.63) (envelope-from ) id 1HrAT0-0006FF-H1; Thu, 24 May 2007 05:22:47 -0500 Date: Thu, 24 May 2007 12:22:21 +0300 From: Dan Aloni To: kdb@oss.sgi.com, Linux Kernel List Subject: [PATCH] kexec/kdump and kdb Message-ID: <20070524092221.GA13510@localdomain> MIME-Version: 1.0 Content-type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.13 (2006-08-11) X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - noname.neutralserver.com X-AntiAbuse: Original Domain - oss.sgi.com X-AntiAbuse: Originator/Caller UID/GID - [0 0] / [47 12] X-AntiAbuse: Sender Address Domain - monatomic.org X-Source: X-Source-Args: X-Source-Dir: Content-Transfer-Encoding: 8bit X-archive-position: 1214 X-ecartis-version: Ecartis v1.0.0 Sender: kdb-bounce@oss.sgi.com Errors-to: kdb-bounce@oss.sgi.com X-original-sender: da-x@monatomic.org Precedence: bulk X-list: kdb Hello, Below is a very preliminary patch that adds kexec/kdump invocation functionality in kdb. It is currently based on 2.6.20.11 and supported only for x86_64. The main use case is for a user who would like to make use of the interactive debugger but wants to conserve the option whether to create a crash dump interactively. It also makes it possible to dump even if the kernel hasn't crashed by manually entering kdb and entering 'kdump' (yes I know sysrq also allows you to trigger a crash dump). There are a few issues with this patch (mainly being incomplete), I'd like to check the public interest with this feature before I develop it further. diff --git a/arch/x86_64/kernel/crash.c b/arch/x86_64/kernel/crash.c index 95a7a2c..b68a0f5 100644 --- a/arch/x86_64/kernel/crash.c +++ b/arch/x86_64/kernel/crash.c @@ -31,6 +31,18 @@ static int crashing_cpu; #ifdef CONFIG_SMP static atomic_t waiting_for_crash_ipi; +static void halt_current_cpu(struct pt_regs *regs) +{ + local_irq_disable(); + + crash_save_cpu(regs, raw_smp_processor_id()); + disable_local_APIC(); + atomic_dec(&waiting_for_crash_ipi); + /* Assume hlt works */ + for(;;) + halt(); +} + static int crash_nmi_callback(struct notifier_block *self, unsigned long val, void *data) { @@ -50,15 +62,8 @@ static int crash_nmi_callback(struct notifier_block *self, */ if (cpu == crashing_cpu) return NOTIFY_STOP; - local_irq_disable(); - - crash_save_cpu(regs, cpu); - disable_local_APIC(); - atomic_dec(&waiting_for_crash_ipi); - /* Assume hlt works */ - for(;;) - halt(); + halt_current_cpu(regs); return 1; } @@ -77,11 +82,26 @@ static struct notifier_block crash_nmi_nb = { .notifier_call = crash_nmi_callback, }; -static void nmi_shootdown_cpus(void) +static void wait_other_cpus(void) { unsigned long msecs; + msecs = 1000; /* Wait at most a second for the other cpus to stop */ + while ((atomic_read(&waiting_for_crash_ipi) > 0) && msecs) { + mdelay(1); + msecs--; + } +} + +static void nmi_shootdown_cpus_init(void) +{ atomic_set(&waiting_for_crash_ipi, num_online_cpus() - 1); +} + +static void nmi_shootdown_cpus(void) +{ + nmi_shootdown_cpus_init(); + if (register_die_notifier(&crash_nmi_nb)) return; /* return what? */ @@ -93,19 +113,23 @@ static void nmi_shootdown_cpus(void) smp_send_nmi_allbutself(); - msecs = 1000; /* Wait at most a second for the other cpus to stop */ - while ((atomic_read(&waiting_for_crash_ipi) > 0) && msecs) { - mdelay(1); - msecs--; - } + wait_other_cpus(); /* Leave the nmi callback set */ + disable_local_APIC(); } + #else + static void nmi_shootdown_cpus(void) { /* There are no cpus to shootdown */ } + +static void nmi_shootdown_cpus_init(void) {}; +static void wait_other_cpus() {} +static void halt_current_cpu(struct pt_regs *regs) {}; + #endif void machine_crash_shutdown(struct pt_regs *regs) @@ -133,3 +157,26 @@ void machine_crash_shutdown(struct pt_regs *regs) crash_save_cpu(regs, smp_processor_id()); } + +void machine_crash_shutdown_begin(void) +{ + local_irq_disable(); + nmi_shootdown_cpus_init(); +} + +void machine_crash_shutdown_end(struct pt_regs *regs) +{ + wait_other_cpus(); + + local_irq_disable(); + if(cpu_has_apic) + disable_local_APIC(); + + disable_IO_APIC(); + crash_save_cpu(regs, smp_processor_id()); +} + +void machine_crash_shutdown_other_cpu(struct pt_regs *regs) +{ + halt_current_cpu(regs); +} diff --git a/include/linux/kdb.h b/include/linux/kdb.h index e4340d3..1cf413e 100644 --- a/include/linux/kdb.h +++ b/include/linux/kdb.h @@ -161,4 +161,11 @@ int kdb_process_cpu(const struct task_struct *p) extern const char kdb_serial_str[]; +#ifdef CONFIG_KEXEC + +void kdb_kexec_prepare(struct pt_regs *regs); +void kexec_from_kdb(struct pt_regs *regs, int kdump); + +#endif + #endif /* !_KDB_H */ diff --git a/include/linux/kdbprivate.h b/include/linux/kdbprivate.h index 50dee9f..ca2c3db 100644 --- a/include/linux/kdbprivate.h +++ b/include/linux/kdbprivate.h @@ -162,6 +162,7 @@ volatile extern int kdb_state[ /*NR_CPUS*/ ]; #define KDB_STATE_IP_ADJUSTED 0x00008000 /* Restart IP has been adjusted */ #define KDB_STATE_GO1 0x00010000 /* go only releases one cpu */ #define KDB_STATE_KEYBOARD 0x00020000 /* kdb entered via keyboard on this cpu */ +#define KDB_STATE_KEXEC 0x00040000 /* kexec issued */ #define KDB_STATE_ARCH 0xff000000 /* Reserved for arch specific use */ #define KDB_STATE_CPU(flag,cpu) (kdb_state[cpu] & KDB_STATE_##flag) diff --git a/include/linux/reboot.h b/include/linux/reboot.h index 1dd1c70..f4d682c 100644 --- a/include/linux/reboot.h +++ b/include/linux/reboot.h @@ -53,7 +53,10 @@ extern void machine_power_off(void); extern void machine_shutdown(void); struct pt_regs; -extern void machine_crash_shutdown(struct pt_regs *); +extern void machine_crash_shutdown(struct pt_regs *regs); +extern void machine_crash_shutdown_begin(void); +extern void machine_crash_shutdown_other_cpu(struct pt_regs *regs); +extern void machine_crash_shutdown_end(struct pt_regs *regs); /* * Architecture independent implemenations of sys_reboot commands. diff --git a/kdb/kdbmain.c b/kdb/kdbmain.c index 9dfa3b3..2ecacfc 100644 --- a/kdb/kdbmain.c +++ b/kdb/kdbmain.c @@ -1124,6 +1124,116 @@ kdb_reboot(int argc, const char **argv) return 0; } +#ifdef CONFIG_KEXEC + +int kdb_kexec_state = -1; + +static int kdb_cpu(int argc, const char **argv); + +void kdb_kexec_prepare(struct pt_regs *regs) +{ + int i; + struct pt_regs r; + if (regs == NULL) + regs = &r; + + machine_crash_shutdown_begin(); + + for (i = 1; i < NR_CPUS; ++i) { + if (!cpu_online(i)) + continue; + + KDB_STATE_SET_CPU(KEXEC, i); + } + + machine_crash_shutdown_end(regs); +} + +void kdb_kexec_check(struct pt_regs *regs) +{ + if (kdb_kexec_state != -1) { + kexec_from_kdb(regs, kdb_kexec_state); + + /* If the call above returned then something + didn't work */ + kdb_kexec_state = -1; + } +} + +static int +kdb_switch_cpu_for_kexec(int new_state) +{ + const char *cpu_argv[] = {NULL, "0", NULL}; + int ret; + + kdb_kexec_state = new_state; + ret = kdb_cpu(1, cpu_argv); + if (ret != KDB_CMD_CPU) { + kdb_kexec_state = -1; + } + + return ret; +} + + +/* + * kdb_kexec + * + * This function implements the 'kexec' command. + * + * Inputs: + * argc argument count + * argv argument vector + * envp environment vector + * regs registers at time kdb was entered. + * Outputs: + * None. + * Returns: + * zero for success, a kdb diagnostic if error + * Locking: + * none. + * Remarks: + * Shouldn't return from this function. + */ + +static int +kdb_kexec(int argc, const char **argv) +{ + return kdb_switch_cpu_for_kexec(0); +} + +/* + * kdb_kdump + * + * This function implements the 'kdump' command. + * + * Inputs: + * argc argument count + * argv argument vector + * envp environment vector + * regs registers at time kdb was entered. + * Outputs: + * None. + * Returns: + * zero for success, a kdb diagnostic if error + * Locking: + * none. + * Remarks: + * Shouldn't return from this function. + */ + +static int +kdb_kdump(int argc, const char **argv) +{ + return kdb_switch_cpu_for_kexec(1); +} + +#else + +static inline void kdb_kexec_check(struct pt_regs *regs) {}; + +#endif + static int kdb_quiet(int reason) { @@ -1166,6 +1276,8 @@ kdb_local(kdb_reason_t reason, int error, struct pt_regs *regs, kdb_dbtrap_t db_ int diag; struct task_struct *kdb_current = kdb_curr_task(smp_processor_id()); + kdb_kexec_check(regs); + /* If kdb has been entered for an event which has been/will be * recovered then silently return. We have to get this far into kdb in * order to synchronize all the cpus, typically only one cpu (monarch) @@ -1553,7 +1665,18 @@ kdb_main_loop(kdb_reason_t reason, kdb_reason_t reason2, int error, if (!KDB_STATE(KDB)) { KDB_STATE_SET(KDB); } + +#ifdef CONFIG_KEXEC + if (KDB_STATE(KEXEC)) { + struct pt_regs r; + if (regs == NULL) + regs = &r; + machine_crash_shutdown_other_cpu(regs); + return 0; + } +#endif } + KDB_STATE_CLEAR(SUPPRESS); KDB_DEBUG_STATE("kdb_main_loop 2", reason); if (KDB_STATE(LEAVING)) @@ -3821,6 +3944,10 @@ kdb_inittab(void) kdb_register_repeat("ps", kdb_ps, "", "Display active task list", 0, KDB_REPEAT_NONE); kdb_register_repeat("pid", kdb_pid, "", "Switch to another task", 0, KDB_REPEAT_NONE); kdb_register_repeat("reboot", kdb_reboot, "", "Reboot the machine immediately", 0, KDB_REPEAT_NONE); +#if defined(CONFIG_KEXEC) + kdb_register_repeat("kexec", kdb_kexec, "", "Calls kexec in crash mode", 0, KDB_REPEAT_NONE); + kdb_register_repeat("kdump", kdb_kdump, "", "Calls kdump mode", 0, KDB_REPEAT_NONE); +#endif #if defined(CONFIG_MODULES) kdb_register_repeat("lsmod", kdb_lsmod, "", "List loaded kernel modules", 0, KDB_REPEAT_NONE); #endif diff --git a/kernel/kexec.c b/kernel/kexec.c index 2a59c8a..5858db1 100644 --- a/kernel/kexec.c +++ b/kernel/kexec.c @@ -22,6 +22,8 @@ #include #include #include +#include +#include #include #include @@ -29,6 +31,10 @@ #include #include +#ifdef CONFIG_KDB +#include +#endif + /* Per cpu memory for storing cpu states in case of system crash. */ note_buf_t* crash_notes; @@ -1045,6 +1051,12 @@ asmlinkage long compat_sys_kexec_load(unsigned long entry, void crash_kexec(struct pt_regs *regs) { +#if !CONFIG_KDB + /* + * If we enabled KDB, we don't want to automatically + * perform a kdump since KDB will be responsible for + * executing kdb through a special 'kdump' command. + */ int locked; @@ -1067,8 +1079,38 @@ void crash_kexec(struct pt_regs *regs) locked = xchg(&kexec_lock, 0); BUG_ON(!locked); } +#endif } +#ifdef CONFIG_KDB + +void kexec_from_kdb(struct pt_regs *regs, int kdump) +{ + struct kimage *image; + int locked; + + locked = xchg(&kexec_lock, 1); + if (!locked) { + if (kdump) + image = kexec_crash_image; + else + image = kexec_image; + + if (image) { + struct pt_regs fixed_regs; + + crash_setup_regs(&fixed_regs, regs); + kdb_kexec_prepare(&fixed_regs); + machine_kexec(image); + } + + locked = xchg(&kexec_lock, 0); + BUG_ON(!locked); + } +} + +#endif + static u32 *append_elf_note(u32 *buf, char *name, unsigned type, void *data, size_t data_len) { -- Dan Aloni XIV LTD, http://www.xivstorage.com da-x (at) monatomic.org, dan (at) xiv.co.il --------------------------- Use http://oss.sgi.com/ecartis to modify your settings or to unsubscribe. From t-nagano@ah.jp.nec.com Thu May 31 01:49:17 2007 Received: with ECARTIS (v1.0.0; list kdb); Thu, 31 May 2007 01:49:26 -0700 (PDT) Received: from tyo200.gate.nec.co.jp (TYO200.gate.nec.co.jp [210.143.35.50]) by oss.sgi.com (8.12.10/8.12.10/SuSE Linux 0.7) with ESMTP id l4V8nGWt011299 for ; Thu, 31 May 2007 01:49:17 -0700 Received: from tyo201.gate.nec.co.jp ([10.7.69.201]) by tyo200.gate.nec.co.jp (8.13.8/8.13.4) with ESMTP id l4V7h1qE019859 for ; Thu, 31 May 2007 16:43:07 +0900 (JST) Received: from mailgate4.nec.co.jp (mailgate53.nec.co.jp [10.7.69.184]) by tyo201.gate.nec.co.jp (8.13.8/8.13.4) with ESMTP id l4V7bxQW008727 for ; Thu, 31 May 2007 16:37:59 +0900 (JST) Received: (from root@localhost) by mailgate4.nec.co.jp (8.11.7/3.7W-MAILGATE-NEC) id l4V7bxi14832 for kdb@oss.sgi.com; Thu, 31 May 2007 16:37:59 +0900 (JST) Received: from mailsv.linux.bs1.fc.nec.co.jp (mailsv.linux.bs1.fc.nec.co.jp [10.34.125.2]) by mailsv.nec.co.jp (8.11.7/3.7W-MAILSV-NEC) with ESMTP id l4V7bxO12428 for ; Thu, 31 May 2007 16:37:59 +0900 (JST) Received: from [10.34.125.197] (johnny.linux.bs1.fc.nec.co.jp [10.34.125.197]) by mailsv.linux.bs1.fc.nec.co.jp (Postfix) with ESMTP id 1901AE4828B for ; Thu, 31 May 2007 16:37:59 +0900 (JST) Message-ID: <465E7B57.9070705@ah.jp.nec.com> Date: Thu, 31 May 2007 16:37:59 +0900 From: Takenori Nagano User-Agent: Thunderbird 2.0.0.0 (Windows/20070326) MIME-Version: 1.0 To: kdb@oss.sgi.com Subject: [patch] Fix some problem between kdb and kdump Content-type: text/plain; charset=ISO-2022-JP Content-Transfer-Encoding: 8bit X-archive-position: 1215 X-ecartis-version: Ecartis v1.0.0 Sender: kdb-bounce@oss.sgi.com Errors-to: kdb-bounce@oss.sgi.com X-original-sender: t-nagano@ah.jp.nec.com Precedence: bulk X-list: kdb Hi, kdb has some problem to use with kdump. This patch fixes some of them. 1) We can't use kdb when machine panicked. crash_kexec() is called before notifier_call_chain(&panic_notifier_chain). This patch makes KDB_ENTER() is called before crash_kexec(). 2) We can't take a kdump when KDB_FLAG is set CATASTROPHIC. kdb_do_dump() does not support kdump. This patch makes machine_kexec() is called from kdb_do_dump(). diff -uprN linux-2.6.22-rc3.orig/kdb/kdbmain.c linux-2.6.22-rc3/kdb/kdbmain.c --- linux-2.6.22-rc3.orig/kdb/kdbmain.c 2007-05-31 15:08:40.296000000 +0900 +++ linux-2.6.22-rc3/kdb/kdbmain.c 2007-05-31 15:18:52.172000000 +0900 @@ -36,6 +36,9 @@ #include #include #include +#ifdef CONFIG_KEXEC +#include +#endif #if defined(CONFIG_LKCD_DUMP) || defined(CONFIG_LKCD_DUMP_MODULE) #include #endif @@ -1089,6 +1092,21 @@ handle_ctrl_cmd(char *cmd) static void kdb_do_dump(void) { +#ifdef CONFIG_KEXEC +#ifdef CONFIG_IA64 + if (ia64_kimage) { + kexec_disable_iosapic(); + machine_kexec(ia64_kimage); + } +#else + if (kexec_crash_image) { +#ifdef CONFIG_X86_IO_APIC + disable_IO_APIC(); +#endif /* CONFIG_X86_IO_APIC */ + machine_kexec(kexec_crash_image); + } +#endif /* CONFIG_IA64 */ +#endif /* CONFIG_KEXEC */ #if defined(CONFIG_LKCD_DUMP) || defined(CONFIG_LKCD_DUMP_MODULE) kdb_printf("Forcing dump (if configured)\n"); console_loglevel = 8; /* to see the dump messages */ @@ -3868,35 +3886,6 @@ kdb_cmd_init(void) } } -/* - * kdb_panic - * - * Invoked via the panic_notifier_list. - * - * Inputs: - * None. - * Outputs: - * None. - * Returns: - * Zero. - * Locking: - * None. - * Remarks: - * When this function is called from panic(), the other cpus have already - * been stopped. - * - */ - -static int -kdb_panic(struct notifier_block *self, unsigned long command, void *ptr) -{ - KDB_FLAG_SET(CATASTROPHIC); /* kernel state is dubious now */ - KDB_ENTER(); - return 0; -} - -static struct notifier_block kdb_block = { kdb_panic, NULL, 0 }; - #ifdef CONFIG_SYSCTL static int proc_do_kdb(ctl_table *table, int write, struct file *filp, void __user *buffer, size_t *lenp, loff_t *ppos) @@ -3989,7 +3978,6 @@ kdb_init(void) kdb_initial_cpu = -1; /* Avoid recursion problems */ kdb(KDB_REASON_CPU_UP, 0, NULL); /* do kdb setup on boot cpu */ kdb_initial_cpu = smp_processor_id(); - atomic_notifier_chain_register(&panic_notifier_list, &kdb_block); register_cpu_notifier(&kdb_cpu_nfb); #ifdef kdba_setjmp diff -uprN linux-2.6.22-rc3.orig/kernel/panic.c linux-2.6.22-rc3/kernel/panic.c --- linux-2.6.22-rc3.orig/kernel/panic.c 2007-05-26 11:55:14.000000000 +0900 +++ linux-2.6.22-rc3/kernel/panic.c 2007-05-31 15:20:41.712000000 +0900 @@ -19,6 +19,10 @@ #include #include #include +#ifdef CONFIG_KDB +#include +#include +#endif int panic_on_oops; int tainted; @@ -80,6 +84,11 @@ NORET_TYPE void panic(const char * fmt, printk(KERN_EMERG "Kernel panic - not syncing: %s\n",buf); bust_spinlocks(0); +#ifdef CONFIG_KDB + KDB_FLAG_SET(CATASTROPHIC); + KDB_ENTER() +#endif + /* * If we have crashed and we have a crash kernel loaded let it handle * everything else. --------------------------- Use http://oss.sgi.com/ecartis to modify your settings or to unsubscribe. From kaos@sgi.com Thu May 31 17:37:23 2007 Received: with ECARTIS (v1.0.0; list kdb); Thu, 31 May 2007 17:37:27 -0700 (PDT) Received: from larry.melbourne.sgi.com (larry.melbourne.sgi.com [134.14.52.130]) by oss.sgi.com (8.12.10/8.12.10/SuSE Linux 0.7) with SMTP id l510bKWt012057 for ; Thu, 31 May 2007 17:37:21 -0700 Received: from kao2.melbourne.sgi.com (kao2.melbourne.sgi.com [134.14.55.180]) by larry.melbourne.sgi.com (950413.SGI.8.6.12/950213.SGI.AUTOCF) via ESMTP id KAA11461 for ; Fri, 1 Jun 2007 10:37:20 +1000 Received: by kao2.melbourne.sgi.com (Postfix, from userid 16331) id C77332F40; Fri, 1 Jun 2007 10:37:19 +1000 (EST) Received: from kao2.melbourne.sgi.com (localhost [127.0.0.1]) by kao2.melbourne.sgi.com (Postfix) with ESMTP id AF9F181EC0; Fri, 1 Jun 2007 10:37:19 +1000 (EST) X-Mailer: exmh version 2.7.2 01/07/2005 with nmh-1.1 From: Keith Owens To: Takenori Nagano cc: kdb@oss.sgi.com Subject: Re: [patch] Fix some problem between kdb and kdump In-reply-to: Your message of "Thu, 31 May 2007 16:37:59 +0900." <465E7B57.9070705@ah.jp.nec.com> Mime-Version: 1.0 Content-type: text/plain; charset=us-ascii Date: Fri, 01 Jun 2007 10:37:19 +1000 Message-ID: <5940.1180658239@kao2.melbourne.sgi.com> Content-Transfer-Encoding: 8bit X-archive-position: 1216 X-ecartis-version: Ecartis v1.0.0 Sender: kdb-bounce@oss.sgi.com Errors-to: kdb-bounce@oss.sgi.com X-original-sender: kaos@sgi.com Precedence: bulk X-list: kdb Takenori Nagano (on Thu, 31 May 2007 16:37:59 +0900) wrote: >Hi, > >kdb has some problem to use with kdump. >This patch fixes some of them. > >1) We can't use kdb when machine panicked. > >crash_kexec() is called before notifier_call_chain(&panic_notifier_chain)= >. >This patch makes KDB_ENTER() is called before crash_kexec(). Both KDB and crash_kexec should be using the panic_notifier_chain, with KDB having a higher priority than crash_exec. The whole point of notifier chains is to handle cases like this, so we should not be adding more code to the panic routine. The real problem here is the way that the crash_exec code is hard coded into various places instead of using notifier chains. The same issue exists in arch/ia64/kernel/mca.c because of bad coding practices from kexec. >2) We can't take a kdump when KDB_FLAG is set CATASTROPHIC. > >kdb_do_dump() does not support kdump. >This patch makes machine_kexec() is called from kdb_do_dump(). Ugly. All the code for selecting which dump to take (lkcd, kexec, anything else) should be in a common kernel routine that anybody can call. It should not be just in KDB. --------------------------- Use http://oss.sgi.com/ecartis to modify your settings or to unsubscribe. From t-nagano@ah.jp.nec.com Thu May 31 18:53:08 2007 Received: with ECARTIS (v1.0.0; list kdb); Thu, 31 May 2007 18:53:13 -0700 (PDT) Received: from tyo200.gate.nec.co.jp (TYO200.gate.nec.co.jp [210.143.35.50]) by oss.sgi.com (8.12.10/8.12.10/SuSE Linux 0.7) with ESMTP id l511r6Wt006722 for ; Thu, 31 May 2007 18:53:08 -0700 Received: from tyo201.gate.nec.co.jp ([10.7.69.201]) by tyo200.gate.nec.co.jp (8.13.8/8.13.4) with ESMTP id l511r09w023109 for ; Fri, 1 Jun 2007 10:53:00 +0900 (JST) Received: from mailgate3.nec.co.jp (mailgate53.nec.co.jp [10.7.69.192]) by tyo201.gate.nec.co.jp (8.13.8/8.13.4) with ESMTP id l511nNqx020210 for ; Fri, 1 Jun 2007 10:49:23 +0900 (JST) Received: (from root@localhost) by mailgate3.nec.co.jp (8.11.7/3.7W-MAILGATE-NEC) id l511nMv03859 for kdb@oss.sgi.com; Fri, 1 Jun 2007 10:49:22 +0900 (JST) Received: from mailsv.linux.bs1.fc.nec.co.jp (mailsv.linux.bs1.fc.nec.co.jp [10.34.125.2]) by mailsv.nec.co.jp (8.11.7/3.7W-MAILSV-NEC) with ESMTP id l511nMO27820 for ; Fri, 1 Jun 2007 10:49:22 +0900 (JST) Received: from [10.34.125.197] (johnny.linux.bs1.fc.nec.co.jp [10.34.125.197]) by mailsv.linux.bs1.fc.nec.co.jp (Postfix) with ESMTP id 7422EE480DD for ; Fri, 1 Jun 2007 10:49:22 +0900 (JST) Message-ID: <465F7B21.9090708@ah.jp.nec.com> Date: Fri, 01 Jun 2007 10:49:21 +0900 From: Takenori Nagano User-Agent: Thunderbird 2.0.0.0 (Windows/20070326) MIME-Version: 1.0 To: kdb@oss.sgi.com Subject: Re: [patch] Fix some problem between kdb and kdump References: <5940.1180658239@kao2.melbourne.sgi.com> In-Reply-To: <5940.1180658239@kao2.melbourne.sgi.com> Content-type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-archive-position: 1217 X-ecartis-version: Ecartis v1.0.0 Sender: kdb-bounce@oss.sgi.com Errors-to: kdb-bounce@oss.sgi.com X-original-sender: t-nagano@ah.jp.nec.com Precedence: bulk X-list: kdb Hi Keith, I agree with your opinion. But we can't choose LKCD after 2.6.18. LKCD maintainer Troy said > On 04/25/07 19:23, Sébastien CRAMATTE wrote: >> > how can I use lkcd with kernel >= 2.6.18 > > The general suggestion is to use KDUMP which is already included in > stock kernel >= 2.6.18. See Documentation/kdump/kdump.txt in your > kernel source tree for more information about kdump. > > Troy Kdump has many problems, but we can't choose other choices after 2.6.18. IMHO, we have to modify kdb that we can use both kdb and kdump after 2.6.18. Keith, do you have any idea to resolve this? Keith Owens wrote: > Takenori Nagano (on Thu, 31 May 2007 16:37:59 +0900) wrote: >> Hi, >> >> kdb has some problem to use with kdump. >> This patch fixes some of them. >> >> 1) We can't use kdb when machine panicked. >> >> crash_kexec() is called before notifier_call_chain(&panic_notifier_chain)= >> . >> This patch makes KDB_ENTER() is called before crash_kexec(). > > Both KDB and crash_kexec should be using the panic_notifier_chain, with > KDB having a higher priority than crash_exec. The whole point of > notifier chains is to handle cases like this, so we should not be > adding more code to the panic routine. > > The real problem here is the way that the crash_exec code is hard coded > into various places instead of using notifier chains. The same issue > exists in arch/ia64/kernel/mca.c because of bad coding practices from > kexec. > >> 2) We can't take a kdump when KDB_FLAG is set CATASTROPHIC. >> >> kdb_do_dump() does not support kdump. >> This patch makes machine_kexec() is called from kdb_do_dump(). > > Ugly. All the code for selecting which dump to take (lkcd, kexec, > anything else) should be in a common kernel routine that anybody can > call. It should not be just in KDB. --------------------------- Use http://oss.sgi.com/ecartis to modify your settings or to unsubscribe. From kaos@sgi.com Thu May 31 20:24:20 2007 Received: with ECARTIS (v1.0.0; list kdb); Thu, 31 May 2007 20:24:24 -0700 (PDT) Received: from larry.melbourne.sgi.com (larry.melbourne.sgi.com [134.14.52.130]) by oss.sgi.com (8.12.10/8.12.10/SuSE Linux 0.7) with SMTP id l513OEWt011938 for ; Thu, 31 May 2007 20:24:17 -0700 Received: from kao2.melbourne.sgi.com (kao2.melbourne.sgi.com [134.14.55.180]) by larry.melbourne.sgi.com (950413.SGI.8.6.12/950213.SGI.AUTOCF) via ESMTP id NAA15157 for ; Fri, 1 Jun 2007 13:24:14 +1000 Received: by kao2.melbourne.sgi.com (Postfix, from userid 16331) id E43322F40; Fri, 1 Jun 2007 13:24:13 +1000 (EST) Received: from kao2.melbourne.sgi.com (localhost [127.0.0.1]) by kao2.melbourne.sgi.com (Postfix) with ESMTP id D9EFD81EC1; Fri, 1 Jun 2007 13:24:13 +1000 (EST) X-Mailer: exmh version 2.7.2 01/07/2005 with nmh-1.1 From: Keith Owens To: Takenori Nagano cc: kdb@oss.sgi.com Subject: Re: [patch] Fix some problem between kdb and kdump In-reply-to: Your message of "Fri, 01 Jun 2007 10:49:21 +0900." <465F7B21.9090708@ah.jp.nec.com> Mime-Version: 1.0 Content-type: text/plain; charset=us-ascii Date: Fri, 01 Jun 2007 13:24:13 +1000 Message-ID: <20022.1180668253@kao2.melbourne.sgi.com> Content-Transfer-Encoding: 8bit X-archive-position: 1218 X-ecartis-version: Ecartis v1.0.0 Sender: kdb-bounce@oss.sgi.com Errors-to: kdb-bounce@oss.sgi.com X-original-sender: kaos@sgi.com Precedence: bulk X-list: kdb Takenori Nagano (on Fri, 01 Jun 2007 10:49:21 +0900) wrote: >Hi Keith, > >I agree with your opinion. >But we can't choose LKCD after 2.6.18. > >LKCD maintainer Troy said >> On 04/25/07 19:23, S=C3=A9bastien CRAMATTE wrote: >>> > how can I use lkcd with kernel >=3D 2.6.18 >>=20 >> The general suggestion is to use KDUMP which is already included in >> stock kernel >=3D 2.6.18. See Documentation/kdump/kdump.txt in your >> kernel source tree for more information about kdump. >>=20 >> Troy > >Kdump has many problems, but we can't choose other choices after 2.6.18. >IMHO, we have to modify kdb that we can use both kdb and kdump after 2.6.= >18. > >Keith, do you have any idea to resolve this? kexec developers should provide a simple kexec_dump() routine that anybody can call. All the complexity that is in your patch to KDB has to be replicated and maintained for every debugger that wants to cause a dump. This is wrong, the code should be in one place and maintained by the kexec people. --------------------------- Use http://oss.sgi.com/ecartis to modify your settings or to unsubscribe.