IPMI: Add console oops catcher
PATCH 4/5 IPMI: Add console oops catcher
From: Hiroshi Shimamoto <[email protected]>
Console messages on oops or panic are very important to investigate problem. Logging oops or panic messages to SEL is useful because SEL is a non volatile memory.
Implement a console driver to log messages to SEL when oops_in_progress is not zero. The first message just after oops, panic or every 10 seconds from last timestamp are logged as OEM event with timestamp, others are logged as OEM event without timestamp.
Enable config IPMI_OOPS_CONSOLE and add console=ttyIPMI to kernel command line to log panic or oops messages to IPMI SEL.
The number of entries for this output is limited by msg_limit paramter, and the default value is 100.
---
v2 -> v3: Use timestamp in first recode and every 10 seconds. v1 -> v2: Add msg_limit to limit output size.
drivers/char/ipmi/Kconfig | 7 + drivers/char/ipmi/Makefile | 1 + drivers/char/ipmi/ipmi_oops_console.c | 256 +++++++++++++++++++++++++++++++++ 3 files changed, 264 insertions(+), 0 deletions(-) create mode 100644 drivers/char/ipmi/ipmi_oops_console.c
drivers/char/ipmi/Kconfig +7 -0
@@ -61,4 +61,11 @@ config IPMI_POWEROFF This enables a function to power off the system with IPMI if the IPMI management controller is capable of this. +config IPMI_OOPS_CONSOLE + tristate 'IPMI oops console' + help + This enables the IPMI oops console. IPMI oops console logs oops or + panic console messsages to SEL. The number of entries for this usage + is limited by msg_limit, default is 100 entries. + endif # IPMI_HANDLER
drivers/char/ipmi/Makefile +1 -0
@@ -9,3 +9,4 @@ obj-$(CONFIG_IPMI_DEVICE_INTERFACE) += ipmi_devintf.o obj-$(CONFIG_IPMI_SI) += ipmi_si.o obj-$(CONFIG_IPMI_WATCHDOG) += ipmi_watchdog.o obj-$(CONFIG_IPMI_POWEROFF) += ipmi_poweroff.o +obj-$(CONFIG_IPMI_OOPS_CONSOLE) += ipmi_oops_console.o
drivers/char/ipmi/ipmi_oops_console.c new file +256 -0
256 lines not on this page · raw message
Quoted 45 lines · On Tue, 03 Mar 2009 09:21:23 -0600 Corey Minyard <[email protected]> wrote:
From: Hiroshi Shimamoto <[email protected]>
Console messages on oops or panic are very important to investigate problem. Logging oops or panic messages to SEL is useful because SEL is a non volatile memory.
Implement a console driver to log messages to SEL when
oops_in_progressis not zero. The first message just after oops, panic or every 10 seconds from last timestamp are logged as OEM event with timestamp, others are logged as OEM event without timestamp.Enable config
IPMI_OOPS_CONSOLEand add console=ttyIPMI to kernel command line to log panic or oops messages to IPMI SEL.The number of entries for this output is limited by
msg_limitparamter, and the default value is 100....
drivers/char/ipmi/ipmi_oops_console.c new file +25
-0+static void ipmi_oops_console_log_to_sel (int timestamp) +{ +struct ipmi_system_interface_addr si; +struct kernel_ipmi_msg msg; +unsigned int len; +unsigned char data[16 ]; +unsigned char my_addr; + +if (!oops_user || !msg_len || msg_count >= msg_limit) +return ; + + len =min ((timestamp ?SEL_MSGSIZE_TIMESTAMP :SEL_MSGSIZE ), msg_len); + + si.addr_type =IPMI_SYSTEM_INTERFACE_ADDR_TYPE ; + si.channel =IPMI_BMC_CHANNEL ; + si.lun =0 ; + + msg.netfn =IPMI_NETFN_STORAGE_REQUEST ; + msg.cmd =IPMI_ADD_SEL_ENTRY_CMD ; + msg.data = data; + msg.data_len =16 ; + +memset (data,0 ,sizeof (data)); +if (timestamp) { + len =min (SEL_MSGSIZE_TIMESTAMP , msg_len);
drivers/char/ipmi/ipmi_oops_console.c line 112
Quoted 10 lines
drivers/char/ipmi/ipmi_oops_console.c new file +10
-0+ data[2 ] =0xd1 ;/* OEM event with timestamp */ +memcpy (data +10 , msg_ptr, len); + msg_jiffies = jiffies;/* save jiffies at timestamp */ + }else { + len =min (SEL_MSGSIZE , msg_len); + data[2 ] =0xf1 ;/* OEM event without timestamp */ +memcpy (data +3 , msg_ptr, len); + } + +preempt_disable ();
This reader is unable to determine what the mystery preempt_disable() is here for. It needs a comment, please.
drivers/char/ipmi/ipmi_oops_console.c line 117
Quoted 4 lines
drivers/char/ipmi/ipmi_oops_console.c new file +4
-0+if (ipmi_get_my_address (oops_user,0 , &my_addr)) + goto out; + +atomic_set (&oops_counter,2 );
What happens if two CPUs oops at the same time (which is fairly common)?
drivers/char/ipmi/ipmi_oops_console.c line 125
Quoted 8 lines
drivers/char/ipmi/ipmi_oops_console.c new file +8
-0+if (ipmi_request_supply_msgs (oops_user, (struct ipmi_addr *)&si, +0 , &msg,NULL , &oops_smi_msg, + &oops_recv_msg,1 ) <0 ) + goto out; +while (atomic_read (&oops_counter) >0 ) { +ipmi_poll_interface (oops_user); +cpu_relax (); + }
It would be prudent to have a timeout in this loop. The machine has crashed and subsystems and hardware and memory are in an unknown and possibly bad state.
Quoted 6 lines
drivers/char/ipmi/ipmi_oops_console.c new file +6
-0+ ++msg_count; + msg_len -= len; + msg_ptr = msg_len ? &oops_msg[len] : oops_msg; +out: +preempt_enable (); +}
drivers/char/ipmi/ipmi_oops_console.c line 178
Quoted 10 lines
drivers/char/ipmi/ipmi_oops_console.c new file +7
-0+ +static struct console oops_console = { + .name ="ttyIPMI" , + .write = ipmi_oops_console_write, + .unblank = ipmi_oops_console_sync, + .index =-1 , +};
This looks like we're abusing the "unblank" method.
If you think that the console subsystem is missing some capability which this driver needs then please do prefer to fix the console subsystem, rather than awkwardly making things fit.
Quoted 8 lines
drivers/char/ipmi/ipmi_oops_console.c new file +5
-0+static void ipmi_oops_recv (struct ipmi_recv_msg *msg,void *data) +{ +ipmi_free_recv_msg (msg); +} +
Quoted 53 lines · Andrew Morton
Quoted 50 lines · On Tue, 03 Mar 2009 09:21:23 -0600 Corey Minyard <[email protected]> wrote:
From: Hiroshi Shimamoto <[email protected]>
Console messages on oops or panic are very important to investigate problem. Logging oops or panic messages to SEL is useful because SEL is a non volatile memory.
Implement a console driver to log messages to SEL when
oops_in_progressis not zero. The first message just after oops, panic or every 10 seconds from last timestamp are logged as OEM event with timestamp, others are logged as OEM event without timestamp.Enable config
IPMI_OOPS_CONSOLEand add console=ttyIPMI to kernel command line to log panic or oops messages to IPMI SEL.The number of entries for this output is limited by
msg_limitparamter, and the default value is 100....
drivers/char/ipmi/ipmi_oops_console.c new file +30
-0+static void ipmi_oops_console_log_to_sel (int timestamp) +{ +struct ipmi_system_interface_addr si; +struct kernel_ipmi_msg msg; +unsigned int len; +unsigned char data[16 ]; +unsigned char my_addr; + +if (!oops_user || !msg_len || msg_count >= msg_limit) +return ; + + len =min ((timestamp ?SEL_MSGSIZE_TIMESTAMP :SEL_MSGSIZE ), msg_len); + + si.addr_type =IPMI_SYSTEM_INTERFACE_ADDR_TYPE ; + si.channel =IPMI_BMC_CHANNEL ; + si.lun =0 ; + + msg.netfn =IPMI_NETFN_STORAGE_REQUEST ; + msg.cmd =IPMI_ADD_SEL_ENTRY_CMD ; + msg.data = data; + msg.data_len =16 ; + +memset (data,0 ,sizeof (data)); +if (timestamp) { + len =min (SEL_MSGSIZE_TIMESTAMP , msg_len); + data[2 ] =0xd1 ;/* OEM event with timestamp */ +memcpy (data +10 , msg_ptr, len); + msg_jiffies = jiffies;/* save jiffies at timestamp */ + }else { + len =min (SEL_MSGSIZE , msg_len);
Quoted 8 lines
drivers/char/ipmi/ipmi_oops_console.c line 112
Quoted 5 lines
drivers/char/ipmi/ipmi_oops_console.c new file +5
-0+ data[2 ] =0xf1 ;/* OEM event without timestamp */ +memcpy (data +3 , msg_ptr, len); + } + +preempt_disable ();This reader is unable to determine what the mystery
preempt_disable()is here for. It needs a comment, please.
I cannot recall why it's here. So a comment is really needed. This preempt_disable() may not be needed.
Quoted 8 lines
drivers/char/ipmi/ipmi_oops_console.c line 117
Quoted 6 lines
drivers/char/ipmi/ipmi_oops_console.c new file +4
-0+if (ipmi_get_my_address (oops_user,0 , &my_addr)) + goto out; + +atomic_set (&oops_counter,2 );What happens if two CPUs oops at the same time (which is fairly common)?
OK. I'll look at this.
Quoted 13 lines
drivers/char/ipmi/ipmi_oops_console.c line 125
Quoted 9 lines
drivers/char/ipmi/ipmi_oops_console.c new file +8
-0+if (ipmi_request_supply_msgs (oops_user, (struct ipmi_addr *)&si, +0 , &msg,NULL , &oops_smi_msg, + &oops_recv_msg,1 ) <0 ) + goto out; +while (atomic_read (&oops_counter) >0 ) { +ipmi_poll_interface (oops_user); +cpu_relax (); + }It would be prudent to have a timeout in this loop. The machine has crashed and subsystems and hardware and memory are in an unknown and possibly bad state.
Right.
Quoted 20 lines
Quoted 7 lines
drivers/char/ipmi/ipmi_oops_console.c new file +6
-0+ ++msg_count; + msg_len -= len; + msg_ptr = msg_len ? &oops_msg[len] : oops_msg; +out: +preempt_enable (); +}drivers/char/ipmi/ipmi_oops_console.c line 178
Quoted 10 lines
drivers/char/ipmi/ipmi_oops_console.c new file +7
-0+ +static struct console oops_console = { + .name ="ttyIPMI" , + .write = ipmi_oops_console_write, + .unblank = ipmi_oops_console_sync, + .index =-1 , +};This looks like we're abusing the "unblank" method.
Quoted 3 lines
If you think that the console subsystem is missing some capability which this driver needs then please do prefer to fix the console subsystem, rather than awkwardly making things fit.
OK. Will take a look about this point.
Thanks,
Hiroshi
Quoted 21 lines · On Tue, 03 Mar 2009 16:03:37 -0800 Hiroshi Shimamoto…
...
Quoted 2 lines
This reader is unable to determine what the mystery
preempt_disable()is here for. It needs a comment, please.I cannot recall why it's here. So a comment is really needed. This
preempt_disable()may not be needed.Quoted 1 line
What happens if two CPUs oops at the same time (which is fairly common)?
...
OK. I'll look at this.
Quoted 3 lines
It would be prudent to have a timeout in this loop. The machine has crashed and subsystems and hardware and memory are in an unknown and possibly bad state.
Right.
...
Quoted 8 lines
Quoted 5 lines
This looks like we're abusing the "unblank" method.
If you think that the console subsystem is missing some capability which this driver needs then please do prefer to fix the console subsystem, rather than awkwardly making things fit.
OK. Will take a look about this point.
None of this happened.
It makes me reluctant to merge that patches as they stand, because then it all gets forgotten about, whereas holding the patches back will remind us that updates are needed.
Quoted 26 lines · Andrew Morton
Quoted 23 lines · On Tue, 03 Mar 2009 16:03:37 -0800 Hiroshi Shimamoto…
...
Quoted 2 lines
This reader is unable to determine what the mystery
preempt_disable()is here for. It needs a comment, please.I cannot recall why it's here. So a comment is really needed. This
preempt_disable()may not be needed.Quoted 1 line
What happens if two CPUs oops at the same time (which is fairly common)?
...
OK. I'll look at this.
Quoted 3 lines
It would be prudent to have a timeout in this loop. The machine has crashed and subsystems and hardware and memory are in an unknown and possibly bad state.
Right.
...
Quoted 5 lines
This looks like we're abusing the "unblank" method.
If you think that the console subsystem is missing some capability which this driver needs then please do prefer to fix the console subsystem, rather than awkwardly making things fit.
Quoted 8 lines
Quoted 2 lines
OK. Will take a look about this point.
None of this happened.
It makes me reluctant to merge that patches as they stand, because then it all gets forgotten about, whereas holding the patches back will remind us that updates are needed.
Sorry for late reply.
I couldn't have time for this patch.
I'll look at this again and will resend updates.
Thanks,
Hiroshi
Quoted 32 lines · Hiroshi Shimamoto
Quoted 31 lines · Andrew Morton
Quoted 16 lines · On Tue, 03 Mar 2009 16:03:37 -0800 Hiroshi Shimamoto…
...
Quoted 2 lines
This reader is unable to determine what the mystery
preempt_disable()is here for. It needs a comment, please.I cannot recall why it's here. So a comment is really needed. This
preempt_disable()may not be needed.Quoted 1 line
What happens if two CPUs oops at the same time (which is fairly common)?
...
OK. I'll look at this.
Quoted 3 lines
It would be prudent to have a timeout in this loop. The machine has crashed and subsystems and hardware and memory are in an unknown and possibly bad state.
Right.
Quoted 9 lines
...
Quoted 5 lines
This looks like we're abusing the "unblank" method.
If you think that the console subsystem is missing some capability which this driver needs then please do prefer to fix the console subsystem, rather than awkwardly making things fit.
OK. Will take a look about this point.
None of this happened.
Quoted 7 lines
Quoted 3 lines
It makes me reluctant to merge that patches as they stand, because then it all gets forgotten about, whereas holding the patches back will remind us that updates are needed.
Sorry for late reply.
I couldn't have time for this patch.
I'll look at this again and will resend updates.
Andrew, can we drop this for now and at get the other patches in? At least the first one ("Fix platform return check"), since it's an obvious bug fix.
Thanks,
-corey
Quoted 4 lines
Thanks,
Hiroshi
Quoted 38 lines · Corey Minyard
Quoted 37 lines · Hiroshi Shimamoto
Quoted 35 lines · Andrew Morton
Quoted 17 lines · On Tue, 03 Mar 2009 16:03:37 -0800 Hiroshi Shimamoto…
...
Quoted 2 lines
This reader is unable to determine what the mystery
preempt_disable()is here for. It needs a comment, please.I cannot recall why it's here. So a comment is really needed. This
preempt_disable()may not be needed.Quoted 2 lines
What happens if two CPUs oops at the same time (which is fairly common)?
...
OK. I'll look at this.
Quoted 3 lines
It would be prudent to have a timeout in this loop. The machine has crashed and subsystems and hardware and memory are in an unknown and possibly bad state.
Right.
Quoted 9 lines
...
Quoted 5 lines
This looks like we're abusing the "unblank" method.
If you think that the console subsystem is missing some capability which this driver needs then please do prefer to fix the console subsystem, rather than awkwardly making things fit.
OK. Will take a look about this point.
None of this happened.
It makes me reluctant to merge that patches as they stand, because then it all gets forgotten about, whereas holding the patches back will remind us that updates are needed.
Quoted 6 lines
Quoted 3 lines
Sorry for late reply.
I couldn't have time for this patch.
I'll look at this again and will resend updates.Andrew, can we drop this for now and at get the other patches in? At least the first one ("Fix platform return check"), since it's an obvious bug fix.
As it should allow us stop shipping a set of forked modules, ipmi-add-oem-message-handling.patch would be nice too :)
Quoted 21 lines
Thanks,
-corey
Quoted 4 lines
Thanks,
Hiroshi------------------------------------------------------------------------------
This SF.net email is sponsored by:
High Quality Requirements in a Collaborative Environment. Download a free trial of Rational Requirements Composer Now!
http://p.sf.net/sfu/www-ibm-com
_______________________________________________
Openipmi-developer mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/openipmi-developer
Signature · 1 line
dann frazier