Commit 039f45db authored by David Gibson's avatar David Gibson Committed by Linus Torvalds

[PATCH] ppc64: fix RAS irq handlers

Both arch/ppc64/kernel/ras.c and arch/ppc64/kernel/rtasd.c have a spinlock
variable declared static called "log_lock".  Since the code in these files
interact quit a lot, having two different locks with identical names is
manifestly confusing.  This patch renames both locks to something a little
clearer.  In the case of ras.c it also renames the buffer protected by the
lock to a more usefullly greppable name.
Signed-off-by: default avatarDavid Gibson <dwg@au.ibm.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 9ab2f3e0
...@@ -52,8 +52,8 @@ ...@@ -52,8 +52,8 @@
#include <asm/rtas.h> #include <asm/rtas.h>
#include <asm/ppcdebug.h> #include <asm/ppcdebug.h>
static unsigned char log_buf[RTAS_ERROR_LOG_MAX]; static unsigned char ras_log_buf[RTAS_ERROR_LOG_MAX];
static spinlock_t log_lock = SPIN_LOCK_UNLOCKED; static spinlock_t ras_log_buf_lock = SPIN_LOCK_UNLOCKED;
static int ras_get_sensor_state_token; static int ras_get_sensor_state_token;
static int ras_check_exception_token; static int ras_check_exception_token;
...@@ -155,23 +155,23 @@ ras_epow_interrupt(int irq, void *dev_id, struct pt_regs * regs) ...@@ -155,23 +155,23 @@ ras_epow_interrupt(int irq, void *dev_id, struct pt_regs * regs)
else else
critical = 0; critical = 0;
spin_lock(&log_lock); spin_lock(&ras_log_buf_lock);
status = rtas_call(ras_check_exception_token, 6, 1, NULL, status = rtas_call(ras_check_exception_token, 6, 1, NULL,
RAS_VECTOR_OFFSET, RAS_VECTOR_OFFSET,
virt_irq_to_real(irq_offset_down(irq)), virt_irq_to_real(irq_offset_down(irq)),
RTAS_EPOW_WARNING | RTAS_POWERMGM_EVENTS, RTAS_EPOW_WARNING | RTAS_POWERMGM_EVENTS,
critical, __pa(&log_buf), RTAS_ERROR_LOG_MAX); critical, __pa(&ras_log_buf), RTAS_ERROR_LOG_MAX);
udbg_printf("EPOW <0x%lx 0x%x 0x%x>\n", udbg_printf("EPOW <0x%lx 0x%x 0x%x>\n",
*((unsigned long *)&log_buf), status, state); *((unsigned long *)&ras_log_buf), status, state);
printk(KERN_WARNING "EPOW <0x%lx 0x%x 0x%x>\n", printk(KERN_WARNING "EPOW <0x%lx 0x%x 0x%x>\n",
*((unsigned long *)&log_buf), status, state); *((unsigned long *)&ras_log_buf), status, state);
/* format and print the extended information */ /* format and print the extended information */
log_error(log_buf, ERR_TYPE_RTAS_LOG, 0); log_error(ras_log_buf, ERR_TYPE_RTAS_LOG, 0);
spin_unlock(&log_lock); spin_unlock(&ras_log_buf_lock);
return IRQ_HANDLED; return IRQ_HANDLED;
} }
...@@ -190,15 +190,15 @@ ras_error_interrupt(int irq, void *dev_id, struct pt_regs * regs) ...@@ -190,15 +190,15 @@ ras_error_interrupt(int irq, void *dev_id, struct pt_regs * regs)
int status = 0xdeadbeef; int status = 0xdeadbeef;
int fatal; int fatal;
spin_lock(&log_lock); spin_lock(&ras_log_buf_lock);
status = rtas_call(ras_check_exception_token, 6, 1, NULL, status = rtas_call(ras_check_exception_token, 6, 1, NULL,
RAS_VECTOR_OFFSET, RAS_VECTOR_OFFSET,
virt_irq_to_real(irq_offset_down(irq)), virt_irq_to_real(irq_offset_down(irq)),
RTAS_INTERNAL_ERROR, 1 /*Time Critical */, RTAS_INTERNAL_ERROR, 1 /*Time Critical */,
__pa(&log_buf), RTAS_ERROR_LOG_MAX); __pa(&ras_log_buf), RTAS_ERROR_LOG_MAX);
rtas_elog = (struct rtas_error_log *)log_buf; rtas_elog = (struct rtas_error_log *)ras_log_buf;
if ((status == 0) && (rtas_elog->severity >= SEVERITY_ERROR_SYNC)) if ((status == 0) && (rtas_elog->severity >= SEVERITY_ERROR_SYNC))
fatal = 1; fatal = 1;
...@@ -206,13 +206,13 @@ ras_error_interrupt(int irq, void *dev_id, struct pt_regs * regs) ...@@ -206,13 +206,13 @@ ras_error_interrupt(int irq, void *dev_id, struct pt_regs * regs)
fatal = 0; fatal = 0;
/* format and print the extended information */ /* format and print the extended information */
log_error(log_buf, ERR_TYPE_RTAS_LOG, fatal); log_error(ras_log_buf, ERR_TYPE_RTAS_LOG, fatal);
if (fatal) { if (fatal) {
udbg_printf("Fatal HW Error <0x%lx 0x%x>\n", udbg_printf("Fatal HW Error <0x%lx 0x%x>\n",
*((unsigned long *)&log_buf), status); *((unsigned long *)&ras_log_buf), status);
printk(KERN_EMERG "Error: Fatal hardware error <0x%lx 0x%x>\n", printk(KERN_EMERG "Error: Fatal hardware error <0x%lx 0x%x>\n",
*((unsigned long *)&log_buf), status); *((unsigned long *)&ras_log_buf), status);
#ifndef DEBUG #ifndef DEBUG
/* Don't actually power off when debugging so we can test /* Don't actually power off when debugging so we can test
...@@ -223,12 +223,12 @@ ras_error_interrupt(int irq, void *dev_id, struct pt_regs * regs) ...@@ -223,12 +223,12 @@ ras_error_interrupt(int irq, void *dev_id, struct pt_regs * regs)
#endif #endif
} else { } else {
udbg_printf("Recoverable HW Error <0x%lx 0x%x>\n", udbg_printf("Recoverable HW Error <0x%lx 0x%x>\n",
*((unsigned long *)&log_buf), status); *((unsigned long *)&ras_log_buf), status);
printk(KERN_WARNING printk(KERN_WARNING
"Warning: Recoverable hardware error <0x%lx 0x%x>\n", "Warning: Recoverable hardware error <0x%lx 0x%x>\n",
*((unsigned long *)&log_buf), status); *((unsigned long *)&ras_log_buf), status);
} }
spin_unlock(&log_lock); spin_unlock(&ras_log_buf_lock);
return IRQ_HANDLED; return IRQ_HANDLED;
} }
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
#define DEBUG(A...) #define DEBUG(A...)
#endif #endif
static spinlock_t log_lock = SPIN_LOCK_UNLOCKED; static spinlock_t rtasd_log_lock = SPIN_LOCK_UNLOCKED;
DECLARE_WAIT_QUEUE_HEAD(rtas_log_wait); DECLARE_WAIT_QUEUE_HEAD(rtas_log_wait);
...@@ -152,7 +152,7 @@ void pSeries_log_error(char *buf, unsigned int err_type, int fatal) ...@@ -152,7 +152,7 @@ void pSeries_log_error(char *buf, unsigned int err_type, int fatal)
if (buf == NULL) if (buf == NULL)
return; return;
spin_lock_irqsave(&log_lock, s); spin_lock_irqsave(&rtasd_log_lock, s);
/* get length and increase count */ /* get length and increase count */
switch (err_type & ERR_TYPE_MASK) { switch (err_type & ERR_TYPE_MASK) {
...@@ -163,7 +163,7 @@ void pSeries_log_error(char *buf, unsigned int err_type, int fatal) ...@@ -163,7 +163,7 @@ void pSeries_log_error(char *buf, unsigned int err_type, int fatal)
break; break;
case ERR_TYPE_KERNEL_PANIC: case ERR_TYPE_KERNEL_PANIC:
default: default:
spin_unlock_irqrestore(&log_lock, s); spin_unlock_irqrestore(&rtasd_log_lock, s);
return; return;
} }
...@@ -174,7 +174,7 @@ void pSeries_log_error(char *buf, unsigned int err_type, int fatal) ...@@ -174,7 +174,7 @@ void pSeries_log_error(char *buf, unsigned int err_type, int fatal)
/* Check to see if we need to or have stopped logging */ /* Check to see if we need to or have stopped logging */
if (fatal || no_more_logging) { if (fatal || no_more_logging) {
no_more_logging = 1; no_more_logging = 1;
spin_unlock_irqrestore(&log_lock, s); spin_unlock_irqrestore(&rtasd_log_lock, s);
return; return;
} }
...@@ -199,12 +199,12 @@ void pSeries_log_error(char *buf, unsigned int err_type, int fatal) ...@@ -199,12 +199,12 @@ void pSeries_log_error(char *buf, unsigned int err_type, int fatal)
else else
rtas_log_start += 1; rtas_log_start += 1;
spin_unlock_irqrestore(&log_lock, s); spin_unlock_irqrestore(&rtasd_log_lock, s);
wake_up_interruptible(&rtas_log_wait); wake_up_interruptible(&rtas_log_wait);
break; break;
case ERR_TYPE_KERNEL_PANIC: case ERR_TYPE_KERNEL_PANIC:
default: default:
spin_unlock_irqrestore(&log_lock, s); spin_unlock_irqrestore(&rtasd_log_lock, s);
return; return;
} }
...@@ -247,24 +247,24 @@ static ssize_t rtas_log_read(struct file * file, char * buf, ...@@ -247,24 +247,24 @@ static ssize_t rtas_log_read(struct file * file, char * buf,
return -ENOMEM; return -ENOMEM;
spin_lock_irqsave(&log_lock, s); spin_lock_irqsave(&rtasd_log_lock, s);
/* if it's 0, then we know we got the last one (the one in NVRAM) */ /* if it's 0, then we know we got the last one (the one in NVRAM) */
if (rtas_log_size == 0 && !no_more_logging) if (rtas_log_size == 0 && !no_more_logging)
nvram_clear_error_log(); nvram_clear_error_log();
spin_unlock_irqrestore(&log_lock, s); spin_unlock_irqrestore(&rtasd_log_lock, s);
error = wait_event_interruptible(rtas_log_wait, rtas_log_size); error = wait_event_interruptible(rtas_log_wait, rtas_log_size);
if (error) if (error)
goto out; goto out;
spin_lock_irqsave(&log_lock, s); spin_lock_irqsave(&rtasd_log_lock, s);
offset = rtas_error_log_buffer_max * (rtas_log_start & LOG_NUMBER_MASK); offset = rtas_error_log_buffer_max * (rtas_log_start & LOG_NUMBER_MASK);
memcpy(tmp, &rtas_log_buf[offset], count); memcpy(tmp, &rtas_log_buf[offset], count);
rtas_log_start += 1; rtas_log_start += 1;
rtas_log_size -= 1; rtas_log_size -= 1;
spin_unlock_irqrestore(&log_lock, s); spin_unlock_irqrestore(&rtasd_log_lock, s);
error = copy_to_user(buf, tmp, count) ? -EFAULT : count; error = copy_to_user(buf, tmp, count) ? -EFAULT : count;
out: out:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment