Skip to content

Commit

Permalink
Support multiple nodes in HBRT - Concurrent Code Update
Browse files Browse the repository at this point in the history
Enable HBRT to prepare for a concurrent code update on a multiple node system.
Modify preparation function called by Host to loop through all nodes on the
system.  Make additional updates to go from supporting only a single node to
supporting multiple nodes.

Change-Id: I2d72b26abf40812641815051b968d6b540d27b00
RTC: 186584
Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/53952
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: Christian R. Geddes <crgeddes@us.ibm.com>
Reviewed-by: Prachi Gupta <pragupta@us.ibm.com>
Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
  • Loading branch information
mgloff authored and dcrowell77 committed Apr 9, 2018
1 parent 093052d commit 519b09d
Show file tree
Hide file tree
Showing 11 changed files with 624 additions and 358 deletions.
8 changes: 3 additions & 5 deletions src/include/usr/runtime/rt_targeting.H
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,12 @@ namespace RT_TARG
* into new LID Structure data
* @param[in] Pointer to current Reserved Memory targeting binary data
* @param[in/out] Pointer to new LID Structure targeting binary data
* @param[out] Error log userdata2 value associated with non-zero rtn code
* @param[in] Instance, ie, Node ID
* @return nullptr on success, else error log
*/
errlHndl_t saveRestoreAttrs(void *i_rsvdMemPtr,
void *io_lidStructPtr,
uint64_t& o_userdata2);
uint8_t i_instance);

/**
* @brief Validate LID Structure against Reserved Memory. Check that the
Expand All @@ -82,13 +82,11 @@ namespace RT_TARG
* @param[in] Pointer to new LID Structure targeting binary data
* @param[in] Pointer to current Reserved Memory targeting binary data
* @param[out] Total size of all sections in the new lid
* @param[out] Error log userdata2 value associated with non-zero rtn code
* @return nullptr on success, else error log
*/
errlHndl_t validateData(void *i_lidStructPtr,
void *i_rsvdMemPtr,
size_t& o_lidTotalSize,
uint64_t& o_userdata2);
size_t& o_lidTotalSize);

/**
* @brief Apply ATTR_TMP overrides to be available for run time
Expand Down
51 changes: 40 additions & 11 deletions src/include/usr/targeting/attrrp.H
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ class AttrRP
#else
friend errlHndl_t RT_TARG::saveRestoreAttrs(void *,
void *,
uint64_t&);
uint8_t);
#endif

public:
Expand Down Expand Up @@ -306,14 +306,16 @@ class AttrRP

#else
/**
* @brief Fill in new attribute resource provider for HBRT.
* @brief Get node instance status of attribute resource provider
* which indicates if the attribute resource provider is handling
* a single node or multiple nodes
*
* @param[in] i_header
* TargetingHeader to use with filling in the new RT AttrRP.
*
* @return void
* @return Node instance status
*/
void fillInAttrRP(TargetingHeader* i_header);
NodeInstanceStatus getInstanceStatus()
{
return iv_instanceStatus;
}

/**
* @brief Get count of nodes handled by attribute resource provider.
Expand Down Expand Up @@ -352,12 +354,39 @@ class AttrRP
* @par Detailed Description:
* Ensures member variables are initialized to sane values.
*/
AttrRP(TargetingHeader* i_header)
: iv_isTempInstance(true), iv_instanceStatus(SINGLE_NODE),
AttrRP(TargetingHeader* i_header,
NODE_ID i_nodeId,
size_t i_nodeCount,
NodeInstanceStatus i_instanceStatus)
: iv_isTempInstance(true), iv_instanceStatus(i_instanceStatus),
iv_isMpipl(false)
{
// Fill in member variables
fillInAttrRP(i_header);
// Work with nodes before passed in node
for(NODE_ID l_nodeId = NODE0; l_nodeId < i_nodeCount; ++l_nodeId)
{
// Create local copy of container for node info struct
NodeInfo l_nodeCont;

if(l_nodeId == i_nodeId)
{
// Initialize local copy of container for node info struct
errlHndl_t l_errl = nodeInfoInit(l_nodeCont,
i_header,
i_nodeId);
if (l_errl)
{
l_errl->setSev(ERRORLOG::ERRL_SEV_UNRECOVERABLE);

/* Commit the error */
errlCommit(l_errl, TARG_COMP_ID);

break;
}
}

// Push back node info struct into the node container
iv_nodeContainer.push_back(l_nodeCont);
}
};
#endif

