Skip to content

Commit

Permalink
Look for any parent on deconfigure
Browse files Browse the repository at this point in the history
There are error scenarios where a unit can get deconfigured
and its parent is not considered present. This can lead to errors
in the deconfig by association logic because a unit should always
have a present parent.

This change has the deconfig logic just find the parent. If it's
considered not present or not functional then the code can handle
that, it just needs the parent target.

This commit also fixes a bug found in testing in the DIMM deconfig
by association path.

Change-Id: I98c4185192a0944543cc545277504b50bd951c3e
CQ: SW431931
Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/60053
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: Prachi Gupta <pragupta@us.ibm.com>
Reviewed-by: Richard J. Knight <rjknight@us.ibm.com>
Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
  • Loading branch information
geissonator authored and dcrowell77 committed Jun 8, 2018
1 parent 8e9be41 commit 3e4082b
Show file tree
Hide file tree
Showing 2 changed files with 138 additions and 11 deletions.
46 changes: 35 additions & 11 deletions src/usr/hwas/common/deconfigGard.C
Original file line number Diff line number Diff line change
Expand Up @@ -1587,9 +1587,11 @@ void DeconfigGard::_deconfigureByAssoc(
// EX should be deconfigured
//
// First get parent i.e EX
// Other errors may have affected parent state so use
// UTIL_FILTER_ALL
TargetHandleList pParentExList;
getParentAffinityTargetsByState(pParentExList, &i_target,
CLASS_UNIT, TYPE_EX, UTIL_FILTER_PRESENT);
CLASS_UNIT, TYPE_EX, UTIL_FILTER_ALL);
HWAS_ASSERT((pParentExList.size() == 1),
"HWAS _deconfigureByAssoc: pParentExList != 1");
Target *l_parentEX = pParentExList[0];
Expand Down Expand Up @@ -1626,10 +1628,12 @@ void DeconfigGard::_deconfigureByAssoc(
//
// EQ with no good EX should be de-configured
//
// Other errors may have affected parent state so use
// UTIL_FILTER_ALL
TargetHandleList pEqList;
getParentAffinityTargetsByState(pEqList,
&i_target, CLASS_UNIT, TYPE_EQ,
UTIL_FILTER_PRESENT);
UTIL_FILTER_ALL);

