pstore: add pmsg
PATCH 3/3 pstore: add pmsg
A secured user-space accessible pstore object. Writes to /dev/pmsg0 are appended to the buffer, on reboot the persistent contents are available in /sys/fs/pstore/pmsg-ramoops-[ID].
One possible use is syslogd, or other daemon, can write messages, then on reboot provides a means to triage user-space activities leading up to a panic as a companion to the pstore dmesg or console logs.
Signed-off-by Mark Salyzyn <[email protected]>
--- fs/pstore/Kconfig | 10 +++++ fs/pstore/Makefile | 2 + fs/pstore/inode.c | 3 ++ fs/pstore/internal.h | 6 +++ fs/pstore/platform.c | 1 + fs/pstore/pmsg.c | 101 +++++++++++++++++++++++++++++++++++++++++++++ fs/pstore/ram.c | 46 ++++++++++++++++++--- include/linux/pstore.h | 1 + include/linux/pstore_ram.h | 1 + 9 files changed, 166 insertions(+), 5 deletions(-) create mode 100644 fs/pstore/pmsg.c
fs/pstore/Kconfig +10 -0
@@ -21,6 +21,16 @@ config PSTORE_CONSOLE When the option is enabled, pstore will log all kernel messages, even if no oops or panic happened. +config PSTORE_PMSG + bool "Log user space messages" + depends on PSTORE + help + When the option is enabled, pstore will export a character + interface /dev/pmsg0 to log user space messages. On reboot + data can be retrieved from /sys/fs/pstore/pmsg-ramoops-[ID]. + + If unsure, say N. + config PSTORE_FTRACE bool "Persistent function tracer" depends on PSTORE
fs/pstore/Makefile +2 -0
@@ -7,5 +7,7 @@ obj-y += pstore.o pstore-objs += inode.o platform.o obj-$(CONFIG_PSTORE_FTRACE) += ftrace.o +obj-$(CONFIG_PSTORE_PMSG) += pmsg.o + ramoops-objs += ram.o ram_core.o obj-$(CONFIG_PSTORE_RAM) += ramoops.o
fs/pstore/inode.c +3 -0
@@ -360,6 +360,9 @@ int pstore_mkfile(enum pstore_type_id type, char *psname, u64 id, int count,snprintf (name,sizeof (name),"powerpc-common-%s-%lld" , psname, id);break ; +case PSTORE_TYPE_PMSG : +snprintf (name,sizeof (name),"pmsg-%s-%lld" , psname, id); +break ;case PSTORE_TYPE_UNKNOWN :snprintf (name,sizeof (name),"unknown-%s-%lld" , psname, id);break ;
fs/pstore/internal.h +6 -0
@@ -45,6 +45,12 @@ extern void pstore_register_ftrace(void);static inline void pstore_register_ftrace (void ) {}#endif +#ifdef CONFIG_PSTORE_PMSG +extern void pstore_register_pmsg (void ); +#else +static inline void pstore_register_pmsg (void ) {} +#endif +extern struct pstore_info *psinfo;extern void pstore_set_kmsg_bytes (int );
fs/pstore/platform.c +1 -0
@@ -447,6 +447,7 @@ int pstore_register(struct pstore_info *psi)if ((psi->flags &PSTORE_FLAGS_FRAGILE ) ==0 ) {pstore_register_console ();pstore_register_ftrace (); +pstore_register_pmsg (); }if (pstore_update_ms >=0 ) {
fs/pstore/pmsg.c new file +101 -0
101 lines not on this page · raw message
fs/pstore/ram.c +41 -5
145 lines not on this page · raw message
include/linux/pstore.h +1 -0
@@ -39,6 +39,7 @@ enum pstore_type_id {PSTORE_TYPE_PPC_RTAS =4 ,PSTORE_TYPE_PPC_OF =5 ,PSTORE_TYPE_PPC_COMMON =6 , +PSTORE_TYPE_PMSG =7 , PSTORE_TYPE_UNKNOWN = 255 };
include/linux/pstore_ram.h +1 -0
@@ -81,6 +81,7 @@ struct ramoops_platform_data {unsigned long record_size;unsigned long console_size;unsigned long ftrace_size; +unsigned long pmsg_size;int dump_oops;struct persistent_ram_ecc_info ecc_info; };
Signature · 1 line
2.2.0.rc0.207.ga3a616c