diff options
author | Patrick Williams <iawillia@us.ibm.com> | 2014-03-27 16:13:16 -0500 |
---|---|---|
committer | A. Patrick Williams III <iawillia@us.ibm.com> | 2014-04-03 14:54:26 -0500 |
commit | cadf4e34157e599e1352de1d93ec406f3a2759a9 (patch) | |
tree | dc672595fd53376a4f9632cdb5df48dd0e11ed44 /src | |
parent | 42a3149689b527253a20dd9067be38bcbc4855d5 (diff) | |
download | talos-hostboot-cadf4e34157e599e1352de1d93ec406f3a2759a9.tar.gz talos-hostboot-cadf4e34157e599e1352de1d93ec406f3a2759a9.zip |
Add printk error log UD and collect on task crash.
- Create a new UserDetails section for error log.
- Modify initservice utility for launching tasks (shared by
initservice and istepdispatcher) to collect this when a
task has crashed.
Change-Id: I1273457fcc3879b9e2ca91b636281225a8f79136
CQ: SW254145
Backport: release-fips810
Reviewed-on: http://gfw160.aus.stglabs.ibm.com:8080/gerrit/9985
Tested-by: Jenkins Server
Reviewed-by: Andrew J. Geissler <andrewg@us.ibm.com>
Reviewed-by: STEPHEN M. CPREK <smcprek@us.ibm.com>
Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/include/kernel/console.H | 4 | ||||
-rw-r--r-- | src/include/usr/errl/errlreasoncodes.H | 1 | ||||
-rw-r--r-- | src/include/usr/errl/errludprintk.H | 69 | ||||
-rw-r--r-- | src/usr/errl/errludprintk.C | 49 | ||||
-rw-r--r-- | src/usr/errl/makefile | 4 | ||||
-rw-r--r-- | src/usr/initservice/baseinitsvc/initservice.C | 7 |
6 files changed, 131 insertions, 3 deletions
diff --git a/src/include/kernel/console.H b/src/include/kernel/console.H index 74ab75408..22bd3c5b0 100644 --- a/src/include/kernel/console.H +++ b/src/include/kernel/console.H @@ -5,7 +5,7 @@ /* */ /* IBM CONFIDENTIAL */ /* */ -/* COPYRIGHT International Business Machines Corp. 2010,2013 */ +/* COPYRIGHT International Business Machines Corp. 2010,2014 */ /* */ /* p1 */ /* */ @@ -54,4 +54,6 @@ class Console : public Util::ConsoleBufferInterface char * iv_buffer; }; +extern char kernel_printk_buffer[Console::BUFFER_SIZE]; + #endif diff --git a/src/include/usr/errl/errlreasoncodes.H b/src/include/usr/errl/errlreasoncodes.H index f4cac6249..2a3a690ba 100644 --- a/src/include/usr/errl/errlreasoncodes.H +++ b/src/include/usr/errl/errlreasoncodes.H @@ -70,6 +70,7 @@ namespace ERRORLOG ERRL_UDT_ATTRIBUTE = 0x04, ERRL_UDT_LOGREGISTER = 0x05, ERRL_UDT_CALLOUT = 0x06, + ERRL_UDT_PRINTK = 0x07, }; }; diff --git a/src/include/usr/errl/errludprintk.H b/src/include/usr/errl/errludprintk.H new file mode 100644 index 000000000..5717169ae --- /dev/null +++ b/src/include/usr/errl/errludprintk.H @@ -0,0 +1,69 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/include/usr/errl/errludprintk.H $ */ +/* */ +/* IBM CONFIDENTIAL */ +/* */ +/* COPYRIGHT International Business Machines Corp. 2014 */ +/* */ +/* p1 */ +/* */ +/* Object Code Only (OCO) source materials */ +/* Licensed Internal Code Source Materials */ +/* IBM HostBoot Licensed Internal Code */ +/* */ +/* The source code for this program is not published or otherwise */ +/* divested of its trade secrets, irrespective of what has been */ +/* deposited with the U.S. Copyright Office. */ +/* */ +/* Origin: 30 */ +/* */ +/* IBM_PROLOG_END_TAG */ +#ifndef ERRL_UDPRINTK_H +#define ERRL_UDPRINTK_H + +/** + * @file errludprintk.H + * + * Defines the ErrlUserDetailsPrintk class that adds a portion of the printk + * buffers as FFDC to an error log as user detail data. + */ + +#include <stdint.h> +#include <errl/errluserdetails.H> + +namespace ERRORLOG +{ + + class ErrlUserDetailsPrintk : public ErrlUserDetails + { + public: + enum { DEFAULT_SIZE_BYTES = 256 }; + + /** @brief Constructor + * + * Captures the printk buffer. + * + * @param[in] i_size - Amount (in bytes) of data to capture. + */ + explicit ErrlUserDetailsPrintk(size_t i_size = DEFAULT_SIZE_BYTES) + { + _capturePrintk(i_size); + } + + /** @brief Destructor + */ + virtual ~ErrlUserDetailsPrintk() {}; + + private: + //Disabled. + ErrlUserDetailsPrintk(const ErrlUserDetailsPrintk&); + ErrlUserDetailsPrintk& operator=(const ErrlUserDetailsPrintk&); + + void _capturePrintk(size_t); + }; + +} + +#endif diff --git a/src/usr/errl/errludprintk.C b/src/usr/errl/errludprintk.C new file mode 100644 index 000000000..f4838c7d2 --- /dev/null +++ b/src/usr/errl/errludprintk.C @@ -0,0 +1,49 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/errl/errludprintk.C $ */ +/* */ +/* IBM CONFIDENTIAL */ +/* */ +/* COPYRIGHT International Business Machines Corp. 2014 */ +/* */ +/* p1 */ +/* */ +/* Object Code Only (OCO) source materials */ +/* Licensed Internal Code Source Materials */ +/* IBM HostBoot Licensed Internal Code */ +/* */ +/* The source code for this program is not published or otherwise */ +/* divested of its trade secrets, irrespective of what has been */ +/* deposited with the U.S. Copyright Office. */ +/* */ +/* Origin: 30 */ +/* */ +/* IBM_PROLOG_END_TAG */ +#include <errl/errludprintk.H> +#include <errl/errlreasoncodes.H> +#include <kernel/console.H> +#include <algorithm> +#include <string.h> + +namespace ERRORLOG +{ + + void ErrlUserDetailsPrintk::_capturePrintk(size_t i_size) + { + // Determine existing size of printk buffer. + size_t printkSize = strnlen(kernel_printk_buffer, Console::BUFFER_SIZE); + i_size = std::min(i_size, printkSize); + + // Copy trailing i_size to UD buffer. + uint8_t* buffer = reallocUsrBuf(i_size); + memcpy(buffer, &kernel_printk_buffer[printkSize - i_size], i_size); + + // Set up ErrlUserDetails instance variables. + iv_CompId = ERRL_COMP_ID; + iv_Version = 1; + iv_SubSection = ERRL_UDT_PRINTK; + + } + +}; diff --git a/src/usr/errl/makefile b/src/usr/errl/makefile index 544fa9695..cfeb85dc2 100644 --- a/src/usr/errl/makefile +++ b/src/usr/errl/makefile @@ -5,7 +5,7 @@ # # IBM CONFIDENTIAL # -# COPYRIGHT International Business Machines Corp. 2011,2013 +# COPYRIGHT International Business Machines Corp. 2011,2014 # # p1 # @@ -26,7 +26,7 @@ MODULE = errl OBJS = errlentry.o errlmanager.o errlsctn.o errlsctnhdr.o errlprvt.o errluh.o \ errlud.o errlsrc.o errluserdetails.o backtrace.o errludtarget.o \ errludstring.o errludbacktrace.o errludattribute.o errludlogregister.o \ - errludcallout.o + errludcallout.o errludprintk.o SUBDIRS = test.d parser.d runtime.d diff --git a/src/usr/initservice/baseinitsvc/initservice.C b/src/usr/initservice/baseinitsvc/initservice.C index 2b1db6b35..3a437b933 100644 --- a/src/usr/initservice/baseinitsvc/initservice.C +++ b/src/usr/initservice/baseinitsvc/initservice.C @@ -47,6 +47,7 @@ #include <errl/errludstring.H> +#include <errl/errludprintk.H> #include <initservice/taskargs.H> // TASK_ENTRY_MACRO @@ -262,6 +263,9 @@ errlHndl_t InitService::startTask( INITSERVICE::WAIT_TASK_FAILED, l_tidretrc, l_childsts, hbSwError); + // Add Printk Buffer for FFDC. + ERRORLOG::ErrlUserDetailsPrintk().addToLog(l_errl); + // If the task crashed, then the l_childerrl is either NULL or // contains an RC indicating that the issue causing the child // to crash has already been reported. Therefore, reduce the @@ -390,6 +394,9 @@ errlHndl_t InitService::executeFn( INITSERVICE::WAIT_FN_FAILED, l_tidretrc, l_childsts, hbSwError); + // Add Printk Buffer for FFDC. + ERRORLOG::ErrlUserDetailsPrintk().addToLog(l_errl); + // If the task crashed, then the l_childerrl is either NULL or // contains an RC indicating that the issue causing the child // to crash has already been reported. Therefore, reduce the |