Commit 0cc8f1e0 authored by Paul Mackerras's avatar Paul Mackerras Committed by Linus Torvalds

[PATCH] ppc64: Reduce verbosity of RTAS error logs

Currently on pSeries systems the kernel will print out a hex dump of any
error events reported by the platform at boot time.  These can be rather
large and are practically incomprehensible to humans.  With this patch, the
kernel will by default print a 1-line summary for each error reported with
the severity, type, etc.  printed as text strings.  The old behaviour is
still available by using the rtasmsgs=on kernel command line option.  The
patch also renames some RTAS-specific symbols to start with "RTAS_".
Signed-off-by: default avatarNathan Fontenot <nfont@austin.ibm.com>
Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 7c1645c5
...@@ -200,7 +200,7 @@ ras_error_interrupt(int irq, void *dev_id, struct pt_regs * regs) ...@@ -200,7 +200,7 @@ ras_error_interrupt(int irq, void *dev_id, struct pt_regs * regs)
rtas_elog = (struct rtas_error_log *)ras_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 >= RTAS_SEVERITY_ERROR_SYNC))
fatal = 1; fatal = 1;
else else
fatal = 0; fatal = 0;
......
...@@ -46,6 +46,8 @@ static unsigned int rtas_event_scan_rate; ...@@ -46,6 +46,8 @@ static unsigned int rtas_event_scan_rate;
static unsigned int rtas_error_log_max; static unsigned int rtas_error_log_max;
static unsigned int rtas_error_log_buffer_max; static unsigned int rtas_error_log_buffer_max;
static int full_rtas_msgs = 0;
extern volatile int no_more_logging; extern volatile int no_more_logging;
volatile int error_log_cnt = 0; volatile int error_log_cnt = 0;
...@@ -59,6 +61,35 @@ static unsigned char logdata[RTAS_ERROR_LOG_MAX]; ...@@ -59,6 +61,35 @@ static unsigned char logdata[RTAS_ERROR_LOG_MAX];
static int get_eventscan_parms(void); static int get_eventscan_parms(void);
static char *rtas_type[] = {
"Unknown", "Retry", "TCE Error", "Internal Device Failure",
"Timeout", "Data Parity", "Address Parity", "Cache Parity",
"Address Invalid", "ECC Uncorrected", "ECC Corrupted",
};
static char *rtas_event_type(int type)
{
if ((type > 0) && (type < 11))
return rtas_type[type];
switch (type) {
case RTAS_TYPE_EPOW:
return "EPOW";
case RTAS_TYPE_PLATFORM:
return "Platform Error";
case RTAS_TYPE_IO:
return "I/O Event";
case RTAS_TYPE_INFO:
return "Platform Information Event";
case RTAS_TYPE_DEALLOC:
return "Resource Deallocation Event";
case RTAS_TYPE_DUMP:
return "Dump Notification Event";
}
return rtas_type[0];
}
/* To see this info, grep RTAS /var/log/messages and each entry /* To see this info, grep RTAS /var/log/messages and each entry
* will be collected together with obvious begin/end. * will be collected together with obvious begin/end.
* There will be a unique identifier on the begin and end lines. * There will be a unique identifier on the begin and end lines.
...@@ -80,33 +111,43 @@ static void printk_log_rtas(char *buf, int len) ...@@ -80,33 +111,43 @@ static void printk_log_rtas(char *buf, int len)
char buffer[64]; char buffer[64];
char * str = "RTAS event"; char * str = "RTAS event";
printk(RTAS_DEBUG "%d -------- %s begin --------\n", error_log_cnt, str); if (full_rtas_msgs) {
printk(RTAS_DEBUG "%d -------- %s begin --------\n",
/* error_log_cnt, str);
* Print perline bytes on each line, each line will start
* with RTAS and a changing number, so syslogd will /*
* print lines that are otherwise the same. Separate every * Print perline bytes on each line, each line will start
* 4 bytes with a space. * with RTAS and a changing number, so syslogd will
*/ * print lines that are otherwise the same. Separate every
for (i=0; i < len; i++) { * 4 bytes with a space.
j = i % perline; */
if (j == 0) { for (i = 0; i < len; i++) {
memset(buffer, 0, sizeof(buffer)); j = i % perline;
n = sprintf(buffer, "RTAS %d:", i/perline); if (j == 0) {
memset(buffer, 0, sizeof(buffer));
n = sprintf(buffer, "RTAS %d:", i/perline);
}
if ((i % 4) == 0)
n += sprintf(buffer+n, " ");
n += sprintf(buffer+n, "%02x", (unsigned char)buf[i]);
if (j == (perline-1))
printk(KERN_DEBUG "%s\n", buffer);
} }
if ((i % perline) != 0)
printk(KERN_DEBUG "%s\n", buffer);
if ((i % 4) == 0) printk(RTAS_DEBUG "%d -------- %s end ----------\n",
n += sprintf(buffer+n, " "); error_log_cnt, str);
} else {
n += sprintf(buffer+n, "%02x", (unsigned char)buf[i]); struct rtas_error_log *errlog = (struct rtas_error_log *)buf;
if (j == (perline-1)) printk(RTAS_DEBUG "event: %d, Type: %s, Severity: %d\n",
printk(KERN_DEBUG "%s\n", buffer); error_log_cnt, rtas_event_type(errlog->type),
errlog->severity);
} }
if ((i % perline) != 0)
printk(KERN_DEBUG "%s\n", buffer);
printk(RTAS_DEBUG "%d -------- %s end ----------\n", error_log_cnt, str);
} }
static int log_rtas_len(char * buf) static int log_rtas_len(char * buf)
...@@ -484,5 +525,15 @@ static int __init surveillance_setup(char *str) ...@@ -484,5 +525,15 @@ static int __init surveillance_setup(char *str)
return 1; return 1;
} }
static int __init rtasmsgs_setup(char *str)
{
if (strcmp(str, "on") == 0)
full_rtas_msgs = 1;
else if (strcmp(str, "off") == 0)
full_rtas_msgs = 0;
return 1;
}
__initcall(rtas_init); __initcall(rtas_init);
__setup("surveillance=", surveillance_setup); __setup("surveillance=", surveillance_setup);
__setup("rtasmsgs=", rtasmsgs_setup);
...@@ -219,15 +219,15 @@ SystemResetException(struct pt_regs *regs) ...@@ -219,15 +219,15 @@ SystemResetException(struct pt_regs *regs)
*/ */
static int recover_mce(struct pt_regs *regs, struct rtas_error_log err) static int recover_mce(struct pt_regs *regs, struct rtas_error_log err)
{ {
if (err.disposition == DISP_FULLY_RECOVERED) { if (err.disposition == RTAS_DISP_FULLY_RECOVERED) {
/* Platform corrected itself */ /* Platform corrected itself */
return 1; return 1;
} else if ((regs->msr & MSR_RI) && } else if ((regs->msr & MSR_RI) &&
user_mode(regs) && user_mode(regs) &&
err.severity == SEVERITY_ERROR_SYNC && err.severity == RTAS_SEVERITY_ERROR_SYNC &&
err.disposition == DISP_NOT_RECOVERED && err.disposition == RTAS_DISP_NOT_RECOVERED &&
err.target == TARGET_MEMORY && err.target == RTAS_TARGET_MEMORY &&
err.type == TYPE_ECC_UNCORR && err.type == RTAS_TYPE_ECC_UNCORR &&
!(current->pid == 0 || current->pid == 1)) { !(current->pid == 0 || current->pid == 1)) {
/* Kill off a user process with an ECC error */ /* Kill off a user process with an ECC error */
printk(KERN_ERR "MCE: uncorrectable ecc error for pid %d\n", printk(KERN_ERR "MCE: uncorrectable ecc error for pid %d\n",
......
...@@ -65,67 +65,78 @@ struct rtas_t { ...@@ -65,67 +65,78 @@ struct rtas_t {
struct device_node *dev; /* virtual address pointer */ struct device_node *dev; /* virtual address pointer */
}; };
/* Event classes */ /* RTAS event classes */
#define RTAS_INTERNAL_ERROR 0x80000000 /* set bit 0 */ #define RTAS_INTERNAL_ERROR 0x80000000 /* set bit 0 */
#define RTAS_EPOW_WARNING 0x40000000 /* set bit 1 */ #define RTAS_EPOW_WARNING 0x40000000 /* set bit 1 */
#define RTAS_POWERMGM_EVENTS 0x20000000 /* set bit 2 */ #define RTAS_POWERMGM_EVENTS 0x20000000 /* set bit 2 */
#define RTAS_HOTPLUG_EVENTS 0x10000000 /* set bit 3 */ #define RTAS_HOTPLUG_EVENTS 0x10000000 /* set bit 3 */
#define RTAS_EVENT_SCAN_ALL_EVENTS 0xf0000000 #define RTAS_EVENT_SCAN_ALL_EVENTS 0xf0000000
/* event-scan returns */ /* RTAS event severity */
#define SEVERITY_FATAL 0x5 #define RTAS_SEVERITY_FATAL 0x5
#define SEVERITY_ERROR 0x4 #define RTAS_SEVERITY_ERROR 0x4
#define SEVERITY_ERROR_SYNC 0x3 #define RTAS_SEVERITY_ERROR_SYNC 0x3
#define SEVERITY_WARNING 0x2 #define RTAS_SEVERITY_WARNING 0x2
#define SEVERITY_EVENT 0x1 #define RTAS_SEVERITY_EVENT 0x1
#define SEVERITY_NO_ERROR 0x0 #define RTAS_SEVERITY_NO_ERROR 0x0
#define DISP_FULLY_RECOVERED 0x0
#define DISP_LIMITED_RECOVERY 0x1 /* RTAS event disposition */
#define DISP_NOT_RECOVERED 0x2 #define RTAS_DISP_FULLY_RECOVERED 0x0
#define PART_PRESENT 0x0 #define RTAS_DISP_LIMITED_RECOVERY 0x1
#define PART_NOT_PRESENT 0x1 #define RTAS_DISP_NOT_RECOVERED 0x2
#define INITIATOR_UNKNOWN 0x0
#define INITIATOR_CPU 0x1 /* RTAS event initiator */
#define INITIATOR_PCI 0x2 #define RTAS_INITIATOR_UNKNOWN 0x0
#define INITIATOR_ISA 0x3 #define RTAS_INITIATOR_CPU 0x1
#define INITIATOR_MEMORY 0x4 #define RTAS_INITIATOR_PCI 0x2
#define INITIATOR_POWERMGM 0x5 #define RTAS_INITIATOR_ISA 0x3
#define TARGET_UNKNOWN 0x0 #define RTAS_INITIATOR_MEMORY 0x4
#define TARGET_CPU 0x1 #define RTAS_INITIATOR_POWERMGM 0x5
#define TARGET_PCI 0x2
#define TARGET_ISA 0x3 /* RTAS event target */
#define TARGET_MEMORY 0x4 #define RTAS_TARGET_UNKNOWN 0x0
#define TARGET_POWERMGM 0x5 #define RTAS_TARGET_CPU 0x1
#define TYPE_RETRY 0x01 #define RTAS_TARGET_PCI 0x2
#define TYPE_TCE_ERR 0x02 #define RTAS_TARGET_ISA 0x3
#define TYPE_INTERN_DEV_FAIL 0x03 #define RTAS_TARGET_MEMORY 0x4
#define TYPE_TIMEOUT 0x04 #define RTAS_TARGET_POWERMGM 0x5
#define TYPE_DATA_PARITY 0x05
#define TYPE_ADDR_PARITY 0x06 /* RTAS event type */
#define TYPE_CACHE_PARITY 0x07 #define RTAS_TYPE_RETRY 0x01
#define TYPE_ADDR_INVALID 0x08 #define RTAS_TYPE_TCE_ERR 0x02
#define TYPE_ECC_UNCORR 0x09 #define RTAS_TYPE_INTERN_DEV_FAIL 0x03
#define TYPE_ECC_CORR 0x0a #define RTAS_TYPE_TIMEOUT 0x04
#define TYPE_EPOW 0x40 #define RTAS_TYPE_DATA_PARITY 0x05
#define RTAS_TYPE_ADDR_PARITY 0x06
#define RTAS_TYPE_CACHE_PARITY 0x07
#define RTAS_TYPE_ADDR_INVALID 0x08
#define RTAS_TYPE_ECC_UNCORR 0x09
#define RTAS_TYPE_ECC_CORR 0x0a
#define RTAS_TYPE_EPOW 0x40
#define RTAS_TYPE_PLATFORM 0xE0
#define RTAS_TYPE_IO 0xE1
#define RTAS_TYPE_INFO 0xE2
#define RTAS_TYPE_DEALLOC 0xE3
#define RTAS_TYPE_DUMP 0xE4
/* I don't add PowerMGM events right now, this is a different topic */ /* I don't add PowerMGM events right now, this is a different topic */
#define TYPE_PMGM_POWER_SW_ON 0x60 #define RTAS_TYPE_PMGM_POWER_SW_ON 0x60
#define TYPE_PMGM_POWER_SW_OFF 0x61 #define RTAS_TYPE_PMGM_POWER_SW_OFF 0x61
#define TYPE_PMGM_LID_OPEN 0x62 #define RTAS_TYPE_PMGM_LID_OPEN 0x62
#define TYPE_PMGM_LID_CLOSE 0x63 #define RTAS_TYPE_PMGM_LID_CLOSE 0x63
#define TYPE_PMGM_SLEEP_BTN 0x64 #define RTAS_TYPE_PMGM_SLEEP_BTN 0x64
#define TYPE_PMGM_WAKE_BTN 0x65 #define RTAS_TYPE_PMGM_WAKE_BTN 0x65
#define TYPE_PMGM_BATTERY_WARN 0x66 #define RTAS_TYPE_PMGM_BATTERY_WARN 0x66
#define TYPE_PMGM_BATTERY_CRIT 0x67 #define RTAS_TYPE_PMGM_BATTERY_CRIT 0x67
#define TYPE_PMGM_SWITCH_TO_BAT 0x68 #define RTAS_TYPE_PMGM_SWITCH_TO_BAT 0x68
#define TYPE_PMGM_SWITCH_TO_AC 0x69 #define RTAS_TYPE_PMGM_SWITCH_TO_AC 0x69
#define TYPE_PMGM_KBD_OR_MOUSE 0x6a #define RTAS_TYPE_PMGM_KBD_OR_MOUSE 0x6a
#define TYPE_PMGM_ENCLOS_OPEN 0x6b #define RTAS_TYPE_PMGM_ENCLOS_OPEN 0x6b
#define TYPE_PMGM_ENCLOS_CLOSED 0x6c #define RTAS_TYPE_PMGM_ENCLOS_CLOSED 0x6c
#define TYPE_PMGM_RING_INDICATE 0x6d #define RTAS_TYPE_PMGM_RING_INDICATE 0x6d
#define TYPE_PMGM_LAN_ATTENTION 0x6e #define RTAS_TYPE_PMGM_LAN_ATTENTION 0x6e
#define TYPE_PMGM_TIME_ALARM 0x6f #define RTAS_TYPE_PMGM_TIME_ALARM 0x6f
#define TYPE_PMGM_CONFIG_CHANGE 0x70 #define RTAS_TYPE_PMGM_CONFIG_CHANGE 0x70
#define TYPE_PMGM_SERVICE_PROC 0x71 #define RTAS_TYPE_PMGM_SERVICE_PROC 0x71
struct rtas_error_log { struct rtas_error_log {
unsigned long version:8; /* Architectural version */ unsigned long version:8; /* Architectural version */
......
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