Skip to contentSkip to conversation

console: allow a panic to be triggered from the xen console

PATCH New Horms 3 participants 7 messages May 15, 2006 – Jul 11, 2006

lore
Share & tools
lore

Horms

author
#0 lore raw

PATCH 1/1 console: allow a panic to be triggered from the xen console

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.

xen/drivers/char/console.c +13 -0
diff -r 91c77df11b43 xen/drivers/char/console.c
@@ -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
author
#1 lore raw

PATCH 1/1 console: allow a panic to be triggered from the xen console

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.

Signature · 32 lines
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 <[email protected]>

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
#2 lore raw
Quoted 5 lines · Horms

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.

On Linux the sysrq only does anything if kexec is in use and a crash image has been provided (crash_kexec). Perhaps you should do the same and make this part of the Xen portion of your kexec patches?

-- Keir

#3 lore raw
Quoted 9 lines · Keir Fraser
Quoted 5 lines · Horms

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.

Quoted 3 lines

On Linux the sysrq only does anything if kexec is in use and a crash image has been provided (crash_kexec). Perhaps you should do the same and make this part of the Xen portion of your kexec patches?

Also please use D (dump?) instead of p. p is already used by the performance counters.

I'm a bit concerned that we might eventually run out of keys... Is this really useful?

christian

author
#4 lore raw
Quoted 14 lines · Christian Limpach
Quoted 9 lines · Keir Fraser
Quoted 5 lines · Horms

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.

Quoted 3 lines

On Linux the sysrq only does anything if kexec is in use and a crash image has been provided (crash_kexec). Perhaps you should do the same and make this part of the Xen portion of your kexec patches?

Quoted 5 lines

Also please use D (dump?) instead of p. p is already used by the performance counters.

I'm a bit concerned that we might eventually run out of keys... Is this really useful?

Its definately useful for testing, definately during development, perhaps for production systems. I'll change it over to use D, incoporate Keir's suggestion, and include it in the next kexec patches. It can always be axed if it prooves troublesome.

Signature · 3 lines
Horms                                           
  H: http://www.vergenet.net/~horms/
  W: http://www.valinux.co.jp/en/
author
#5 lore raw
In reply to Keir Fraser
Quoted 9 lines · Keir Fraser
Quoted 5 lines · Horms

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.

Quoted 3 lines

On Linux the sysrq only does anything if kexec is in use and a crash image has been provided (crash_kexec). Perhaps you should do the same and make this part of the Xen portion of your kexec patches?

Sure, I can do that. Though a general panic button seemed more useful to me at the time.

Signature · 3 lines
Horms                                           
  H: http://www.vergenet.net/~horms/
  W: http://www.valinux.co.jp/en/
#6 lore raw
Quoted 6 lines · Horms
Quoted 3 lines

On Linux the sysrq only does anything if kexec is in use and a crash image has been provided (crash_kexec). Perhaps you should do the same and make this part of the Xen portion of your kexec patches?

Sure, I can do that. Though a general panic button seemed more useful to me at the time.

We already have 'd' key for obtaining a backtrace and register dump on every CPU in the system. I don't think a panic would be any more useful than that.

-- Keir