Commit 43ed3baf authored by Hidetoshi Seto's avatar Hidetoshi Seto Committed by Tony Luck

[IA64] printing support for MCA/INIT

Printing message to console from MCA/INIT handler is useful,
however doing oops_in_progress = 1 in them exactly makes
something in kernel wrong. Especially it sounds ugly if
system goes wrong after returning from recoverable MCA.

This patch adds ia64_mca_printk() function that collects
messages into temporary-not-so-large message buffer during
in MCA/INIT environment and print them out later, after
returning to normal context or when handlers determine to
down the system.

Also this print function is exported for use in extensional
MCA handler. It would be useful to describe detail about
recovery.

NOTE:
I don't think it is sane thing if temporary message buffer
is enlarged enough to hold whole stack dumps from INIT, so
buffering is disabled during stack dump from INIT-monarch
(= default_monarch_init_process). please fix it in future.
Signed-off-by: default avatarHidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>
Acked-by: default avatarRuss Anderson <rja@sgi.com>
Signed-off-by: default avatarTony Luck <tony.luck@intel.com>
parent 816add4e
This diff is collapsed.
...@@ -79,14 +79,30 @@ static int ...@@ -79,14 +79,30 @@ static int
fatal_mca(const char *fmt, ...) fatal_mca(const char *fmt, ...)
{ {
va_list args; va_list args;
char buf[256];
va_start(args, fmt); va_start(args, fmt);
vprintk(fmt, args); vsnprintf(buf, sizeof(buf), fmt, args);
va_end(args); va_end(args);
ia64_mca_printk(KERN_ALERT "MCA: %s\n", buf);
return MCA_NOT_RECOVERED; return MCA_NOT_RECOVERED;
} }
static int
mca_recovered(const char *fmt, ...)
{
va_list args;
char buf[256];
va_start(args, fmt);
vsnprintf(buf, sizeof(buf), fmt, args);
va_end(args);
ia64_mca_printk(KERN_INFO "MCA: %s\n", buf);
return MCA_RECOVERED;
}
/** /**
* mca_page_isolate - isolate a poisoned page in order not to use it later * mca_page_isolate - isolate a poisoned page in order not to use it later
* @paddr: poisoned memory location * @paddr: poisoned memory location
...@@ -140,6 +156,7 @@ mca_page_isolate(unsigned long paddr) ...@@ -140,6 +156,7 @@ mca_page_isolate(unsigned long paddr)
void void
mca_handler_bh(unsigned long paddr, void *iip, unsigned long ipsr) mca_handler_bh(unsigned long paddr, void *iip, unsigned long ipsr)
{ {
ia64_mlogbuf_dump();
printk(KERN_ERR "OS_MCA: process [cpu %d, pid: %d, uid: %d, " printk(KERN_ERR "OS_MCA: process [cpu %d, pid: %d, uid: %d, "
"iip: %p, psr: 0x%lx,paddr: 0x%lx](%s) encounters MCA.\n", "iip: %p, psr: 0x%lx,paddr: 0x%lx](%s) encounters MCA.\n",
raw_smp_processor_id(), current->pid, current->uid, raw_smp_processor_id(), current->pid, current->uid,
...@@ -440,7 +457,7 @@ recover_from_read_error(slidx_table_t *slidx, ...@@ -440,7 +457,7 @@ recover_from_read_error(slidx_table_t *slidx,
/* Is target address valid? */ /* Is target address valid? */
if (!pbci->tv) if (!pbci->tv)
return fatal_mca(KERN_ALERT "MCA: target address not valid\n"); return fatal_mca("target address not valid");
/* /*
* cpu read or memory-mapped io read * cpu read or memory-mapped io read
...@@ -458,7 +475,7 @@ recover_from_read_error(slidx_table_t *slidx, ...@@ -458,7 +475,7 @@ recover_from_read_error(slidx_table_t *slidx,
/* Is minstate valid? */ /* Is minstate valid? */
if (!peidx_bottom(peidx) || !(peidx_bottom(peidx)->valid.minstate)) if (!peidx_bottom(peidx) || !(peidx_bottom(peidx)->valid.minstate))
return fatal_mca(KERN_ALERT "MCA: minstate not valid\n"); return fatal_mca("minstate not valid");
psr1 =(struct ia64_psr *)&(peidx_minstate_area(peidx)->pmsa_ipsr); psr1 =(struct ia64_psr *)&(peidx_minstate_area(peidx)->pmsa_ipsr);
psr2 =(struct ia64_psr *)&(peidx_minstate_area(peidx)->pmsa_xpsr); psr2 =(struct ia64_psr *)&(peidx_minstate_area(peidx)->pmsa_xpsr);
...@@ -492,13 +509,14 @@ recover_from_read_error(slidx_table_t *slidx, ...@@ -492,13 +509,14 @@ recover_from_read_error(slidx_table_t *slidx,
psr2->bn = 1; psr2->bn = 1;
psr2->i = 0; psr2->i = 0;
return MCA_RECOVERED; return mca_recovered("user memory corruption. "
"kill affected process - recovered.");
} }
} }
return fatal_mca(KERN_ALERT "MCA: kernel context not recovered," return fatal_mca("kernel context not recovered, iip 0x%lx\n",
" iip 0x%lx\n", pmsa->pmsa_iip); pmsa->pmsa_iip);
} }
/** /**
...@@ -584,13 +602,13 @@ recover_from_processor_error(int platform, slidx_table_t *slidx, ...@@ -584,13 +602,13 @@ recover_from_processor_error(int platform, slidx_table_t *slidx,
* The machine check is corrected. * The machine check is corrected.
*/ */
if (psp->cm == 1) if (psp->cm == 1)
return MCA_RECOVERED; return mca_recovered("machine check is already corrected.");
/* /*
* The error was not contained. Software must be reset. * The error was not contained. Software must be reset.
*/ */
if (psp->us || psp->ci == 0) if (psp->us || psp->ci == 0)
return fatal_mca(KERN_ALERT "MCA: error not contained\n"); return fatal_mca("error not contained");
/* /*
* The cache check and bus check bits have four possible states * The cache check and bus check bits have four possible states
...@@ -601,22 +619,22 @@ recover_from_processor_error(int platform, slidx_table_t *slidx, ...@@ -601,22 +619,22 @@ recover_from_processor_error(int platform, slidx_table_t *slidx,
* 1 1 Memory error, attempt recovery * 1 1 Memory error, attempt recovery
*/ */
if (psp->bc == 0 || pbci == NULL) if (psp->bc == 0 || pbci == NULL)
return fatal_mca(KERN_ALERT "MCA: No bus check\n"); return fatal_mca("No bus check");
/* /*
* Sorry, we cannot handle so many. * Sorry, we cannot handle so many.
*/ */
if (peidx_bus_check_num(peidx) > 1) if (peidx_bus_check_num(peidx) > 1)
return fatal_mca(KERN_ALERT "MCA: Too many bus checks\n"); return fatal_mca("Too many bus checks");
/* /*
* Well, here is only one bus error. * Well, here is only one bus error.
*/ */
if (pbci->ib) if (pbci->ib)
return fatal_mca(KERN_ALERT "MCA: Internal Bus error\n"); return fatal_mca("Internal Bus error");
if (pbci->cc) if (pbci->cc)
return fatal_mca(KERN_ALERT "MCA: Cache-cache error\n"); return fatal_mca("Cache-cache error");
if (pbci->eb && pbci->bsi > 0) if (pbci->eb && pbci->bsi > 0)
return fatal_mca(KERN_ALERT "MCA: External bus check fatal status\n"); return fatal_mca("External bus check fatal status");
/* /*
* This is a local MCA and estimated as recoverble external bus error. * This is a local MCA and estimated as recoverble external bus error.
...@@ -628,7 +646,7 @@ recover_from_processor_error(int platform, slidx_table_t *slidx, ...@@ -628,7 +646,7 @@ recover_from_processor_error(int platform, slidx_table_t *slidx,
/* /*
* On account of strange SAL error record, we cannot recover. * On account of strange SAL error record, we cannot recover.
*/ */
return fatal_mca(KERN_ALERT "MCA: Strange SAL record\n"); return fatal_mca("Strange SAL record");
} }
/** /**
...@@ -657,10 +675,10 @@ mca_try_to_recover(void *rec, struct ia64_sal_os_state *sos) ...@@ -657,10 +675,10 @@ mca_try_to_recover(void *rec, struct ia64_sal_os_state *sos)
/* Now, OS can recover when there is one processor error section */ /* Now, OS can recover when there is one processor error section */
if (n_proc_err > 1) if (n_proc_err > 1)
return fatal_mca(KERN_ALERT "MCA: Too Many Errors\n"); return fatal_mca("Too Many Errors");
else if (n_proc_err == 0) else if (n_proc_err == 0)
/* Weird SAL record ... We need not to recover */ /* Weird SAL record ... We can't do anything */
return fatal_mca(KERN_ALERT "MCA: Weird SAL record\n"); return fatal_mca("Weird SAL record");
/* Make index of processor error section */ /* Make index of processor error section */
mca_make_peidx((sal_log_processor_info_t*) mca_make_peidx((sal_log_processor_info_t*)
...@@ -671,7 +689,7 @@ mca_try_to_recover(void *rec, struct ia64_sal_os_state *sos) ...@@ -671,7 +689,7 @@ mca_try_to_recover(void *rec, struct ia64_sal_os_state *sos)
/* Check whether MCA is global or not */ /* Check whether MCA is global or not */
if (is_mca_global(&peidx, &pbci, sos)) if (is_mca_global(&peidx, &pbci, sos))
return fatal_mca(KERN_ALERT "MCA: global MCA\n"); return fatal_mca("global MCA");
/* Try to recover a processor error */ /* Try to recover a processor error */
return recover_from_processor_error(platform_err, &slidx, &peidx, return recover_from_processor_error(platform_err, &slidx, &peidx,
......
...@@ -118,3 +118,7 @@ struct mca_table_entry { ...@@ -118,3 +118,7 @@ struct mca_table_entry {
extern const struct mca_table_entry *search_mca_tables (unsigned long addr); extern const struct mca_table_entry *search_mca_tables (unsigned long addr);
extern int mca_recover_range(unsigned long); extern int mca_recover_range(unsigned long);
extern void ia64_mca_printk(const char * fmt, ...)
__attribute__ ((format (printf, 1, 2)));
extern void ia64_mlogbuf_dump(void);
...@@ -266,6 +266,7 @@ salinfo_log_wakeup(int type, u8 *buffer, u64 size, int irqsafe) ...@@ -266,6 +266,7 @@ salinfo_log_wakeup(int type, u8 *buffer, u64 size, int irqsafe)
/* Check for outstanding MCA/INIT records every minute (arbitrary) */ /* Check for outstanding MCA/INIT records every minute (arbitrary) */
#define SALINFO_TIMER_DELAY (60*HZ) #define SALINFO_TIMER_DELAY (60*HZ)
static struct timer_list salinfo_timer; static struct timer_list salinfo_timer;
extern void ia64_mlogbuf_dump(void);
static void static void
salinfo_timeout_check(struct salinfo_data *data) salinfo_timeout_check(struct salinfo_data *data)
...@@ -283,6 +284,7 @@ salinfo_timeout_check(struct salinfo_data *data) ...@@ -283,6 +284,7 @@ salinfo_timeout_check(struct salinfo_data *data)
static void static void
salinfo_timeout (unsigned long arg) salinfo_timeout (unsigned long arg)
{ {
ia64_mlogbuf_dump();
salinfo_timeout_check(salinfo_data + SAL_INFO_TYPE_MCA); salinfo_timeout_check(salinfo_data + SAL_INFO_TYPE_MCA);
salinfo_timeout_check(salinfo_data + SAL_INFO_TYPE_INIT); salinfo_timeout_check(salinfo_data + SAL_INFO_TYPE_INIT);
salinfo_timer.expires = jiffies + SALINFO_TIMER_DELAY; salinfo_timer.expires = jiffies + SALINFO_TIMER_DELAY;
...@@ -332,6 +334,8 @@ retry: ...@@ -332,6 +334,8 @@ retry:
if (cpu == -1) if (cpu == -1)
goto retry; goto retry;
ia64_mlogbuf_dump();
/* for next read, start checking at next CPU */ /* for next read, start checking at next CPU */
data->cpu_check = cpu; data->cpu_check = cpu;
if (++data->cpu_check == NR_CPUS) if (++data->cpu_check == NR_CPUS)
......
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