Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 186250
b: refs/heads/master
c: 8aeee85
h: refs/heads/master
v: v3
  • Loading branch information
Anton Blanchard authored and Linus Torvalds committed Mar 6, 2010
1 parent c947d13 commit cea5482
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 17 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 78d7d407b62a021e6d2e8dc24c0b90e390ab58a1
refs/heads/master: 8aeee85a29e27e043db582bf2ae8e5f42767934f
46 changes: 30 additions & 16 deletions trunk/kernel/panic.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,36 @@ ATOMIC_NOTIFIER_HEAD(panic_notifier_list);

EXPORT_SYMBOL(panic_notifier_list);

static long no_blink(long time)
{
return 0;
}

/* Returns how long it waited in ms */
long (*panic_blink)(long time);
EXPORT_SYMBOL(panic_blink);

static void panic_blink_one_second(void)
{
static long i = 0, end;

if (panic_blink) {
end = i + MSEC_PER_SEC;

while (i < end) {
i += panic_blink(i);
mdelay(1);
i++;
}
} else {
/*
* When running under a hypervisor a small mdelay may get
* rounded up to the hypervisor timeslice. For example, with
* a 1ms in 10ms hypervisor timeslice we might inflate a
* mdelay(1) loop by 10x.
*
* If we have nothing to blink, spin on 1 second calls to
* mdelay to avoid this.
*/
mdelay(MSEC_PER_SEC);
}
}

/**
* panic - halt the system
* @fmt: The text string to print
Expand Down Expand Up @@ -95,21 +116,16 @@ NORET_TYPE void panic(const char * fmt, ...)

bust_spinlocks(0);

if (!panic_blink)
panic_blink = no_blink;

if (panic_timeout > 0) {
/*
* Delay timeout seconds before rebooting the machine.
* We can't use the "normal" timers since we just panicked.
*/
printk(KERN_EMERG "Rebooting in %d seconds..", panic_timeout);

for (i = 0; i < panic_timeout*1000; ) {
for (i = 0; i < panic_timeout; i++) {
touch_nmi_watchdog();
i += panic_blink(i);
mdelay(1);
i++;
panic_blink_one_second();
}
/*
* This will not be a clean reboot, with everything
Expand All @@ -135,11 +151,9 @@ NORET_TYPE void panic(const char * fmt, ...)
}
#endif
local_irq_enable();
for (i = 0; ; ) {
while (1) {
touch_softlockup_watchdog();
i += panic_blink(i);
mdelay(1);
i++;
panic_blink_one_second();
}
}

Expand Down

0 comments on commit cea5482

Please sign in to comment.