Expand Down
90 changes: 88 additions & 2 deletions src/include/usr/targeting/common/target.H
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ namespace RT_TARG
void adjustTargeting4Runtime();
ERRORLOG::ErrlEntry* saveRestoreAttrs(void *i_rsvdMemPtr,
void *io_lidStructPtr,
uint64_t& o_userdata2);
uint8_t i_instance);
}
#endif

Expand Down Expand Up @@ -179,6 +179,34 @@ class Target
template<const ATTRIBUTE_ID A>
typename AttributeTraits<A>::Type getAttr() const;

/**
* @brief Get the target's specified attribute value
*
* Returns the target's specified attribute value. If the specified
* attribute does not exist for the associated target, the routine
* asserts. Thus callers must be sure the attribute exists for the
* given target.
*
* @param[in] i_attrRP Pointer to attribute resource provider
* @param[in] i_pAttrId Pointer to array of attribute IDs for target
* @param[in] i_ppAttrAddr Pointer to array of attribute addresses
*
* @pre Target service must be initialized
*
* @post Target's specified attribute value returned, or assert
* called if specified attribute doesn't exist for the
* associated target
*
* @return Data type associated with the attribute being returned
*
* @retval Varies The attribute data
*/
template<const ATTRIBUTE_ID A>
typename AttributeTraits<A>::Type getAttr(AttrRP* i_attrRP,
ATTRIBUTE_ID* i_pAttrId,
AbstractPointer<void>*
i_ppAttrAddr) const;

/**
* @brief DEBUG ONLY! Returns the requested attribute as a string
*
Expand Down Expand Up @@ -479,6 +507,39 @@ class Target
uint32_t i_size,
void* io_attrData) const;

/**
* @brief Tries to get the target's specified attribute value without
* checking for valid values. Do not call this function
* directly. This function is private.
*
* Tries to get the target's specified attribute value
*
* @param[in] i_attr Attribute to retrieve
* @param[in] i_size Size of the attribute
* @param[in] i_attrRP Pointer to attribute resource provider
* @param[in] i_pAttrId Pointer to array of attribute IDs for target
* @param[in] i_ppAttrAddr Pointer to array of attribute addresses
* @param[in/out] io_attrData On input, location to store the attribute
* On output, location updated with attribute data
*
* @pre Target service must be initialized
*
* @post Caller notified if attribute retrieval succeeded or not. If
* so, the attribute data is stored at io_addrData
*
* @return bool indicating if attribute retrieval succeeded or not
*
* @retval true Attribute retrieval succeeded
* @retval false Attribute retrieval failed
*/
bool _tryGetAttrUnsafe(
ATTRIBUTE_ID i_attr,
uint32_t i_size,
AttrRP* i_attrRP,
ATTRIBUTE_ID* i_pAttrId,
AbstractPointer<void>* i_ppAttrAddr,
void* io_attrData) const;

/**
* @brief Tries to set the target's specified attribute value
*
Expand Down Expand Up @@ -704,7 +765,7 @@ class Target
friend void RT_TARG::adjustTargeting4Runtime();
friend ERRORLOG::ErrlEntry* RT_TARG::saveRestoreAttrs(void *,
void *,
uint64_t&);
uint8_t);
#endif


Expand Down Expand Up @@ -763,6 +824,31 @@ typename AttributeTraits<A>::Type Target::getAttr() const
return l_attrValue;
}

template<const ATTRIBUTE_ID A>
typename AttributeTraits<A>::Type Target::getAttr(AttrRP* i_attrRP,
ATTRIBUTE_ID* i_pAttrId,
AbstractPointer<void>*
i_ppAttrAddr) const
{
typename AttributeTraits<A>::Type l_attrValue;
if(AttributeTraits<A>::readable) { }
if(AttributeTraits<A>::notHbMutex) { }
if(AttributeTraits<A>::notFspMutex) { }

bool l_read = _tryGetAttrUnsafe(A,
sizeof(l_attrValue),
i_attrRP,
i_pAttrId,
i_ppAttrAddr,
reinterpret_cast<void*>(&l_attrValue));

if (unlikely(!l_read))
{
targAssert(GET_ATTR, A);
}
return l_attrValue;
}

template<const ATTRIBUTE_ID A>
void Target::setAttr(typename AttributeTraits<A>::Type const& i_attrValue)
{
Expand Down
25 changes: 12 additions & 13 deletions src/include/usr/targeting/common/targetservice.H
Original file line number Diff line number Diff line change
Expand Up @@ -726,31 +726,30 @@ class TargetService
void getMasterNodeTarget(Target*& o_masterNodeTarget) const;

/**
* @brief Returns Target Range Filter information.
* @brief Returns Array of Targets from Targeting Image.
*
* @par Detailed Description:
* Returns the Target Range Filter information for the specified
* attribute data and resource provider.
* Returns a pointer to the Array of Targets found in the Targeting
* Image as provided by the Attribute Data.
*
* @param[in] i_attrData pointer to attribute data
*
* @param[in] i_attrRP pointer to attribute resource provider
* @param[in] i_nodeId, node ID for the targeting image
*
* @param[out] o_maxTargets maximum targets in the range
* @param[in] i_attrRP pointer to attribute resource provider
*
* @param[in] i_nodeId, node ID for the target.
* @param[out] o_maxTargets maximum targets in image
*
* @pre TargetService must be initialized.
*
* @post Returns the Target Range Filter information for the specified
* attribute data and resource provider.
* @post Returns pointer to Array of Targets from Targeting Image.
*
* @return TargetRangeFilter
* @return Target*
*/
TargetRangeFilter getTargetRangeFilter(void *i_attrData,
AttrRP *i_attrRP,
uint32_t &o_maxTargets,
NODE_ID i_nodeId);
Target* getTargetArray(void *i_attrData,
NODE_ID i_nodeId,
AttrRP *i_attrRP,
uint32_t &o_maxTargets);

