summaryrefslogtreecommitdiffstats
path: root/src/usr/errl
diff options
context:
space:
mode:
authorMatt Derksen <mderkse1@us.ibm.com>2018-02-12 12:11:10 -0600
committerDaniel M. Crowell <dcrowell@us.ibm.com>2018-02-21 16:28:18 -0500
commit80819cf5302b79274276097b59f17e3254ae0099 (patch)
treebe9cad0874c5ee28e9c36eb6b869f7b542502821 /src/usr/errl
parent1275d064b04f96e767bfbf7b6777b73adf038ed6 (diff)
downloadtalos-hostboot-80819cf5302b79274276097b59f17e3254ae0099.tar.gz
talos-hostboot-80819cf5302b79274276097b59f17e3254ae0099.zip
Fix rollover of PLID numbers
Need to avoid incrementing into the processor node field of the PLID. Decided to use the highest bit in the last 3 bytes as a dividing bit. [0x##800000 - 0x##FFFFFF] -- for pre-boot setup errors. [0x##000000 - 0x##7FFFFF] -- for post setup errors When setting up from PNOR, we will look for the max EID in the post-setup range. If no max is found, restart at 0. Change-Id: I4a8811d9c93039090504ca9cf8c0eebc6812a4ca CQ:SW416592 Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/54362 Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com> Tested-by: Jenkins OP Build CI <op-jenkins+hostboot@us.ibm.com> Tested-by: Jenkins OP HW <op-hw-jenkins+hostboot@us.ibm.com> Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com> Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
Diffstat (limited to 'src/usr/errl')
-rw-r--r--src/usr/errl/errlmanager.C7
-rw-r--r--src/usr/errl/errlmanager_common.C55
-rw-r--r--src/usr/errl/runtime/rt_errlmanager.C3
3 files changed, 53 insertions, 12 deletions
diff --git a/src/usr/errl/errlmanager.C b/src/usr/errl/errlmanager.C
index 2f465a049..724c03a63 100644
--- a/src/usr/errl/errlmanager.C
+++ b/src/usr/errl/errlmanager.C
@@ -5,7 +5,7 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
-/* Contributors Listed Below - COPYRIGHT 2011,2017 */
+/* Contributors Listed Below - COPYRIGHT 2011,2018 */
/* [+] Google Inc. */
/* [+] International Business Machines Corp. */
/* */
@@ -117,6 +117,7 @@ AtLoadFunctions atLoadFunction;
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
ErrlManager::ErrlManager() :
+ iv_pnorReadyForErrorLogs(false),
iv_hwasProcessCalloutFn(NULL),
iv_msgQ(NULL),
iv_pnorAddr(NULL),
@@ -162,8 +163,8 @@ ErrlManager::ErrlManager() :
masterCpu.groupId :
masterCpu.groupId + 4;
- iv_currLogId = ERRLOG_PLID_BASE + ERRLOG_PLID_INITIAL +
- (l_eid_id << ERRLOG_PLID_NODE_SHIFT);
+ iv_baseNodeId = ERRLOG_PLID_BASE + (l_eid_id << ERRLOG_PLID_NODE_SHIFT);
+ iv_currLogId = iv_baseNodeId | ERRLOG_PLID_INITIAL;
// next, we need to look thru PNOR and see what error records are there;
// ours will be 1 after the highest found.
diff --git a/src/usr/errl/errlmanager_common.C b/src/usr/errl/errlmanager_common.C
index 832b7748e..a9982d67e 100644
--- a/src/usr/errl/errlmanager_common.C
+++ b/src/usr/errl/errlmanager_common.C
@@ -5,7 +5,7 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
-/* Contributors Listed Below - COPYRIGHT 2015,2017 */
+/* Contributors Listed Below - COPYRIGHT 2015,2018 */
/* [+] International Business Machines Corp. */
/* */
/* */
@@ -79,7 +79,37 @@ uint8_t getHiddenLogsEnable( )
// Atomically increment log id and return it.
uint32_t ErrlManager::getUniqueErrId()
{
- return (__sync_add_and_fetch(&iv_currLogId, 1));
+ uint32_t l_logId = 0;
+ uint32_t l_nextLogId = 1;
+
+ while (1)
+ {
+ l_logId = iv_currLogId;
+
+ if (!iv_pnorReadyForErrorLogs)
+ {
+ // Range [__800000 - __FFFFFF]
+ l_nextLogId = ( iv_baseNodeId |
+ (((l_logId + 1) & ERRLOG_PLID_MASK) |
+ ERRLOG_PLID_INITIAL) );
+ }
+ else
+ {
+ // Range [__000000 - __7FFFFFF]
+ l_nextLogId = ( iv_baseNodeId |
+ ((l_logId + 1) & ERRLOG_PLID_POST_MAX) );
+ }
+
+ if (__sync_bool_compare_and_swap(&iv_currLogId, l_logId, l_nextLogId))
+ {
+ // To maintain thread-safeness (do not use iv_currLogId here)
+ // Do the same operation to l_logId as this is the same value
+ // that iv_currLogID had before its operation
+ l_logId = l_nextLogId;
+ break;
+ }
+ }
+ return l_logId;
}
// ------------------------------------------------------------------
@@ -117,7 +147,8 @@ void ErrlManager::setupPnorInfo()
// so that our first save will increment and wrap correctly
iv_pnorOpenSlot = (iv_maxErrlInPnor - 1);
- // walk thru memory, finding error logs and determine the highest ID
+ // walk thru memory, finding error logs and
+ // determine the highest ID within the lower POST range of EIDs
uint32_t l_maxId = 0;
for (uint32_t i = 0; i < iv_maxErrlInPnor; i++)
{
@@ -134,7 +165,7 @@ void ErrlManager::setupPnorInfo()
}
// if this is 'my' type of plid (HB or HBRT) see if it's max
if (((l_id & FIRST_BYTE_ERRLOG) == ERRLOG_PLID_BASE ) &&
- (l_id > l_maxId ))
+ (l_id > l_maxId ) && (l_id <= ERRLOG_PLID_POST_MAX))
{
l_maxId = l_id;
@@ -203,10 +234,18 @@ void ErrlManager::setupPnorInfo()
} // for
// bump the current eid to 1 past the max eid found
- while (!__sync_bool_compare_and_swap(&iv_currLogId, iv_currLogId,
- (iv_currLogId & ERRLOG_PLID_BASE_MASK) +
- (l_maxId & ERRLOG_PLID_MASK) + 1));
- TRACFCOMP( g_trac_errl, INFO_MRK"setupPnorInfo reseting LogId 0x%X", iv_currLogId);
+ // Stay within the non-preboot range
+ while ( !__sync_bool_compare_and_swap(&iv_currLogId, iv_currLogId,
+ (iv_baseNodeId |
+ ((l_maxId + 1) & ERRLOG_PLID_POST_MAX))) );
+
+ // set this to change new max/min values for iv_currLogId
+ // new max = ERRLOG_PLID_POST_MAX, new min = 0
+ iv_pnorReadyForErrorLogs = true;
+ TRACFCOMP( g_trac_errl,
+ INFO_MRK"setupPnorInfo resetting LogId number 0x%X",
+ iv_currLogId);
+
// if error(s) came in before PNOR was ready,
// the error log(s) would be on this list. save now.
diff --git a/src/usr/errl/runtime/rt_errlmanager.C b/src/usr/errl/runtime/rt_errlmanager.C
index 4361a691d..10b521a32 100644
--- a/src/usr/errl/runtime/rt_errlmanager.C
+++ b/src/usr/errl/runtime/rt_errlmanager.C
@@ -5,7 +5,7 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
-/* Contributors Listed Below - COPYRIGHT 2013,2017 */
+/* Contributors Listed Below - COPYRIGHT 2013,2018 */
/* [+] International Business Machines Corp. */
/* */
/* */
@@ -66,6 +66,7 @@ bool rt_processCallout(errlHndl_t &io_errl,
///////////////////////////////////////////////////////////////////////////////
ErrlManager::ErrlManager() :
iv_currLogId(0),
+ iv_pnorReadyForErrorLogs(true),
iv_pStorage(NULL),
iv_hwasProcessCalloutFn(NULL),
iv_pnorAddr(NULL),
OpenPOWER on IntegriCloud