From ad517636c3d03b685abc57a5eb3a54ce22c8f2e8 Mon Sep 17 00:00:00 2001 From: Rick Ward Date: Thu, 29 Mar 2018 13:47:19 -0500 Subject: Verify deconfig-by-association assumptions still apply to CDIMM scenario. Corrected the deconfig code so that it will only deconfig a MBA if all of its DIMMs have been deconfig'd. Added a testcase to confirm the behavior. Change-Id: Iaf1111073c7229e3d3b72f17b9b905dd244ceb9a RTC: 176408 Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/56481 Tested-by: Jenkins Server Tested-by: Jenkins OP Build CI Tested-by: Jenkins OP HW Tested-by: FSP CI Jenkins Reviewed-by: Richard J. Knight Reviewed-by: Prachi Gupta Reviewed-by: SWATHI M. BHATTIPROLU Reviewed-by: William G. Hoffa --- src/usr/hwas/common/deconfigGard.C | 30 ++++++++-- src/usr/hwas/test/hwasGardTest.H | 118 ++++++++++++++++++++++++++++++++++++- 2 files changed, 141 insertions(+), 7 deletions(-) (limited to 'src/usr/hwas') diff --git a/src/usr/hwas/common/deconfigGard.C b/src/usr/hwas/common/deconfigGard.C index 44493ae5f..2e0383b91 100644 --- a/src/usr/hwas/common/deconfigGard.C +++ b/src/usr/hwas/common/deconfigGard.C @@ -1806,12 +1806,30 @@ void DeconfigGard::_deconfigureByAssoc( if (!pParentMbaList.empty()) { const Target *l_parentMba = pParentMbaList[0]; - HWAS_INF("_deconfigureByAssoc DIMM parent MBA: %.8X", - get_huid(l_parentMba)); - _deconfigureTarget(const_cast (*l_parentMba), - i_errlEid, NULL, i_deconfigRule); - _deconfigureByAssoc(const_cast (*l_parentMba), - i_errlEid, i_deconfigRule); + + // get children DIMM that are functional + // NOTE cannot use anyChildFunctional to determine this + // because we need to look at affinity path + TargetHandleList pDimmList; + PredicateCTM predDimm(CLASS_LOGICAL_CARD, TYPE_DIMM); + PredicatePostfixExpr funcDimms; + funcDimms.push(&predDimm).push(&isFunctional).And(); + targetService().getAssociated(pDimmList, + l_parentMba, + TargetService::CHILD_BY_AFFINITY, + TargetService::ALL, + &funcDimms); + + // if parent MBA has no functional memory + if (pDimmList.empty()) + { + HWAS_INF("_deconfigureByAssoc DIMM parent MBA: %.8X", + get_huid(l_parentMba)); + _deconfigureTarget(const_cast (*l_parentMba), + i_errlEid, NULL, i_deconfigRule); + _deconfigureByAssoc(const_cast (*l_parentMba), + i_errlEid, i_deconfigRule); + } } TargetHandleList pParentMcaList; diff --git a/src/usr/hwas/test/hwasGardTest.H b/src/usr/hwas/test/hwasGardTest.H index 5a5486c27..7d1fcc5fa 100644 --- a/src/usr/hwas/test/hwasGardTest.H +++ b/src/usr/hwas/test/hwasGardTest.H @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2011,2017 */ +/* Contributors Listed Below - COPYRIGHT 2011,2018 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -1060,6 +1060,122 @@ public: #endif } + /** + * @brief Test Deconfiguring by Association + */ + void testDeconfigureAssoc5() + { + TS_TRACE(INFO_MRK "testDeconfigureAssoc5: Started"); +#if 1 + // these tests deconfigure and gard targets. and even though they + // restore their state after the tests, since the cxxtests are + // all run in parallel, during the time that a target is non- + // functional due to this test, another test may be running that + // might be adversely affected. + // tests are left in the code so that a developer can enable them + // to test these specific functions - just keep in mind that there + // could be side effects in other cxxtests. + TS_TRACE(" - SKIPPING -- other tests could be adversely affected"); +#else + + errlHndl_t l_pErr = NULL; + + do + { + // find a MBA, deconfigure the attached DIMMs + Target * pSys; + targetService().getTopLevelTarget(pSys); + + PredicateCTM predMba(CLASS_UNIT, TYPE_MBA); + PredicateHwas predFunctional; + predFunctional.poweredOn(true).present(true).functional(true); + PredicatePostfixExpr funcMbas; + funcMbas.push(&predMba).push(&predFunctional).And(); + + TargetHandleList pMbaList; + targetService().getAssociated(pMbaList, pSys, + TargetService::CHILD, TargetService::ALL, + &funcMbas); + + if (pMbaList.empty()) + { + TS_FAIL("testDeconfigureAssoc5: empty MBA list"); + break; + } + TargetHandle_t l_pMba = pMbaList[0]; + + // Get the original HWAS_STATE of the MBA + HwasState l_origState = l_pMba->getAttr(); + + // find all DIMM targets + PredicateCTM predDimm(CLASS_LOGICAL_CARD, TYPE_DIMM); + PredicatePostfixExpr funcDimms; + funcDimms.push(&predDimm).push(&predFunctional).And(); + TargetHandleList pDimmList; + targetService().getAssociated(pDimmList, l_pMba, + TargetService::CHILD_BY_AFFINITY, TargetService::ALL, + &funcDimms); + if (pDimmList.empty()) + { + TS_FAIL("testDeconfigureAssoc5: empty DIMM list"); + break; + } + + // deconfigure all but one DIMM + for (auto i = pDimmList.size() - 1;i > 0;--i) + { + TargetHandle_t l_pDimm = pDimmList[i]; + + // Deconfigure the DIMM. + l_pErr = theDeconfigGard(). + deconfigureTarget(*l_pDimm, 0xA5); + if (l_pErr) + { + TS_FAIL("testDeconfigureAssoc5: Error from deconfigureTarget"); + break; + } + } + // Check the HWAS_STATE of the MBA + HwasState l_state = l_pMba->getAttr(); + if (!l_state.functional) + { + TS_FAIL("testDeconfigureAssoc5: MBA not functional after deconfiguring most DIMMS"); + break; + } + + // deconfigure last functional DIMM + TargetHandle_t l_pLastDimm = pDimmList[0]; + l_pErr = theDeconfigGard().deconfigureTarget(*l_pLastDimm, 0xA6); + if (l_pErr) + { + TS_FAIL("testDeconfigureAssoc5: Error from deconfigureTarget"); + break; + } + // Check the HWAS_STATE of the MBA + l_state = l_pMba->getAttr(); + if (l_state.functional) + { + TS_FAIL("testDeconfigureAssoc5: MBA functional after deconfiguring all DIMMS"); + break; + } + + // Reset the HWAS_STATE of the DIMMs and MBA + ATTR_HWAS_STATE_type functionalHwasState = {0}; + functionalHwasState.functional = true; + for (auto l_pDimm: pDimmList) + l_pDimm->setAttr(functionalHwasState); + l_pMba->setAttr(l_origState); + + TS_TRACE(INFO_MRK "testDeconfigureAssoc5: Success"); + } + while (0); + + if (l_pErr) + { + errlCommit(l_pErr, HWAS_COMP_ID); + } +#endif + } /** * @brief Test EX with no good cores should be deconfigured -- cgit v1.2.1