From: Horms Subject: [PATCH] console: allow a panic to be triggered from the xen console Date: Fri, 7 Jul 2006 10:09:50 +0900 Message-ID: <20060707010949.GA10332@verge.net.au> References: <20060515074734.GA15410@verge.net.au> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Content-Disposition: inline In-Reply-To: <20060515074734.GA15410@verge.net.au> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-devel Cc: Magnus Damm List-Id: xen-devel@lists.xenproject.org Hi, this is a resend of this patch, which I believe is a simple but useful feature. I have used it extensively to test the kdump patches which I have been developing with my colleague Magnus Damm. It is probably useful for other purposes too, and is analogous to the trigger crashdump feature of Linux's sysrq. -- Horms console: allow a panic to be triggered from the xen console I'm not sure how useful this is generally, but its proving quite useful for me while working on kdump/kexec. Signed-Off-By: Horms diff -r 91c77df11b43 xen/drivers/char/console.c --- a/xen/drivers/char/console.c Wed May 10 17:30:42 2006 +0100 +++ b/xen/drivers/char/console.c Mon May 15 15:19:16 2006 +0900 @@ -701,6 +701,19 @@ void panic(const char *fmt, ...) machine_restart(0); } +static void do_panic_trigger(unsigned char key) +{ + printk("triggering panic\n"); + panic("CPU%d triggered panic\n", smp_processor_id()); +} + +static __init int register_panic_trigger(void) +{ + register_keyhandler('p', do_panic_trigger, "trigger a panic"); + return 0; +} +__initcall(register_panic_trigger); + /* * Local variables: * mode: C