HWAS_ASSERT((pEqList.size() == 1),
"HWAS _deconfigureByAssoc: pEqList != 1");
Expand All @@ -1648,8 +1652,10 @@ void DeconfigGard::_deconfigureByAssoc(
{
// get parent DMI
TargetHandleList pParentDmiList;
// Other errors may have affected parent state so use
// UTIL_FILTER_ALL
getParentAffinityTargetsByState(pParentDmiList, &i_target,
CLASS_UNIT, TYPE_DMI, UTIL_FILTER_PRESENT);
CLASS_UNIT, TYPE_DMI, UTIL_FILTER_ALL);
HWAS_ASSERT((pParentDmiList.size() == 1),
"HWAS _deconfigureByAssoc: pParentDmiList > 1");
const Target *l_parentDmi = pParentDmiList[0];
Expand All @@ -1671,9 +1677,12 @@ void DeconfigGard::_deconfigureByAssoc(
case TYPE_MCA:
{
// get parent MCS
// Other errors may have affected parent state so use
// UTIL_FILTER_ALL
TargetHandleList pParentMcsList;
getParentAffinityTargetsByState(pParentMcsList, &i_target,
CLASS_UNIT, TYPE_MCS, UTIL_FILTER_PRESENT);
CLASS_UNIT, TYPE_MCS,
UTIL_FILTER_ALL);

HWAS_ASSERT((pParentMcsList.size() == 1),
"HWAS _deconfigureByAssoc: pParentMcsList != 1");
Expand All @@ -1699,9 +1708,12 @@ void DeconfigGard::_deconfigureByAssoc(
case TYPE_MCS:
{
// get parent MCBIST
// Other errors may have affected parent state so use
// UTIL_FILTER_ALL
TargetHandleList pParentMcbistList;
getParentAffinityTargetsByState(pParentMcbistList, &i_target,
CLASS_UNIT, TYPE_MCBIST, UTIL_FILTER_PRESENT);
CLASS_UNIT, TYPE_MCBIST,
UTIL_FILTER_ALL);

HWAS_ASSERT((pParentMcbistList.size() <= 1),
"HWAS _deconfigureByAssoc: MCS has multiple MCBIST parents, this is impossible");
Expand Down Expand Up @@ -1733,9 +1745,12 @@ void DeconfigGard::_deconfigureByAssoc(
case TYPE_MI:
{
// get parent MC
// Other errors may have affected parent state so use
// UTIL_FILTER_ALL
TargetHandleList pParentMctList;
getParentAffinityTargetsByState(pParentMctList, &i_target,
CLASS_UNIT, TYPE_MC, UTIL_FILTER_PRESENT);
CLASS_UNIT, TYPE_MC,
UTIL_FILTER_ALL);

HWAS_ASSERT((pParentMctList.size() <= 1),
"HWAS _deconfigureByAssoc: MI has multiple MC parents, this is impossible");
Expand Down Expand Up @@ -1767,9 +1782,12 @@ void DeconfigGard::_deconfigureByAssoc(
case TYPE_DMI:
{
// get parent MI
// Other errors may have affected parent state so use
// UTIL_FILTER_ALL
TargetHandleList pParentMitList;
getParentAffinityTargetsByState(pParentMitList, &i_target,
CLASS_UNIT, TYPE_MI, UTIL_FILTER_PRESENT);
CLASS_UNIT, TYPE_MI,
UTIL_FILTER_ALL);

HWAS_ASSERT((pParentMitList.size() <= 1),
"HWAS _deconfigureByAssoc: DMI has multiple MI parents, this is impossible");
Expand Down Expand Up @@ -1835,11 +1853,11 @@ void DeconfigGard::_deconfigureByAssoc(
// get immediate parent (MCA/MBA/etc)
TargetHandleList pParentList;
PredicatePostfixExpr funcParent;
funcParent.push(&isFunctional).And();
funcParent.push(&isFunctional);
targetService().getAssociated(pParentList,
&i_target,
TargetService::PARENT_BY_AFFINITY,
TargetService::ALL,
TargetService::IMMEDIATE,
&funcParent);

HWAS_ASSERT((pParentList.size() <= 1),
Expand Down Expand Up @@ -1920,9 +1938,12 @@ void DeconfigGard::_deconfigureByAssoc(
} // TYPE_PORE
case TYPE_PHB:
{
// Other errors may have affected parent state so use
// UTIL_FILTER_ALL
TargetHandleList pParentPECList;
getParentAffinityTargetsByState(pParentPECList, &i_target,
CLASS_UNIT, TYPE_PEC, UTIL_FILTER_PRESENT);
CLASS_UNIT, TYPE_PEC,
UTIL_FILTER_ALL);
HWAS_ASSERT((pParentPECList.size() == 1),
"HWAS _deconfigureByAssoc: pParentPECList != 1");
Target *l_parentPEC = pParentPECList[0];
Expand All @@ -1942,9 +1963,12 @@ void DeconfigGard::_deconfigureByAssoc(
} // TYPE_PHB
case TYPE_OBUS_BRICK:
{
// Other errors may have affected parent state so use
// UTIL_FILTER_ALL
TargetHandleList pParentObusList;
getParentAffinityTargetsByState(pParentObusList, &i_target,
CLASS_UNIT, TYPE_OBUS, UTIL_FILTER_PRESENT);
CLASS_UNIT, TYPE_OBUS,
UTIL_FILTER_ALL);
HWAS_ASSERT((pParentObusList.size() == 1),
"HWAS _deconfigureByAssoc: pParentObusList != 1");

Expand Down
103 changes: 103 additions & 0 deletions src/usr/hwas/test/hwasGardTest.H
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
#include <cxxtest/TestSuite.H>
#include <errl/errlmanager.H>
#include <targeting/common/targetservice.H>
#include <targeting/common/utilFilter.H>
#include <hwas/common/hwas.H>
#include <hwas/common/deconfigGard.H>
#include <hwas/common/hwas_reasoncodes.H>
Expand Down Expand Up @@ -1196,6 +1197,108 @@ public:
#endif
}

/**
* @brief Test Deconfiguring by Association
*
* Ensure that if a parent of an MBA being deconfigured is not present
* (due to some other bug) that the deconfig by association code properly
* handles it.
*
*/
void testDeconfigureAssoc6()
{
TS_TRACE(INFO_MRK "testDeconfigureAssoc6: Started");
#if DISABLE_MEM_UNIT_TESTS
// 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 adversly 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 adversly affected");
HWAS_INF("testDeconfigureAssoc6: Skipped");
#else
HWAS_INF("testDeconfigureAssoc6: Started");

errlHndl_t l_pErr = NULL;

do
{
// find an MEMBUF
Target * pSys;
targetService().getTopLevelTarget(pSys);

PredicateCTM predMembuf(CLASS_CHIP, TYPE_MEMBUF);
PredicateHwas predFunctional;
predFunctional.poweredOn(true).present(true).functional(true);
PredicatePostfixExpr checkExpr;
checkExpr.push(&predMembuf).push(&predFunctional).And();
TargetHandleList pMembuf;
targetService().getAssociated( pMembuf, pSys,
TargetService::CHILD, TargetService::ALL, &checkExpr );

if (pMembuf.empty())
{
TS_FAIL("testDeconfigureAssoc6: empty pMembuf");
break;
}
TargetHandle_t l_pTarget = *pMembuf.begin();

// Get the original HWAS_STATE of the target
HwasState l_origState = l_pTarget->getAttr<ATTR_HWAS_STATE>();

// Get it's parent DMI target
TargetHandleList pParentDmiList;
getParentAffinityTargetsByState(pParentDmiList, l_pTarget,
CLASS_UNIT, TYPE_DMI, UTIL_FILTER_PRESENT);
if (pParentDmiList.empty())
{
TS_FAIL("testDeconfigureAssoc6: empty pParentDmiList");
break;
}
TargetHandle_t l_parentTgt = *pParentDmiList.begin();

// Save off parent state and set to not present
HwasState l_parOrigState = l_parentTgt->getAttr<ATTR_HWAS_STATE>();
HwasState l_parTestState = l_parOrigState;
l_parTestState.present = 0;
l_parentTgt->setAttr<ATTR_HWAS_STATE>(l_parTestState);

// Deconfigure the target.
l_pErr = theDeconfigGard().
deconfigureTarget(*l_pTarget, 0xA2);
if (l_pErr)
{
TS_FAIL("testDeconfigureAssoc6: Error from deconfigureTarget");
break;
}

// Get the new HWAS_STATE of the target
HwasState l_state = l_pTarget->getAttr<ATTR_HWAS_STATE>();

if (l_state.functional)
{
TS_FAIL("testDeconfigureAssoc6: target functional after deconfigure");
break;
}

// Reset the HWAS_STATE of the target and it's parent
l_pTarget->setAttr<ATTR_HWAS_STATE>(l_origState);
l_parentTgt->setAttr<ATTR_HWAS_STATE>(l_parOrigState);

TS_TRACE(INFO_MRK "testDeconfigureAssoc6: Success");
}
while (0);

if (l_pErr)
{
errlCommit(l_pErr,HWAS_COMP_ID);
}
#endif
}

/**
* @brief Test EX with no good cores should be deconfigured
*/
Expand Down

0 comments on commit 3e4082b

Please sign in to comment.