hang on panic, can not return to OBP
Hello,
I started to debug my latest problem with Quad HME. First there is a OF mapping problem, then on quad also a IRQ problem, these I did not touch. Then came prontk recursion problem that caused panic, this I did not touch yet. The panic told I cpuld return to PROM with Stop-A but I couldn't, and this was the problem I tried to solve.
First, why tell the user to press Stop-A or break at all? Is it because we can extract information from Break-T, Break-P etc? Otherwise the panic code could drop to prom itself?
I tried the following patch and that did not work - probably because of the same reason that Break did not work (interrupts off?). Seems the local_irq_enable() is not enough - but what could help here? Is prom_halt() the right thing? ... Kad a look of waht Stop-A does, tried also the second patch... but if it would have worked, Stop-A wouldb prpbaly also have.
This patch is of course not even close to merging, it's just a hack to try it out.
kernel/panic.c +7 -1
@@ -22,6 +22,9 @@#include <linux/random.h> #include <linux/kallsyms.h> #include <linux/dmi.h> +#ifdef __sparc__ +#include <asm/oplib.h> +#endif int panic_on_oops;static unsigned long tainted_mask;
@@ -120,13 +123,16 @@ NORET_TYPE void panic(const char * fmt, ...)extern int stop_a_enabled;/* Make sure the user can actually press Stop-A (L1-A) */ stop_a_enabled =1 ; - printk(KERN_EMERG "Press Stop-A (L1-A) to return to the boot prom\n"); + printk(KERN_EMERG "Returning to the boot prom\n"); }#endif #if defined(CONFIG_S390 )disabled_wait (caller);#endif local_irq_enable (); +#ifdef __sparc__ +prom_halt (); +#endif for (i =0 ;;) {touch_softlockup_watchdog (); i +=panic_blink (i);
And the other one:
kernel/panic.c +10 -1
@@ -22,6 +22,9 @@#include <linux/random.h> #include <linux/kallsyms.h> #include <linux/dmi.h> +#ifdef __sparc__ +#include <asm/oplib.h> +#endif int panic_on_oops;static unsigned long tainted_mask;
@@ -120,13 +123,19 @@ NORET_TYPE void panic(const char * fmt, ...)extern int stop_a_enabled;/* Make sure the user can actually press Stop-A (L1-A) */ stop_a_enabled =1 ; - printk(KERN_EMERG "Press Stop-A (L1-A) to return to the boot prom\n"); + printk(KERN_EMERG "Returning to the boot prom\n"); }#endif #if defined(CONFIG_S390 )disabled_wait (caller);#endif local_irq_enable (); +#ifdef __sparc__ +prom_printf ("\n" ); +flush_user_windows (); + +prom_cmdline (); +#endif for (i =0 ;;) {touch_softlockup_watchdog (); i +=panic_blink (i);
Signature · 1 line
Meelis Roos ([email protected])
Hi Meelis,
On sun4c, the only solution I ever managed to get close to working was a prom-based polling loop of the keyboard at the end of panic(). This only works when the processor is still running.
'soft lockups' (normally caused by recursion issues when I have encountered them) always ended in power-up reset because they stopped the processor. I ended up changing the soft lockup code to do a panic before things got too out of hand (ie always panic). This reduced the number of times I had to power cycle my aging hardware.
It was still an issue for me last time I did any kernel testing (2.6.23 over a year ago) and if you are having the same issues I had (sparc processor hardware lockup) a power up reset each time, untill you can find and prevent the recursion issue, is the only option.
Please find attached my sun4c Panic handling patch. A bit old but may still be usefull (Not in text as my email client makes a mess of in text patches).
Regards
Mark
Quoted 101 lines · Meelis Roos
Hello,
I started to debug my latest problem with Quad HME. First there is a OF mapping problem, then on quad also a IRQ problem, these I did not touch. Then came prontk recursion problem that caused panic, this I did not touch yet. The panic told I cpuld return to PROM with Stop-A but I couldn't, and this was the problem I tried to solve.
First, why tell the user to press Stop-A or break at all? Is it because we can extract information from Break-T, Break-P etc? Otherwise the panic code could drop to prom itself?
I tried the following patch and that did not work - probably because of the same reason that Break did not work (interrupts off?). Seems the
local_irq_enable()is not enough - but what could help here? Isprom_halt()the right thing? ... Kad a look of waht Stop-A does, tried also the second patch... but if it would have worked, Stop-A wouldb prpbaly also have.This patch is of course not even close to merging, it's just a hack to try it out.
kernel/panic.c +7
-1@@ -22,6 +22,9 @@#include <linux/random.h> #include <linux/kallsyms.h> #include <linux/dmi.h> +#ifdef __sparc__ +#include <asm/oplib.h> +#endif int panic_on_oops;static unsigned long tainted_mask;@@ -120,13 +123,16 @@ NORET_TYPE void panic(const char * fmt, ...)extern int stop_a_enabled;/* Make sure the user can actually press Stop-A (L1-A) */ stop_a_enabled =1 ; - printk(KERN_EMERG "Press Stop-A (L1-A) to return to the boot prom\n"); + printk(KERN_EMERG "Returning to the boot prom\n"); }#endif #if defined(CONFIG_S390 )disabled_wait (caller);#endif local_irq_enable (); +#ifdef __sparc__ +prom_halt (); +#endif for (i =0 ;;) {touch_softlockup_watchdog (); i +=panic_blink (i);And the other one:
kernel/panic.c +10
-1@@ -22,6 +22,9 @@#include <linux/random.h> #include <linux/kallsyms.h> #include <linux/dmi.h> +#ifdef __sparc__ +#include <asm/oplib.h> +#endif int panic_on_oops;static unsigned long tainted_mask;@@ -120,13 +123,19 @@ NORET_TYPE void panic(const char * fmt, ...)extern int stop_a_enabled;/* Make sure the user can actually press Stop-A (L1-A) */ stop_a_enabled =1 ; - printk(KERN_EMERG "Press Stop-A (L1-A) to return to the boot prom\n"); + printk(KERN_EMERG "Returning to the boot prom\n"); }#endif #if defined(CONFIG_S390 )disabled_wait (caller);#endif local_irq_enable (); +#ifdef __sparc__ +prom_printf ("\n" ); +flush_user_windows (); + +prom_cmdline (); +#endif for (i =0 ;;) {touch_softlockup_watchdog (); i +=panic_blink (i);Signature · 6 lines
-- Meelis Roos ([email protected]) -- To unsubscribe from this list: send the line "unsubscribe sparclinux" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
kernel/panic.c +29 -0
@@ -106,6 +106,7 @@ NORET_TYPE void panic(const char * fmt,* Delay timeout seconds before rebooting the machine. * We can't use the "normal" timers since we just panicked.. */ +printk ("\n" );printk (KERN_EMERG "Rebooting in %d seconds.." ,panic_timeout);for (i =0 ; i < panic_timeout*1000 ; ) {touch_nmi_watchdog ();
@@ -124,6 +125,7 @@ NORET_TYPE void panic(const char * fmt,extern int stop_a_enabled;/* Make sure the user can actually press Stop-A (L1-A) */ stop_a_enabled =1 ; +printk ("\n" ); printk(KERN_EMERG "Press Stop-A (L1-A) to return to the boot prom\n"); }#endif
@@ -136,6 +138,33 @@ NORET_TYPE void panic(const char * fmt, i +=panic_blink (i);mdelay (1 ); i++; +#ifdef __sparc__ + { +/* +* L1-A processing only works if KBD stuff OK. +* So to debug before KBD up you require this. +* Maybe make this part of the early console stuf. +*/ +static int stop_l1; +int ch; +extern int prom_nbgetchar (void ); + +if ((ch =prom_nbgetchar ()) !=-1 ) + { +if ((ch ==0x7F ) || + (ch ==0xFE ) || (ch ==0xFF )) + stop_l1 =0 ; +if ((ch &0x7F ) ==0x01 ) + stop_l1 =1 ; +if (stop_l1 && ((ch &0x7F ) ==77 )) + { +extern void sun_do_break (void ); + +sun_do_break (); + } + } + } +#endif /* __sparc__ */ } }
drivers/serial/sunzilog.c +1 -0
@@ -429,6 +429,7 @@/* Wait for BREAK to deassert to avoid potentially * confusing the PROM. */ +sun_do_break ();/* On Sun4c, the while loop hangs */ while (1 ) { status =readb (&channel->control);ZSDELAY ();
kernel/softlockup.c +1 -0
@@ -105,6 +105,7 @@ this_cpu);dump_stack ();spin_unlock (&print_lock); +panic ("Sun4c can't cope with soft lockups\n" ); } }
From: Meelis Roos <[email protected]>
Date: Thu, 5 Feb 2009 16:07:14 +0200 (EET)
Quoted 3 lines
First, why tell the user to press Stop-A or break at all? Is it because we can extract information from Break-T, Break-P etc? Otherwise the panic code could drop to prom itself?
You might want to hit SysRQ-something to extract information, remount root read-only, unmount all partitions, force another sync, etc. before dropping to the prom.
Quoted 9 lines
I tried the following patch and that did not work - probably because of the same reason that Break did not work (interrupts off?). Seems the
local_irq_enable()is not enough - but what could help here? Isprom_halt()the right thing? ... Kad a look of waht Stop-A does, tried also the second patch... but if it would have worked, Stop-A wouldb prpbaly also have.This patch is of course not even close to merging, it's just a hack to try it out.
What kind of console are you on?
For serial consoles, you have to send BREAK twice.
For traditional type4/5 serial keyboards, Stop-A should work.
For USB keyboard nothing is going to work, sorry.
PROM console will also not work for fetching input and breaking into the firmware.
Quoted 3 lines
What kind of console are you on?
For serial consoles, you have to send BREAK twice.
I'm on serial console:
[ 129.237799] f005de3c: ttyS0 at MMIO 0x1fff8902000 (irq = 2) is a zs (ESCC) [ 129.237925] Console: ttyS0 (SunZilog zs0) [ 129.238289] console [ttyS0] enabled
Strange that this time (fresh todays git kernel with no changes) I can use BREAK successfully - and I only need to send it once from minicom (^A F).
Signature · 1 line
Meelis Roos ([email protected])
From: Meelis Roos <[email protected]>
Date: Fri, 6 Feb 2009 14:38:25 +0200 (EET)
Quoted 4 lines
Quoted 3 lines
What kind of console are you on?
For serial consoles, you have to send BREAK twice.
Quoted 8 lines
I'm on serial console:
[ 129.237799] f005de3c: ttyS0 at MMIO 0x1fff8902000 (irq = 2) is a zs (ESCC) [ 129.237925] Console: ttyS0 (SunZilog zs0) [ 129.238289] console [ttyS0] enabledStrange that this time (fresh todays git kernel with no changes) I can use BREAK successfully - and I only need to send it once from minicom (^A F).
Strange... I have to send two breaks on hypervisor sun4v consoles.
Because the way you send Alt-SYSRQ keycodes on serial consoles is BREAK+sysrq_code, and that's why two breaks are necessary to indicate a real break into the OBP prompt.
I suspect it doesn't work for you in that other case because it's at a point before the serial driver has even registered yet.
Quoted 9 lines
Quoted 8 lines
I'm on serial console:
[ 129.237799] f005de3c: ttyS0 at MMIO 0x1fff8902000 (irq = 2) is a zs (ESCC) [ 129.237925] Console: ttyS0 (SunZilog zs0) [ 129.238289] console [ttyS0] enabledStrange that this time (fresh todays git kernel with no changes) I can use BREAK successfully - and I only need to send it once from minicom (^A F).
Quoted 8 lines
Strange... I have to send two breaks on hypervisor sun4v consoles.
Because the way you send Alt-SYSRQ keycodes on serial consoles is BREAK+sysrq_code, and that's why two breaks are necessary to indicate a real break into the OBP prompt.
I suspect it doesn't work for you in that other case because it's at a point before the serial driver has even registered yet.
I think it was registered...
Just tried with fully booted up system (E3500, console on zs serial) and single BREAK was enough to drop to prom ok prompt.
Signature · 1 line
Meelis Roos ([email protected])