diff options
author | Brad Bishop <bradleyb@us.ibm.com> | 2012-07-16 20:58:06 -0500 |
---|---|---|
committer | A. Patrick Williams III <iawillia@us.ibm.com> | 2012-11-13 20:22:07 -0600 |
commit | e01ae7fdbc2549015f603fed9e44062067c81e90 (patch) | |
tree | 61f10d9af1139005fe99dd72e54cd4fcf5c76aa2 | |
parent | 6a6c4e1385a56e0545144f87a0f4735dbc714f56 (diff) | |
download | blackbird-hostboot-e01ae7fdbc2549015f603fed9e44062067c81e90.tar.gz blackbird-hostboot-e01ae7fdbc2549015f603fed9e44062067c81e90.zip |
Attention handler support for check for ipl attentions.
RTC: 40440
Change-Id: I4b0c907a05b800fdc69b3d02a5432d9fd27a1497
Reviewed-on: http://gfw160.austin.ibm.com:8080/gerrit/1458
Tested-by: Jenkins Server
Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com>
-rw-r--r-- | src/include/usr/diag/attn/attn.H | 14 | ||||
-rw-r--r-- | src/usr/diag/attn/attn.C | 84 | ||||
-rw-r--r-- | src/usr/diag/attn/attnfwd.H | 1 | ||||
-rw-r--r-- | src/usr/diag/attn/attnsvc.C | 13 | ||||
-rw-r--r-- | src/usr/diag/attn/attnsvc.H | 8 | ||||
-rw-r--r-- | src/usr/diag/attn/test/attnfakesys.C | 11 | ||||
-rw-r--r-- | src/usr/diag/attn/test/attnfakesys.H | 8 | ||||
-rw-r--r-- | src/usr/diag/attn/test/attnrandsource.H | 10 | ||||
-rw-r--r-- | src/usr/diag/attn/test/attntestipl.H | 144 |
9 files changed, 287 insertions, 6 deletions
diff --git a/src/include/usr/diag/attn/attn.H b/src/include/usr/diag/attn/attn.H index f13643ef8..4b2e8cbd2 100644 --- a/src/include/usr/diag/attn/attn.H +++ b/src/include/usr/diag/attn/attn.H @@ -30,6 +30,8 @@ * @brief HBATTN declarations. */ +#include <errl/errlentry.H> + namespace ATTN { @@ -57,5 +59,17 @@ errlHndl_t startService(); * @retval[1] Unexpected error occurred. */ errlHndl_t stopService(); + +/** + * @brief checkForIplAttentions + * + * Check each proc target for any attentions + * and invoke PRD for analysis. Will loop indefinitely + * until all chips stop reporting attentions. + * + * @retval[0] No errors. + * @retval[!0] Unexpected error occurred. + */ +errlHndl_t checkForIplAttentions(); } #endif diff --git a/src/usr/diag/attn/attn.C b/src/usr/diag/attn/attn.C index 5fd628564..f2d962cbd 100644 --- a/src/usr/diag/attn/attn.C +++ b/src/usr/diag/attn/attn.C @@ -35,6 +35,8 @@ #include "attnproc.H" #include "attnmem.H" #include <util/singleton.H> +#include "attntarget.H" +#include <errl/errlmanager.H> using namespace std; using namespace PRDF; @@ -71,6 +73,86 @@ errlHndl_t stopService() return Singleton<Service>::instance().stop(); } +errlHndl_t checkForIplAttentions() +{ + errlHndl_t err = NULL; + + assert(!Singleton<Service>::instance().running()); + + ProcOps & procOps = Singleton<ProcOps>::instance(); + MemOps & memOps = Singleton<MemOps>::instance(); + + TargetHandleList list; + + getTargetService().getAllChips(list, TYPE_PROC); + + TargetHandleList::iterator tit = list.begin(); + + while(tit != list.end()) + { + AttentionList attentions; + + do { + + attentions.clear(); + + // query the proc resolver for active attentions + + err = procOps.resolve(*tit, 0, attentions); + + if(err) + { + break; + } + + // query the mem resolver for active attentions + + err = memOps.resolve(*tit, 0, attentions); + + if(err) + { + break; + } + + // TODO RTC 51547 + // historically ATTN has enumerated + // all chips on the entire system so that + // PRD can figure out who caused a system + // checkstop. + + // since hostboot won't be handling that + // its faster to just enumerate attentions one + // chip at a time + + // The intent of the RTC is to confirm this + // is the desired behavior + + if(!attentions.empty()) + { + err = getPrdWrapper().callPrd(attentions); + } + + if(err) + { + break; + } + + } while(!attentions.empty()); + + if(err || attentions.empty()) + { + tit = list.erase(tit); + } + + if(err) + { + errlCommit(err, HBATTN_COMP_ID); + } + } + + return 0; +} + void PrdImpl::installPrd() { getPrdWrapper().setImpl(*this); @@ -80,7 +162,7 @@ errlHndl_t PrdImpl::callPrd(const AttentionList & i_attentions) { // forward call to the real PRD - errlHndl_t err = 0; + errlHndl_t err = NULL; // convert attention list to PRD type diff --git a/src/usr/diag/attn/attnfwd.H b/src/usr/diag/attn/attnfwd.H index f5c69d588..52422889b 100644 --- a/src/usr/diag/attn/attnfwd.H +++ b/src/usr/diag/attn/attnfwd.H @@ -30,6 +30,7 @@ * @brief HBATTN forward declarations. */ +#include <attn/attn.H> #include <intr/interrupt.H> #include <errl/errlentry.H> #include <diag/prdf/prdfMain.H> diff --git a/src/usr/diag/attn/attnsvc.C b/src/usr/diag/attn/attnsvc.C index c777eb79d..fecde1509 100644 --- a/src/usr/diag/attn/attnsvc.C +++ b/src/usr/diag/attn/attnsvc.C @@ -652,4 +652,17 @@ Service::~Service() sync_cond_destroy(&iv_cond); mutex_destroy(&iv_mutex); } + +bool Service::running() +{ + bool running; + + mutex_lock(&iv_mutex); + + running = 0 != iv_intrTaskQ; + + mutex_unlock(&iv_mutex); + + return running; +} } diff --git a/src/usr/diag/attn/attnsvc.H b/src/usr/diag/attn/attnsvc.H index aac628567..94b231847 100644 --- a/src/usr/diag/attn/attnsvc.H +++ b/src/usr/diag/attn/attnsvc.H @@ -74,6 +74,14 @@ class Service errlHndl_t start(); /** + * @brief running Provide a service running indicator. + * + * @retval[true] Service is running. + * @retval[false] Service is not running. + */ + bool running(); + + /** * @brief ctor */ Service(); diff --git a/src/usr/diag/attn/test/attnfakesys.C b/src/usr/diag/attn/test/attnfakesys.C index 6e0d22f51..35153b6d8 100644 --- a/src/usr/diag/attn/test/attnfakesys.C +++ b/src/usr/diag/attn/test/attnfakesys.C @@ -410,6 +410,17 @@ errlHndl_t FakeSystem::clearAllAttentions( return err; } +uint64_t FakeSystem::count() +{ + mutex_lock(&iv_mutex); + + uint64_t c = iv_attentions.size(); + + mutex_unlock(&iv_mutex); + + return c; +} + uint64_t FakeSystem::count(const AttnData & i_attention) { AttnDataMap<uint64_t>::iterator it = iv_attentions.find(i_attention); diff --git a/src/usr/diag/attn/test/attnfakesys.H b/src/usr/diag/attn/test/attnfakesys.H index 188bba348..0ed52927b 100644 --- a/src/usr/diag/attn/test/attnfakesys.H +++ b/src/usr/diag/attn/test/attnfakesys.H @@ -254,6 +254,14 @@ class FakeSystem : public ScomImpl */ void dump(); + /* + * @brief count Obtain the number of attentions present + * on the system. + * + * @return The number of attentions present on the system. + */ + uint64_t count(); + /** * @brief ctor */ diff --git a/src/usr/diag/attn/test/attnrandsource.H b/src/usr/diag/attn/test/attnrandsource.H index 396690505..c5e8a1db3 100644 --- a/src/usr/diag/attn/test/attnrandsource.H +++ b/src/usr/diag/attn/test/attnrandsource.H @@ -83,6 +83,11 @@ class RandSource TARGETING::TargetHandle_t * i_rangeEnd); /** + * @brief run Execute the testcase. + */ + void run(); + + /** * @brief dtor */ ~RandSource(); @@ -97,11 +102,6 @@ class RandSource static void* main(void * i_source); /** - * @brief run Execute the testcase. - */ - void run(); - - /** * @brief iv_mutex Shared data access serialization. */ mutex_t iv_mutex; diff --git a/src/usr/diag/attn/test/attntestipl.H b/src/usr/diag/attn/test/attntestipl.H new file mode 100644 index 000000000..6fee48558 --- /dev/null +++ b/src/usr/diag/attn/test/attntestipl.H @@ -0,0 +1,144 @@ +/* IBM_PROLOG_BEGIN_TAG + * This is an automatically generated prolog. + * + * $Source: src/usr/diag/attn/test/attntestipl.H $ + * + * IBM CONFIDENTIAL + * + * COPYRIGHT International Business Machines Corp. 2012 + * + * 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 other- + * wise divested of its trade secrets, irrespective of what has + * been deposited with the U.S. Copyright Office. + * + * Origin: 30 + * + * IBM_PROLOG_END_TAG + */ +#ifndef __TEST_ATTNTESTIPL_H +#define __TEST_ATTNTESTIPL_H + +/** + * @file attntestipl.H + * + * @brief Unit test for check for ipl attentions module. + */ + +#include "attnfakesys.H" +#include "attnfakegfir.H" +#include "attnfakemcs.H" +#include "attnfakegp1.H" +#include "attnfaketarget.H" +#include "attnrandsource.H" +#include "attnfakeprd.H" +#include "attntest.H" +#include "../attnproc.H" +#include <cxxtest/TestSuite.H> + +using namespace ATTN; +using namespace TARGETING; +using namespace PRDF; + +/** + * @brief AttnCheckForIplAttentionsTest Unit test for the check for ipl attentions module. + */ +class AttnCheckForIplAttentionsTest : public CxxTest::TestSuite +{ + public: + + /** + * @brief testCheckForIplAttentions Unit test for the + * check for ipl attentions module. + */ + void testCheckForIplAttentions(void) + { + static const uint64_t targetPoolSize = 8; + static const uint64_t iterations = 100; + static const uint64_t maxAttnsPerIteration = 5; + + TS_TRACE(ENTER_MRK "testCheckForIplAttentions"); + + errlHndl_t err = 0; + + FakeSystem system; + + FakeGfir xstpGfir(CHECK_STOP), + spclGfir(SPECIAL), + recGfir(RECOVERABLE); + + xstpGfir.install(system); + spclGfir.install(system); + recGfir.install(system); + + FakeMcs rec(RECOVERABLE), xstp(CHECK_STOP), special(SPECIAL); + FakeGp1 gp1; + + xstp.install(system); + special.install(system); + rec.install(system); + gp1.install(system); + + system.installScomImpl(); + + FakeMemTargetService targetSvc( + targetPoolSize); + + TargetHandleList membufs, procs; + + targetSvc.getAllChips(procs, TYPE_PROC); + targetSvc.getAllChips(membufs, TYPE_MEMBUF); + + RandSource procSource(iterations, + maxAttnsPerIteration, + system, + &procs[0], + &procs[0] + procs.size()); + + RandSource memSource( + iterations, + maxAttnsPerIteration, + system, + &membufs[0], + &membufs[0] + membufs.size()); + + targetSvc.installTargetService(); + + FakePrd prd(system); + + prd.installPrd(); + getProcOps().enable(); + + do + { + memSource.run(); + procSource.run(); + + err = checkForIplAttentions(); + + if(err) + { + TS_FAIL("unexpected error checking for ipl attentions."); + break; + } + + uint64_t count = system.count(); + if(count) + { + TS_FAIL("%d unexpected attentions present after check for ipl attentions.", count); + + system.dump(); + break; + } + + } while(0); + + TS_TRACE(EXIT_MRK "testCheckForIplAttentions"); + } +}; +#endif |