Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 208554
b: refs/heads/master
c: c7ff0d9
h: refs/heads/master
v: v3
  • Loading branch information
TAMUKI Shoichi authored and Linus Torvalds committed Aug 11, 2010
1 parent 299f6b0 commit 9f13b4f
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 69 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: bebf8cfaea1df1a104b993b995bb385e998a4dc8
refs/heads/master: c7ff0d9c92435e836e13aaa8d0e56d4000424bcc
3 changes: 0 additions & 3 deletions trunk/Documentation/kernel-parameters.txt
Original file line number Diff line number Diff line change
Expand Up @@ -915,9 +915,6 @@ and is between 256 and 4096 characters. It is defined in the file
controller
i8042.nopnp [HW] Don't use ACPIPnP / PnPBIOS to discover KBD/AUX
controllers
i8042.panicblink=
[HW] Frequency with which keyboard LEDs should blink
when kernel panics (default is 0.5 sec)
i8042.reset [HW] Reset the controller during init and cleanup
i8042.unlock [HW] Unlock (ignore) the keylock

Expand Down
17 changes: 5 additions & 12 deletions trunk/arch/arm/mach-s3c2440/mach-gta02.c
Original file line number Diff line number Diff line change
Expand Up @@ -90,24 +90,17 @@
static struct pcf50633 *gta02_pcf;

/*
* This gets called every 1ms when we paniced.
* This gets called frequently when we paniced.
*/

static long gta02_panic_blink(long count)
static long gta02_panic_blink(int state)
{
long delay = 0;
static long last_blink;
static char led;
char led;

/* Fast blink: 200ms period. */
if (count - last_blink < 100)
return 0;

led ^= 1;
led = (state) ? 1 : 0;
gpio_direction_output(GTA02_GPIO_AUX_LED, led);

last_blink = count;

return delay;
}

Expand Down Expand Up @@ -556,7 +549,7 @@ static void gta02_poweroff(void)

static void __init gta02_machine_init(void)
{
/* Set the panic callback to make AUX LED blink at ~5Hz. */
/* Set the panic callback to turn AUX LED on or off. */
panic_blink = gta02_panic_blink;

s3c_pm_init();
Expand Down
25 changes: 5 additions & 20 deletions trunk/drivers/input/serio/i8042.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,6 @@ static bool i8042_noloop;
module_param_named(noloop, i8042_noloop, bool, 0);
MODULE_PARM_DESC(noloop, "Disable the AUX Loopback command while probing for the AUX port");

static unsigned int i8042_blink_frequency = 500;
module_param_named(panicblink, i8042_blink_frequency, uint, 0600);
MODULE_PARM_DESC(panicblink, "Frequency with which keyboard LEDs should blink when kernel panics");

#ifdef CONFIG_X86
static bool i8042_dritek;
module_param_named(dritek, i8042_dritek, bool, 0);
Expand Down Expand Up @@ -1030,8 +1026,8 @@ static void i8042_controller_reset(void)


/*
* i8042_panic_blink() will flash the keyboard LEDs and is called when
* kernel panics. Flashing LEDs is useful for users running X who may
* i8042_panic_blink() will turn the keyboard LEDs on or off and is called
* when kernel panics. Flashing LEDs is useful for users running X who may
* not see the console and will help distingushing panics from "real"
* lockups.
*
Expand All @@ -1041,22 +1037,12 @@ static void i8042_controller_reset(void)

#define DELAY do { mdelay(1); if (++delay > 10) return delay; } while(0)

static long i8042_panic_blink(long count)
static long i8042_panic_blink(int state)
{
long delay = 0;
static long last_blink;
static char led;

/*
* We expect frequency to be about 1/2s. KDB uses about 1s.
* Make sure they are different.
*/
if (!i8042_blink_frequency)
return 0;
if (count - last_blink < i8042_blink_frequency)
return 0;
char led;

led ^= 0x01 | 0x04;
led = (state) ? 0x01 | 0x04 : 0;
while (i8042_read_status() & I8042_STR_IBF)
DELAY;
dbg("%02x -> i8042 (panic blink)", 0xed);
Expand All @@ -1069,7 +1055,6 @@ static long i8042_panic_blink(long count)
dbg("%02x -> i8042 (panic blink)", led);
i8042_write_data(led);
DELAY;
last_blink = count;
return delay;
}

Expand Down
2 changes: 1 addition & 1 deletion trunk/include/linux/kernel.h
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ struct va_format {
};

extern struct atomic_notifier_head panic_notifier_list;
extern long (*panic_blink)(long time);
extern long (*panic_blink)(int state);
NORET_TYPE void panic(const char * fmt, ...)
__attribute__ ((NORET_AND format (printf, 1, 2))) __cold;
extern void oops_enter(void);
Expand Down
58 changes: 26 additions & 32 deletions trunk/kernel/panic.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@
#include <linux/nmi.h>
#include <linux/dmi.h>

#define PANIC_TIMER_STEP 100
#define PANIC_BLINK_SPD 18

int panic_on_oops;
static unsigned long tainted_mask;
static int pause_on_oops;
Expand All @@ -36,36 +39,15 @@ ATOMIC_NOTIFIER_HEAD(panic_notifier_list);

EXPORT_SYMBOL(panic_notifier_list);

/* 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 no_blink(int state)
{
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);
}
return 0;
}

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

/**
* panic - halt the system
* @fmt: The text string to print
Expand All @@ -78,7 +60,8 @@ NORET_TYPE void panic(const char * fmt, ...)
{
static char buf[1024];
va_list args;
long i;
long i, i_next = 0;
int state = 0;

/*
* It's possible to come here directly from a panic-assertion and
Expand Down Expand Up @@ -117,16 +100,23 @@ 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; i++) {
for (i = 0; i < panic_timeout * 1000; i += PANIC_TIMER_STEP) {
touch_nmi_watchdog();
panic_blink_one_second();
if (i >= i_next) {
i += panic_blink(state ^= 1);
i_next = i + 3600 / PANIC_BLINK_SPD;
}
mdelay(PANIC_TIMER_STEP);
}
/*
* This will not be a clean reboot, with everything
Expand All @@ -152,9 +142,13 @@ NORET_TYPE void panic(const char * fmt, ...)
}
#endif
local_irq_enable();
while (1) {
for (i = 0; ; i += PANIC_TIMER_STEP) {
touch_softlockup_watchdog();
panic_blink_one_second();
if (i >= i_next) {
i += panic_blink(state ^= 1);
i_next = i + 3600 / PANIC_BLINK_SPD;
}
mdelay(PANIC_TIMER_STEP);
}
}

Expand Down

0 comments on commit 9f13b4f

Please sign in to comment.