/**
* @brief Returns Target Attribute information.
Expand Down
4 changes: 2 additions & 2 deletions src/usr/errl/errlentry.C
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,9 @@ ErrlEntry::ErrlEntry(const errlSeverity_t i_sev,
iv_eselCallhomeInfoEvent(false)
{
#ifdef CONFIG_ERRL_ENTRY_TRACE
TRACFCOMP( g_trac_errl, ERR_MRK"Error created : PLID=%.8X, RC=%.4X, Mod=%.2X, Userdata=%.16X %.16X", plid(), i_reasonCode, i_modId, i_user1, i_user2 );
TRACFCOMP( g_trac_errl, ERR_MRK"Error created : PLID=%.8X, RC=%.4X, Mod=%.2X, Userdata=%.16llX %.16llX", plid(), i_reasonCode, i_modId, i_user1, i_user2 );
#else
TRACDCOMP( g_trac_errl, ERR_MRK"Error created : PLID=%.8X, RC=%.4X, Mod=%.2X, Userdata=%.16X %.16X", plid(), i_reasonCode, i_modId, i_user1, i_user2 );
TRACDCOMP( g_trac_errl, ERR_MRK"Error created : PLID=%.8X, RC=%.4X, Mod=%.2X, Userdata=%.16llX %.16llX", plid(), i_reasonCode, i_modId, i_user1, i_user2 );
#endif
// Collect the Backtrace and add it to the error log
iv_pBackTrace = new ErrlUserDetailsBackTrace();
Expand Down
7 changes: 7 additions & 0 deletions src/usr/targeting/attrrp_common.C
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ namespace TARGETING
if (iv_sections) // @TODO RTC:186585 move if... to #ifndef clause
{
delete[] iv_sections;
iv_sections = nullptr;
} // @TODO RTC:186585 move if... to #ifndef clause

#ifndef __HOSTBOOT_RUNTIME
Expand All @@ -71,7 +72,13 @@ namespace TARGETING
{
if (iv_nodeContainer[i].pSections)
{
if((i == NODE0) && (iv_sections == nullptr))
{
iv_nodeContainer[i].pSections = nullptr;
continue;
} // @TODO RTC:186585 move if...
delete[] iv_nodeContainer[i].pSections;
iv_nodeContainer[i].pSections = nullptr;
}
}

Expand Down
28 changes: 28 additions & 0 deletions src/usr/targeting/common/target.C
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,34 @@ bool Target::_tryGetAttrUnsafe(
#undef TARG_FN
}

//******************************************************************************
// Target::_tryGetAttrUnsafe
//******************************************************************************
bool Target::_tryGetAttrUnsafe(
const ATTRIBUTE_ID i_attr,
const uint32_t i_size,
AttrRP* i_attrRP,
ATTRIBUTE_ID* i_pAttrId,
AbstractPointer<void>* i_ppAttrAddr,
void* const io_pAttrData) const
{
#define TARG_FN "_tryGetAttrUnsafe()"

bool l_found = false;

void* l_pAttrData = NULL;
_getAttrPtr(i_attr, i_attrRP, i_pAttrId, i_ppAttrAddr, l_pAttrData);
if (l_pAttrData)
{
memcpy(io_pAttrData, l_pAttrData, i_size);
l_found = true;
}

return l_found;

#undef TARG_FN
}

//******************************************************************************
// Target::_trySetAttr
//******************************************************************************
Expand Down

0 comments on commit 519b09d

Please sign in to comment.